Skip to content

Conversation

flferretti
Copy link
Contributor

@flferretti flferretti commented May 16, 2025

There are cases in which the Python package is used quite extensively and there multiple calls to resolve some mesh URIs, e.g. https://github.com/ami-iit/jaxsim/blob/main/src/jaxsim/mujoco/loaders.py. This pull requests adds the possibility to set an environment variable in order to add custom search paths globally and it updates the README accordingly.

Examples

  • Not passing additional search paths
% resolve-robotics-uri-py package://example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl

resolve-robotics-uri-py: No file corresponding to URI 'package://example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl' found
  • Using env var with single path
% RRU_ADDITIONAL_PATHS=~/.cache/robot_descriptions resolve-robotics-uri-py package://example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl

/home/fferretti/.cache/robot_descriptions/example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl
  • Using env var with multiple paths
% RRU_ADDITIONAL_PATHS=~/.cache/robot_descriptions:~/.cache/robot_descriptions/example_model_data resolve-robotics-uri-py package://example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl

/home/fferretti/.cache/robot_descriptions/example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl
  • Using argument with multiple paths
% resolve-robotics-uri-py --package_dirs ~/.cache/robot_descriptions:~/.cache/robot_descriptions/example-robot-data package://example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl

/home/fferretti/.cache/robot_descriptions/example-robot-data/robots/ur_description/meshes/ur10/collision/shoulder.stl

Documentation Improvements:

  • Updated the installation instructions in README.md to replace mamba with conda for consistency and simplicity. (README.md, README.mdL12-R12)
  • Added a new section in README.md explaining how to specify custom search paths for the resolve-robotics-uri-py tool, including examples for both command-line usage and Python code. (README.md, README.mdL48-R82)

Code Enhancements:

  • Enhanced the resolve_robotics_uri function to support additional search paths specified via the RRU_ADDITIONAL_PATHS environment variable. This allows users to define custom directories for resolving URIs, improving flexibility. (src/resolve_robotics_uri_py/resolve_robotics_uri_py.py, src/resolve_robotics_uri_py/resolve_robotics_uri_py.pyR106-R111)

@flferretti flferretti force-pushed the additional_path_env_var branch from 176544a to 7f239eb Compare May 16, 2025 11:02
@flferretti flferretti force-pushed the additional_path_env_var branch from 7f239eb to da2c1af Compare May 16, 2025 11:23
@flferretti flferretti marked this pull request as ready for review May 16, 2025 11:37
@traversaro
Copy link
Collaborator

Just to understand, why we need yet another env variable instead of reusing of the existing env variables?

@flferretti
Copy link
Contributor Author

Just to understand, why we need yet another env variable instead of reusing of the existing env variables?

I thought it would be better to avoid using env variables from Gazebo/ROS to keep the module-specific paths separated and avoid interference

@traversaro
Copy link
Collaborator

Ack, thanks! Can you clarify this is in the docs? Because as it is written, it seems that if you have a custom directory you can't just add it to existing env variables, that would have the benefit to work with any other software that consumes URDFs. Furthermore, there is any reason why we can't just add RRU_ADDITIONAL_PATHS to SupportedEnvVars structure instead of adding a new code path?

@flferretti
Copy link
Contributor Author

Ack, thanks! Can you clarify this is in the docs? Because as it is written, it seems that if you have a custom directory you can't just add it to existing env variables, that would have the benefit to work with any other software that consumes URDFs. Furthermore, there is any reason why we can't just add RRU_ADDITIONAL_PATHS to SupportedEnvVars structure instead of adding a new code path?

You're right! Done in eee7a40, 63b9d7d and 74981ea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants