petercorke/robotics-toolbox-python

Incomplete handling of mesh filenames in URDF parsing

Opened this issue · 0 comments

Paths for mesh filenames in URDF are commonly prefixed with either "package://" or "file://" however urdf.py only handles the former:

def filename(self, value):
global _base_path
if value.startswith("package://"):
value = value.replace("package://", "")
if _base_path is None:
value = rtb_path_to_datafile("xacro", value)
else:
value = _base_path / PurePosixPath(value)
self._filename = str(value)

This results in filenames with the second prefix, e.g:

<mesh filename="file:///opt/ros/humble/share/kortex_description/arms/gen3/7dof/meshes/base_link.STL"/>

To be passed directly to rtb_path_to_datafile without sanitising, which results in the file not being found. This should be simple to fix by adding a check for the file:// prefix alongside the existing package:// one