Skip to content
Snippets Groups Projects
Unverified Commit 9369716d authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #169 from fabinsch/topic/path

always try to import MODEL_DIR and DATA_SOURCE_DIR
parents 47aee012 01cae8b1
No related branches found
No related tags found
No related merge requests found
Pipeline #28038 passed
...@@ -5,6 +5,11 @@ import numpy as np ...@@ -5,6 +5,11 @@ import numpy as np
import pinocchio as pin import pinocchio as pin
from pinocchio.robot_wrapper import RobotWrapper from pinocchio.robot_wrapper import RobotWrapper
try:
from .path import EXAMPLE_ROBOT_DATA_MODEL_DIR, EXAMPLE_ROBOT_DATA_SOURCE_DIR
except ImportError:
pass
def getModelPath(subpath, printmsg=False): def getModelPath(subpath, printmsg=False):
source = dirname(dirname(dirname(__file__))) # top level source directory source = dirname(dirname(dirname(__file__))) # top level source directory
...@@ -17,13 +22,13 @@ def getModelPath(subpath, printmsg=False): ...@@ -17,13 +22,13 @@ def getModelPath(subpath, printmsg=False):
join(source, "robots"), join(source, "robots"),
] ]
try: try:
from .path import EXAMPLE_ROBOT_DATA_MODEL_DIR, EXAMPLE_ROBOT_DATA_SOURCE_DIR EXAMPLE_ROBOT_DATA_MODEL_DIR
# function called from installed project # function called from installed project
paths.append(EXAMPLE_ROBOT_DATA_MODEL_DIR) paths.append(EXAMPLE_ROBOT_DATA_MODEL_DIR)
# function called from off-tree build dir # function called from off-tree build dir
paths.append(EXAMPLE_ROBOT_DATA_SOURCE_DIR) paths.append(EXAMPLE_ROBOT_DATA_SOURCE_DIR)
except ImportError: except NameError:
pass pass
paths += [join(p, "../../../share/example-robot-data/robots") for p in sys.path] paths += [join(p, "../../../share/example-robot-data/robots") for p in sys.path]
for path in paths: for path in paths:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment