IsaacLab icon indicating copy to clipboard operation
IsaacLab copied to clipboard

[Bug Report] XML to USD possible load bug

Open giulioturrisi opened this issue 9 months ago • 2 comments

Describe the bug

I'm trying to convert the following XML (https://github.com/iit-DLSLab/gym-quadruped/blob/master/gym_quadruped/robot_model/hyqreal/hyqreal.xml) in USD. With previous IsaacLab version, i was able to convert different model inside the same repo, but now, i obtain the following structure

Image

(see hyqreal->base->base) whereas with the old IsaacLab version i was able to convert the model in a structure like this (see base->base directly):

Image

Due to this difference, I think I cannot load correctly the usd in IsaacLab, since i obtain the following error now:

AttributeError: 'Articulation' object has no attribute '_root_physx_view'

I think this is the same error i see here: https://forums.developer.nvidia.com/t/error-please-ensure-that-there-is-only-one-articulation-in-the-prim-path-tree/311183

System Info

  • Commit: c4bec8f and i tried even the last one 8f7f2b8

Thanks

giulioturrisi avatar Mar 25 '25 14:03 giulioturrisi

Thank you for posting this. The team will investigate.

RandomOakForest avatar Apr 01 '25 14:04 RandomOakForest

deleting worldBody from the USD fixes the error you're seeing (no attribute _root_physx_view) @giulioturrisi . it happens because the USD has multiple root prims (also discussed here)

However I'm having issues loading multiple assets where only one responds to joint pose changes (the video is randomizing it). Is this issue related @RandomOakForest ?

https://github.com/user-attachments/assets/a4d57f5c-08b0-4839-8295-c6260c5eaa1f

yash-s20 avatar Apr 12 '25 01:04 yash-s20

Hi @RandomOakForest, I have the same issue as @giulioturrisi. And I wonder if that's why I have a problem with prim paths for sensors :

Traceback (most recent call last):
  File "/home/louislelay/Documents/pal_isaaclab/scripts/zero_agent.py", line 70, in <module>
    main()
  File "/home/louislelay/Documents/pal_isaaclab/scripts/zero_agent.py", line 48, in main
    env = gym.make(args_cli.task, cfg=env_cfg)
  File "/home/louislelay/miniconda3/envs/env_isaaclab/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 742, in make
    env = env_creator(**env_spec_kwargs)
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/envs/manager_based_rl_env.py", line 82, in __init__
    super().__init__(cfg=cfg)
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/envs/manager_based_env.py", line 157, in __init__
    self.sim.reset()
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/sim/simulation_context.py", line 536, in reset
    self.render()
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/sim/simulation_context.py", line 591, in render
    raise exception_to_raise
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/sensors/sensor_base.py", line 271, in _initialize_callback
    self._initialize_impl()
  File "/home/louislelay/Documents/IsaacLab/source/isaaclab/isaaclab/sensors/contact_sensor/contact_sensor.py", line 266, in _initialize_impl
    raise RuntimeError(
RuntimeError: Sensor at path '/World/envs/env_.*/Robot/.*' could not find any bodies with contact reporter API.
HINT: Make sure to enable 'activate_contact_sensors' in the corresponding asset spawn configuration.

I should mention that I've removed (deactivated) worldBody and although that solved a few errors, I still have this problem. And of course, activate_contact_sensors is already set to true.

louislelay avatar Jul 03 '25 08:07 louislelay

Thank you for following up. We'll review and aim to resolve this soon.

RandomOakForest avatar Jul 03 '25 11:07 RandomOakForest

xml to usd is currently a bit buggy, and urdf importer seems a lot more stabler, if it is possible, can you try to use urdf importer with isaaclab 2.1 + isaacsim 4.5 and see if it works?

ooctipus avatar Jul 10 '25 20:07 ooctipus

Hey @ooctipus, the URDF importer works perfectly but for a robot model we want to use, we only have a MJCF model. While we're currently working on converting it to URDF, the model is complicated and the conversion will take time. That's why we wanted to use the MJCF importer.

From what I've tested it seems to come from the MJCF importer extension of Isaac Sim, so I believe this issue could be closed here and a new one opened on the OSS repo (issue is still persisting in Isaac Sim 5.0.0).

louislelay avatar Jul 10 '25 20:07 louislelay

Hey @giulioturrisi, @yash-s20, and @ooctipus, I’ve just submitted a PR to the Isaac Sim MJCF importer extension that fixes this issue. Feel free to take a look and give it a try!

louislelay avatar Jul 11 '25 02:07 louislelay

Great! I cannot find the link of the PR. Can you share it?

giulioturrisi avatar Jul 11 '25 06:07 giulioturrisi

It appears in the conversation just before my last comment, but here's the link anyway: https://github.com/isaac-sim/mjcf-importer-extension/pull/9

louislelay avatar Jul 11 '25 06:07 louislelay

Thank you @louislelay this is great!!, let me take a look : D

ooctipus avatar Jul 11 '25 07:07 ooctipus

Unfortunately i cannot validate it, due to a build error of the mjcf-importer on ubuntu. Hopefully the others can do it.

giulioturrisi avatar Jul 14 '25 08:07 giulioturrisi

Hey @giulioturrisi! Could you try to build the MJCF importer with the main branch ? Just to see if it's an error that's happening only with my fix or not. And if not, please open an issue about it on the MJCF importer repo so I or others can try to look into it!

louislelay avatar Jul 14 '25 08:07 louislelay

The error happens in the main branch as well. I will open an issue there!

EDIT: Issue here https://github.com/isaac-sim/mjcf-importer-extension/issues/10

giulioturrisi avatar Jul 14 '25 08:07 giulioturrisi

Hey @giulioturrisi, @yash-s20, and @ooctipus, I’ve just submitted a PR to the Isaac Sim MJCF importer extension that fixes this issue. Feel free to take a look and give it a try!

Hi, I used this tool and it remove the worldBody. But the problem @yash-s20 mentioned is still remained. Are there any idea to solve this problem?

Kenjiro-Minamikawa avatar Jul 15 '25 08:07 Kenjiro-Minamikawa

I found a workaround to this issue. I created my own version of the convert_mjcf.py script (see original), which removes the worldBody prim by deactivating it, flattening the USD, and then saving it.

You can see my version, here: https://github.com/jgillick/spider-bot/blob/2e49caa61fe957c0da25108770f72782b0a2b8f9/simulate/issac/mjcf_2_usd.py

I called it mjcf_2_usd.py and run it similarly to the original convert_mjcf script:

./isaaclab.sh -p ./scripts/tools/mjcf_2_usd.py <mujoco XML> <output USD>

jgillick avatar Jul 15 '25 09:07 jgillick

UPDATE: this comment is no longer accurate. The problem I'm describing was an issue with my model.

I've also noticed that when exporting from mujoco, the joints do not move -- even when following the official example instructions with an the recommended H1 mujoco model. From what I can tell, it's because the USD schema APIs are not setup correctly. They are using the PhysicsDriveAPI:X schema and attributes when they should be using PhysicsDriveAPI:angular (note :X and :angular).

I've made a post-export workaround in this script.

jgillick avatar Jul 19 '25 23:07 jgillick

@jgillick Thank you for providing the help! This bug should be fixed in the future release with update in IsaacSim:))

