You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RobotHandDatasetSAPIENViewer raises an exception when the only the *_glb.urdf is available for the selected robot.
Steps to reproduce
Setup the code as described in the readme
Follow the steps in the position retargeting readme to setup the dexycb dataset
Run the position retargeting script with panda as the target robot - for this specific robot, only the *_glb.urdf file is available in the assets folder, whereas for the others there are two versions, *.urdf and *_glb.urdf:
python example/position_retargeting/visualize_hand_object.py --dexycb-dir=/path/to/dexycp/root --robots panda
Error
Mimic joint adaptor enabled. The mimic joint tags in the URDF will be considered during retargeting.
To disable mimic joint adaptor, consider setting ignore_mimic_joint=True in the configuration.
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
cli.main()
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/giuliano/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/giuliano/dev/h2r/dex-retargeting/example/position_retargeting/visualize_hand_object.py", line 64, in <module>
tyro.cli(main)
File "/home/giuliano/.virtualenvs/dex-retargeting/lib/python3.10/site-packages/tyro/_cli.py", line 229, in cli
return run_with_args_from_cli()
File "/home/giuliano/dev/h2r/dex-retargeting/example/position_retargeting/visualize_hand_object.py", line 60, in main
viz_hand_object(robots, data_root, fps)
File "/home/giuliano/dev/h2r/dex-retargeting/example/position_retargeting/visualize_hand_object.py", line 28, in viz_hand_object
viewer = RobotHandDatasetSAPIENViewer(list(robots), HandType.right, headless=False)
File "/home/giuliano/dev/h2r/dex-retargeting/example/position_retargeting/hand_robot_viewer.py", line 69, in __init__
urdf_name = urdf_path.split("/")[-1]
AttributeError: 'PosixPath' object has no attribute 'split'
Cause and suggested fix
The issue is caused by this section in hand_robot_viewer.py i.e. when the path already contains the string "glb" it is not converted to a string which causes the call to split to fail. This can be fixed e.g. like this:
diff --git a/example/position_retargeting/hand_robot_viewer.py b/example/position_retargeting/hand_robot_viewer.py
index ecd1639..bb5dc71 100644
--- a/example/position_retargeting/hand_robot_viewer.py+++ b/example/position_retargeting/hand_robot_viewer.py@@ -65,6 +65,8 @@ class RobotHandDatasetSAPIENViewer(HandDatasetSAPIENViewer):
urdf_path = Path(config.urdf_path)
if "glb" not in urdf_path.stem:
urdf_path = str(urdf_path).replace(".urdf", "_glb.urdf")
+ else:+ urdf_path = str(urdf_path)
robot_urdf = urdf.URDF.load(str(urdf_path), add_dummy_free_joints=True, build_scene_graph=False)
urdf_name = urdf_path.split("/")[-1]
temp_dir = tempfile.mkdtemp(prefix="dex_retargeting-")
The text was updated successfully, but these errors were encountered:
Thanks for pointing out this bug and thank you so much for the proposed fix. I was wondering whether you would like to create a pull request from your forked repo to this repo and I can perform the merge request from your PR.
Thanks for pointing out this bug and thank you so much for the proposed fix. I was wondering whether you would like to create a pull request from your forked repo to this repo and I can perform the merge request from your PR.
Thank you!
no problem, happy to help - and thank you for releasing this package, I think it will save me a fair bit of time :)
here you go: #40
RobotHandDatasetSAPIENViewer
raises an exception when the only the*_glb.urdf
is available for the selected robot.Steps to reproduce
panda
as the target robot - for this specific robot, only the*_glb.urdf
file is available in the assets folder, whereas for the others there are two versions,*.urdf
and*_glb.urdf
:Error
Cause and suggested fix
The issue is caused by this section in
hand_robot_viewer.py
i.e. when the path already contains the string "glb" it is not converted to a string which causes the call tosplit
to fail. This can be fixed e.g. like this:The text was updated successfully, but these errors were encountered: