Skip to content
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

mujoco parser: relative asset paths from nested xml includes #22638

Open
RussTedrake opened this issue Feb 15, 2025 · 1 comment
Open

mujoco parser: relative asset paths from nested xml includes #22638

RussTedrake opened this issue Feb 15, 2025 · 1 comment
Assignees
Labels
component: multibody parsing Loading models into MultibodyPlant type: bug

Comments

@RussTedrake
Copy link
Contributor

What happened?

The RB-Y1 model available here: https://github.com/RainbowRobotics/rby1-sdk/tree/main/models/rby1a/mujoco uses include elements to include xml files from different directories. Those included xmls declare assets, using a directory relative to their location on disk.

The relevant mujoco docs led me to believe that the include behavior was simple:

This element does not strictly belong to MJCF. Instead it is a meta-element, used to assemble multiple XML files in a single document object model (DOM) before parsing. The included file must be a valid XML file with a unique top-level element. This top-level element is removed by the parser, and the elements below it are inserted at the location of the include element. At least one element must be inserted as a result of this procedure. The include element can be used where ever an XML element is expected in the MJCF file. Nested includes are allowed, however a given XML file can be included at most once in the entire model. After all the included XML files have been assembled into a single DOM, it must correspond to a valid MJCF model.

which is what we implemented in Drake. But it appears that it's not quite true... the file location of the included file still impacts the asset parsing. We'll have to touch up the drake parser to handle this case (and perhaps upstream a documentation improvement to mujoco).

Version

No response

What operating system are you using?

No response

What installation option are you using?

No response

Relevant log output

@RussTedrake RussTedrake added component: multibody parsing Loading models into MultibodyPlant type: bug labels Feb 15, 2025
@RussTedrake RussTedrake self-assigned this Feb 15, 2025
@kbayes
Copy link

kbayes commented Feb 18, 2025

Hi Russ,

The behavior of include at one time was straightforward, but there's been multiple complaints / feature requests to have include load assets relative to the included XML. This was implemented about 10 months ago, and the documentation here needs some clarification. Thanks for pointing this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: multibody parsing Loading models into MultibodyPlant type: bug
Projects
None yet
Development

No branches or pull requests

2 participants