clemense / yourdfpy

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

Meshes from other packages not found #13

Closed stephane-caron closed 2 years ago

stephane-caron commented 2 years ago

URDF files can load meshes from different packages. Let's take the following situation:

root/
    art/
        meshes/
            beautiful.stl
    robots/
        humanoid/
            robot.urdf

Here robot.urdf can contain a mesh tag like:

    <mesh filename="package://art/meshes/beautiful.stl" />

This should be valid, but if we go to the root/ directory and run yourdfpy robots/humanoid/robot.urdf the STL mesh won't load properly.

Why?

The filename_handler_magic is called with arguments ("package://art/meshes/beautiful.stl", "robots/humanoid").

If we unroll its execution, it currently checks for the following paths, does not find the STL file there, issues a warning and returns its first input unchanged.