Unverified Commit 1c982a46 authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub

Merge pull request #44 from nim65s/devel

[Python] add more paths to getModelPath, fix #37
parents a00409a3 b40df3a6
Pipeline #10508 passed with stage
in 1 minute and 41 seconds
EXAMPLE_ROBOT_DATA_MODEL_DIR = "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/robots"
EXAMPLE_ROBOT_DATA_SOURCE_DIR = "${PROJECT_SOURCE_DIR}/robots"
......@@ -3,7 +3,6 @@ import warnings
from os.path import dirname, exists, join
import numpy as np
import pinocchio as pin
from pinocchio.robot_wrapper import RobotWrapper
......@@ -11,13 +10,16 @@ pin.switchToNumpyArray()
def getModelPath(subpath, printmsg=False):
source = dirname(dirname(dirname(__file__))) # top level source directory
paths = [
join(dirname(dirname(dirname(dirname(__file__)))), 'robots'),
join(dirname(dirname(dirname(__file__))), 'robots')
join(dirname(dirname(dirname(source))), 'robots'), # function called from "make release" in build/ dir
join(dirname(source), 'robots'), # function called from a build/ dir inside top level source
join(source, 'robots') # function called from top level source dir
]
try:
from .path import EXAMPLE_ROBOT_DATA_MODEL_DIR
paths.append(EXAMPLE_ROBOT_DATA_MODEL_DIR)
from .path import EXAMPLE_ROBOT_DATA_MODEL_DIR, EXAMPLE_ROBOT_DATA_SOURCE_DIR
paths.append(EXAMPLE_ROBOT_DATA_MODEL_DIR) # function called from installed project
paths.append(EXAMPLE_ROBOT_DATA_SOURCE_DIR) # function called from off-tree build dir
except ImportError:
pass
paths += [join(p, '../../../share/example-robot-data/robots') for p in sys.path]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment