bindings/python/pinocchio/__init__.py
Go to the documentation of this file.
1 #
2 # Copyright (c) 2015-2020 CNRS INRIA
3 #
4 
5 import numpy
6 
7 # On Windows, if pinocchio.dll is not in the same directory than
8 # the .pyd, it will not be loaded.
9 # We first try to load pinocchio, then, if it fail and we are on Windows:
10 # 1. We add all paths inside PINOCCHIO_WINDOWS_DLL_PATH to DllDirectory
11 # 2. If PINOCCHIO_WINDOWS_DLL_PATH we add the relative path from the
12 # package directory to the bin directory to DllDirectory
13 # This solution is inspired from:
14 # - https://github.com/PixarAnimationStudios/OpenUSD/pull/1511/files
15 # - https://stackoverflow.com/questions/65334494/python-c-extension-packaging-dll-along-with-pyd
16 # More resources on https://github.com/diffpy/pyobjcryst/issues/33
17 try:
18  from .pinocchio_pywrap import *
19  from .pinocchio_pywrap import __version__, __raw_version__
20 except ImportError:
21  import platform
22  if platform.system() == "Windows":
23  from .windows_dll_manager import get_dll_paths, build_directory_manager
24 
25  with build_directory_manager() as dll_dir_manager:
26  for p in get_dll_paths():
27  dll_dir_manager.add_dll_directory(p)
28  from .pinocchio_pywrap import *
29  from .pinocchio_pywrap import __version__, __raw_version__
30  else:
31  raise
32 
33 from . import utils
34 from .explog import exp, log
35 
36 # Manually register submodules
37 import sys, inspect
38 
39 submodules = inspect.getmembers(pinocchio_pywrap, inspect.ismodule)
40 for module_info in submodules:
41  sys.modules['pinocchio.' + module_info[0]] = module_info[1]
42 
43 if WITH_HPP_FCL:
44  try:
45  import hppfcl
46  from hppfcl import Contact, StdVec_Contact, CollisionResult, StdVec_CollisionResult, DistanceResult, StdVec_DistanceResult, CollisionGeometry, MeshLoader, CachedMeshLoader
47  WITH_HPP_FCL_BINDINGS = True
48  except ImportError:
49  WITH_HPP_FCL_BINDINGS = False
50 else:
51  WITH_HPP_FCL_BINDINGS = False
52 
53 from .robot_wrapper import RobotWrapper
54 from .deprecated import *
55 from .shortcuts import *
56 from . import visualize
pinocchio.windows_dll_manager.build_directory_manager
def build_directory_manager()
Definition: windows_dll_manager.py:52
pinocchio.windows_dll_manager.get_dll_paths
def get_dll_paths()
Definition: windows_dll_manager.py:6


pinocchio
Author(s):
autogenerated on Tue Feb 13 2024 03:43:57