ooctipus avatar Jul 30 '25 17:07 ooctipus

Hi @ooctipus, if the bugs are going to be fixed in a future version of Isaac Sim does my PR to the MJCF importer extension still make sense ?

louislelay avatar Jul 30 '25 23:07 louislelay

FYI, my comment seems to be wrong. My joints weren't moving because of another issue with my model. My original workaround is still valid, though.

jgillick avatar Aug 06 '25 21:08 jgillick

Hello @ooctipus, i still have the problem describe in the first post here with IsaacLab v2.2.0 and IsaacSim5.0

Note that i can manage to rework the xml at my need only if i proceed importing the XML from IsaacSim graphic exporter

Image

setting "Set as Deafult Primt" to False

giulioturrisi avatar Aug 09 '25 16:08 giulioturrisi

@giulioturrisi Interesting, thank you for looking into issue and try out different solutions. can you describe in detail exactly what you need to rework in your xml in order to get is work? if you have the file that can share, maybe we can pass that to the sim team and make sure that gets fixed

ooctipus avatar Aug 10 '25 00:08 ooctipus

Error from my side, the importer with Set as Default Prim to false, can make the object in the hierarchy movable but generate some problem, e.g.

Image

Btw, for me the problem (as in the initial post) is the following: Looking at the USD inside IsaacSim, we have a structure like

  • B2
    • base
    • hip
    • ....
Image

But using the import (on any of the mujoco menagerie robot, e.g. https://github.com/google-deepmind/mujoco_menagerie/blob/main/unitree_a1/a1.xml), we have,

  • A1
    • trunk
      • trunk
      • hip
Image

where there is an "extra layer" trunk (that is called base in the example of B2) that cannot be moved, and to be honest i don't get why this is generated looking at the xml of the robot.

giulioturrisi avatar Aug 11 '25 07:08 giulioturrisi

Hello, i was able to load an xml by a mix of mujoco newton converter and manual procedure. The last is basically saving the .usda that mujoco newton converter create as flattened, and then moving manually the hierchachy using isaacsim.

I believe this could be made into a script, I can share more info if interested @ooctipus . My old policy works on the new asset.

giulioturrisi avatar Sep 09 '25 21:09 giulioturrisi