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


pinocchio
Author(s):
autogenerated on Mon Dec 16 2024 03:40:57