-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading mesh specified by package:// URIs when loading URDF models #1432
Comments
This should be done as a resource provider. |
Thanks, I built a (quick and dirty) prototype using the resource provider API, available at https://github.com/traversaro/mujoco-urdf-package-uri . I tried to build it as a project external to mujoco, so that I could use it also with existing version of MuJoCo, but unfortunately I had to modify MuJoCo itself due to the code in Lines 565 to 572 in 7c534a0
In the example, then I am able to load unmodified URDF files for Panda and iCub: At this point, probably we need to understand if you are interested in having such as resource provider inside MuJoCo itself, or if you imagine this as something that would live outside of mujoco. |
Indeed it works fine, I was just confusing between Lines 565 to 572 in 7c534a0
Actually, working on this get me a more clear understanding of the problem. I was a bit biased on my expectation on how a simulator loads URDFs by how Gazebo does that, however the MuJoCo case it is a bit different:
Given that and observing how users in my lab and around GitHub are using MuJoCo+URDF, it seems to me there are two main workflows:
As it seems to me that probably the core MuJoCo team is more familiar with Workflow1 then Workflow2, probably it could make sense for TL;DR: After working a bit on this, I am not sure I think it is really worth to have fyi @CarlottaSartore @giotherobot @siddharthdeore @diegoferigo @flferretti @akhilsathuluri @francesco-romano |
One place where I see the utility of a |
Indeed this is why I was discussing about the fact that you can't "include" a URDF in a bigger file in MuJoCo in #1432 (comment) . Without the "include" feature, I guess there is less need for automatically resolving |
That is correct. If you want to "include" a URDF into a bigger file, then it is perhaps not so useful. But what I meant, is to use raw meshes and create a URDF on the fly, for example via odio_urdf. |
We aligned in person with @akhilsathuluri on this, and we agree that this anyhow is not strictly relevant for this issue, just a general comment on the usage of URDF and |
Is your feature request related to a problem? Please describe.
A common problem we are experiencing with users using MuJoCo with iCub models (see robotology/icub-models#155 for a related issue) are related to the fact that the MuJoCo URDF parser strips any path information from the
filename
attribute of meshes. Seemujoco/src/xml/xml_urdf.cc
Lines 565 to 572 in 7c534a0
Describe the solution you'd like
Possible solutions include look for meshes specified via
package://
URIs by inspecting the values ofROS_PACKAGE_PATH
(for ROS1-style packages) orAMENT_PREFIX_PATH
(for ROS2-style packages). This can be done without any specific dependency on ROS via some dedicated code. For an example of how this is implemented in other libraries that consume URDFs like iDynTree or Pinocchio see the following snippets:For reference, a similar logic is implemented in the following minimal Python package https://github.com/ami-iit/resolve-robotics-uri-py/blob/main/src/resolve_robotics_uri_py/resolve_robotics_uri_py.py#L19-L68 . This code is not directly usable in the mujoco C++ URDF parser, but it just meant to show how the logic works.
Describe alternatives you've considered
An alternative choice done by Drake, is instead not to hardcode the lookup for any environment variable inside the library itself, but rather expose an API for users to specify the directories in which to look for files specified via
package://
URIs, see RobotLocomotion/drake-external-examples#170 for an example of this. While this may require more work on the users to actually successfully parse URDF files, that would also a way to fix the problem.Additional context
I will be happy to eventually work on this, but I would like to understand if maintainers are interested in this.
The text was updated successfully, but these errors were encountered: