Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
example-robot-data
Commits
556fee15
Commit
556fee15
authored
Nov 26, 2019
by
Guilhem Saurel
Browse files
add path.py.in, similar to path.hpp.in
parent
b58fa407
Changes
3
Hide whitespace changes
Inline
Side-by-side
python/CMakeLists.txt
View file @
556fee15
...
@@ -7,3 +7,6 @@ SET(${PROJECT_NAME}_PYTHON_FILES
...
@@ -7,3 +7,6 @@ SET(${PROJECT_NAME}_PYTHON_FILES
FOREACH
(
python
${${
PROJECT_NAME
}
_PYTHON_FILES
}
)
FOREACH
(
python
${${
PROJECT_NAME
}
_PYTHON_FILES
}
)
PYTHON_INSTALL_ON_SITE
(
${
PY_NAME
}
${
python
}
)
PYTHON_INSTALL_ON_SITE
(
${
PY_NAME
}
${
python
}
)
ENDFOREACH
(
python
${${
PROJECT_NAME
}
_PYTHON_FILES
}
)
ENDFOREACH
(
python
${${
PROJECT_NAME
}
_PYTHON_FILES
}
)
CONFIGURE_FILE
(
${
PY_NAME
}
/path.py.in
${
PY_NAME
}
/path.py
)
INSTALL
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
PY_NAME
}
/path.py DESTINATION
"
${
PYTHON_SITELIB
}
/
${
PY_NAME
}
"
)
python/example_robot_data/path.py.in
0 → 100644
View file @
556fee15
EXAMPLE_ROBOT_DATA_MODEL_DIR = "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/robots"
python/example_robot_data/robots_loader.py
View file @
556fee15
...
@@ -7,15 +7,22 @@ from pinocchio.robot_wrapper import RobotWrapper
...
@@ -7,15 +7,22 @@ from pinocchio.robot_wrapper import RobotWrapper
def
getModelPath
(
subpath
,
printmsg
=
False
):
def
getModelPath
(
subpath
,
printmsg
=
False
):
base
=
'../../../share/example-robot-data/robots'
paths
=
[
main_dir
=
dirname
(
dirname
(
dirname
(
__file__
)))
join
(
dirname
(
dirname
(
dirname
(
dirname
(
__file__
)))),
'robots'
),
for
path
in
[
join
(
dirname
(
main_dir
),
'robots'
),
join
(
main_dir
,
'robots'
)
join
(
dirname
(
dirname
(
dirname
(
__file__
))),
'robots'
)
]
+
[
join
(
p
,
base
.
strip
(
'/'
))
for
p
in
sys
.
path
]:
]
try
:
from
.path
import
EXAMPLE_ROBOT_DATA_MODEL_DIR
paths
.
append
(
EXAMPLE_ROBOT_DATA_MODEL_DIR
)
except
ImportError
:
pass
paths
+=
[
join
(
p
,
'../../../share/example-robot-data/robots'
)
for
p
in
sys
.
path
]
for
path
in
paths
:
if
exists
(
join
(
path
,
subpath
.
strip
(
'/'
))):
if
exists
(
join
(
path
,
subpath
.
strip
(
'/'
))):
if
printmsg
:
if
printmsg
:
print
(
"using %s as modelPath"
%
path
)
print
(
"using %s as modelPath"
%
path
)
return
path
return
path
raise
IOError
(
'%s not found'
%
(
subpath
)
)
raise
IOError
(
'%s not found'
%
subpath
)
def
readParamsFromSrdf
(
robot
,
SRDF_PATH
,
verbose
,
has_rotor_parameters
=
True
,
referencePose
=
'half_sitting'
):
def
readParamsFromSrdf
(
robot
,
SRDF_PATH
,
verbose
,
has_rotor_parameters
=
True
,
referencePose
=
'half_sitting'
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment