urchin icon indicating copy to clipboard operation
urchin copied to clipboard

Parse meshes specified via `package://` URIs

Open traversaro opened this issue 1 year ago • 1 comments

URDF models used in the ROS world typically contains meshes that are specified via package:// URIs, also as that is the only way to specify meshes without absolute filenames, at least according to the URDF specification.

While many libraries (including urchin) also support an undocumented URDF extensions in which meshes location specified by filename="this/is/a/path/to/a/mesh.stl" are interpreted as relative paths, "official" URDF files must use meshes specified via package.xml.

To support meshes specified via package:// URI in urchin without the need of depending on ROS libraries not available in pypi, I think we could add support for resolving package:// URIs via the https://github.com/ami-iit/resolve-robotics-uri-py, that is a no-dependency pure python library that can resolve package:// URIs, just using environment variables (like ROS_PACKAGE_PATH or AMENT_PREFIX_PATH) that ROS or most other URDF-capable libraries already define and support, see for example:

  • Pinocchio: https://github.com/stack-of-tasks/pinocchio/blob/17c479e2fe91905122713643f489feb8ddf135a3/src/parsers/urdf/geometry.cpp#L470, https://github.com/stack-of-tasks/pinocchio/blob/9389400a6018e97ec3822796d465a4b801630a1f/src/utils/file-explorer.cpp#L45
  • idyntree: https://github.com/robotology/idyntree/issues/291
  • raisim: https://github.com/leggedrobotics/raisimOgre/pull/25
  • DART: https://github.com/dartsim/dart/blob/46abc668dbbcdc58fb63e07f7d8ffb15e834da0a/dart/utils/PackageResourceRetriever.hpp
  • Drake: https://github.com/RobotLocomotion/drake/blob/4e5b1133d89c8499ed3aed0fb3905672b9bdf175/multibody/parsing/package_map.cc

traversaro avatar Dec 16 '24 16:12 traversaro

fyi @LudovicaDanovaro

traversaro avatar Dec 16 '24 16:12 traversaro