clemense / yourdfpy

Python parser for URDFs
MIT License
122 stars 13 forks source link

Path to hands of Eve R3 URDF not found #43

Open stephane-caron opened 1 year ago

stephane-caron commented 1 year ago

The path to the hand meshes of the Eve R3 URDF (one of those shown in the README) is not found:

yourdfpy /path/to/halodi-robot-models/eve_r3_description/urdf/eve_r3.urdf
...
Unable to resolve filename: package://qb_hand_description/meshes/ph_distal.obj
Can't find package://qb_hand_description/meshes/ph_distal.obj

The directory qb_hand_description is actually in the halodi-robot-models repository, so I'm not sure why yourdfpy doesn't find it.

Illustration

Mesh not loaded properly (this issue):

Mesh loaded properly (how it should be):

Further observations

halodi-robot-models
├── eve_r3_description
│   ├── meshes
│   └── urdf
├── gradle-production.properties
├── gradle.properties
├── gradle-release.properties
├── halodi-robot-models-unity-support
├── qb_hand_description
│   ├── meshes
├── robotiq_2f_85_gripper_visualization
└── robotiq_hand-e
stephane-caron commented 1 year ago

Here is the list of meshes tried out by yourdfpy (for one of the hand meshes):

[2022-09-15 11:12:26] DEBUG:yourdfpy.urdf:Checking filename: halodi-robot-models/eve_r3_description/urdf/meshes/ph_distal.obj
[2022-09-15 11:12:26] DEBUG:yourdfpy.urdf:Checking filename: qb_hand_description/meshes/ph_distal.obj
[2022-09-15 11:12:26] DEBUG:yourdfpy.urdf:Checking filename: halodi-robot-models/eve_r3_description/meshes/ph_distal.obj
[2022-09-15 11:12:26] DEBUG:yourdfpy.urdf:Checking filename: halodi-robot-models/meshes/ph_distal.obj
[2022-09-15 11:12:26] DEBUG:yourdfpy.urdf:Checking filename: meshes/ph_distal.obj
[2022-09-15 11:12:26] WARNING:yourdfpy.urdf:Unable to resolve filename: package://qb_hand_description/meshes/ph_distal.obj
[2022-09-15 11:12:26] WARNING:yourdfpy.urdf:Can't find package://qb_hand_description/meshes/ph_distal.obj

The one if doesn't and should try is `halodi-robot-models/qb_hand_description/....

stephane-caron commented 1 year ago

This issue boils down to the following: when we do recursive traversal via

_create_filename_handlers_to_urdf_file_recursive(urdf_fname=dir)

all file handlers ultimately call filename_handler_ignore_directive_package, which drops the whole suffix package://packagename/.

In this instance, the URDF would load successfully if we also tried dropping package:// only and keeping packagename as a directory name.