Skip to content

[Bug]: USD parser fails on some assets compatible with Isaac Sim #3012

Description

@alexis779

Bug Description

Introduction

When loading LightWheel.ai Kitchen Room, 2 bugs prevent USD parser to load the scene.

Bug 1

Loading the dishwasher causes this stacktrace:

[Genesis] [23:31:42] [INFO] Adding <gs.engine.entities.RigidEntity>. idx: 0, uid: <2d1c36c>, morph: <gs.morphs.USD(file='/home/alexis/Documents/python/robotics/datasets/Lightwheel_Kitchen/Collected_KitchenRoom/Dishwasher054/Dishwasher054.usd'), prim_path='/root')>, material: <gs.materials.Rigid>.
Traceback (most recent call last):
  File "/home/alexis/Documents/python/robotics/Genesis/examples/kitchen_room.py", line 23, in <module>
    scene.add_stage(
    ~~~~~~~~~~~~~~~^
        morph=usd_morph,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 546, in add_stage
    entities.append(self.add_entity(entity_morph, material, surface, visualize_contact, vis_mode))
                    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 499, in add_entity
    entity = self._sim._add_entity(morph, material, surface, visualize_contact, name)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/simulator.py", line 166, in _add_entity
    entity = self.rigid_solver.add_entity(
        self.n_entities, material, morph, surface, visualize_contact, name=name
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/solvers/rigid/rigid_solver.py", line 302, in add_entity
    entity = EntityClass(
        scene=self._scene,
    ...<24 lines>...
        name=name,
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2366, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        scene,
        ^^^^^^
    ...<16 lines>...
        name,
        ^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 136, in __init__
    self._load_model()
    ~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2477, in _load_model
    super()._load_model()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 373, in _load_model
    self._load_morph(self._morph)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 160, in _load_morph
    self._load_scene(morph, self._surface)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2482, in _load_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = self._parse_scene(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 703, in _parse_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = parse_usd_rigid_entity(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 653, in parse_usd_rigid_entity
    joint_prims = _compute_joint_prim_paths(stage, entity_prim)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 593, in _compute_joint_prim_paths
    gs.raise_exception(
    ~~~~~~~~~~~~~~~~~~^
        f"Mixed entity detected at {entity_prim.GetPath()}: "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        "Use scene.add_stage() to handle mixed entities, or ensure all rigid bodies are connected by joints."
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 37, in raise_exception
    raise gs.GenesisException(msg)
genesis.GenesisException: Mixed entity detected at /root: has 4 joints but also has 2 rigid bodies not referenced by joints: ['/root/Dishwasher054_Door001', '/root/Dishwasher054_Button001']. Use scene.add_stage() to handle mixed entities, or ensure all rigid bodies are connected by joints.

Bug 2

Loading the bottle tap causes this stacktrace:

[Genesis] [23:33:50] [INFO] Adding <gs.engine.entities.RigidEntity>. idx: 0, uid: <3e73bd9>, morph: <gs.morphs.USD(file='/home/alexis/Documents/python/robotics/datasets/Lightwheel_Kitchen/Collected_KitchenRoom/Kitchen_Other/Kitchen_Bottle006.usd'), prim_path='/root/Kitchen_Bottle006')>, material: <gs.materials.Rigid>.
Traceback (most recent call last):
  File "/home/alexis/Documents/python/robotics/Genesis/examples/kitchen_room.py", line 23, in <module>
    scene.add_stage(
    ~~~~~~~~~~~~~~~^
        morph=usd_morph,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 546, in add_stage
    entities.append(self.add_entity(entity_morph, material, surface, visualize_contact, vis_mode))
                    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 499, in add_entity
    entity = self._sim._add_entity(morph, material, surface, visualize_contact, name)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/simulator.py", line 166, in _add_entity
    entity = self.rigid_solver.add_entity(
        self.n_entities, material, morph, surface, visualize_contact, name=name
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/solvers/rigid/rigid_solver.py", line 302, in add_entity
    entity = EntityClass(
        scene=self._scene,
    ...<24 lines>...
        name=name,
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2366, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        scene,
        ^^^^^^
    ...<16 lines>...
        name,
        ^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 136, in __init__
    self._load_model()
    ~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2477, in _load_model
    super()._load_model()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 373, in _load_model
    self._load_morph(self._morph)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 160, in _load_morph
    self._load_scene(morph, self._surface)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2482, in _load_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = self._parse_scene(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 703, in _parse_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = parse_usd_rigid_entity(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 655, in parse_usd_rigid_entity
    links_g_infos = _parse_geoms(context, entity_prim, link_path_to_idx, morph, surface)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 530, in _parse_geoms
    parse_prim_geoms(context, entity_prim, None, links_g_infos, link_path_to_idx, morph, surface)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_geometry.py", line 61, in parse_prim_geoms
    geom_Q, geom_S = context.compute_gs_transform(prim, link_prim)
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_context.py", line 182, in compute_gs_transform
    Q, S = extract_scale(self.compute_transform(prim))
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_utils.py", line 215, in extract_scale
    gs.raise_exception(f"Negative determinant of rotation matrix detected. Got {np.linalg.det(R)}.")
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 37, in raise_exception
    raise gs.GenesisException(msg)
genesis.GenesisException: Negative determinant of rotation matrix detected. Got -1.0.

[Genesis] [23:33:50] [ERROR] GenesisException: Negative determinant of rotation matrix detected. Got -1.0.

Steps to Reproduce

Checkout genesis and download the scene

git clone https://github.com/Genesis-Embodied-AI/genesis-world
mkdir datasets
cd datasets
git clone https://github.com/LightwheelAI/Lightwheel_Kitchen
cd Lightwheel_Kitchen
unzip Lightwheel_Kitchen.zip

Load the main USD file or the specific items

import genesis as gs

gs.init(backend=gs.cpu)

scene = gs.Scene(
    show_viewer=True,
    viewer_options=gs.options.ViewerOptions(
        camera_lookat=(0, 0, 0),
    ),
    profiling_options=gs.options.ProfilingOptions(
        show_FPS=False
    ),
)

usd_morph = gs.morphs.USD(
    file="../datasets/Lightwheel_Kitchen/Collected_KitchenRoom/KitchenRoom.usd",
    #file="../datasets/Lightwheel_Kitchen/Collected_KitchenRoom/Dishwasher054/Dishwasher054.usd",
    #file="../datasets/Lightwheel_Kitchen/Collected_KitchenRoom/Kitchen_Other/Kitchen_Bottle006.usd",
    fixed=True,
)

scene.add_stage(
    morph=usd_morph,
)

scene.build()

for step in range(100000):
    scene.step()

Expected Behavior

The Kitchen room USD scene should load successfully.

Screenshots/Videos

No response

Relevant log output

[Genesis] [23:31:42] [INFO] Adding <gs.engine.entities.RigidEntity>. idx: 0, uid: <2d1c36c>, morph: <gs.morphs.USD(file='/home/alexis/Documents/python/robotics/datasets/Lightwheel_Kitchen/Collected_KitchenRoom/Dishwasher054/Dishwasher054.usd'), prim_path='/root')>, material: <gs.materials.Rigid>.
Traceback (most recent call last):
  File "/home/alexis/Documents/python/robotics/Genesis/examples/kitchen_room.py", line 23, in <module>
    scene.add_stage(
    ~~~~~~~~~~~~~~~^
        morph=usd_morph,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 546, in add_stage
    entities.append(self.add_entity(entity_morph, material, surface, visualize_contact, vis_mode))
                    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 134, in wrapper
    return method(self, *args, **kwargs)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/scene.py", line 499, in add_entity
    entity = self._sim._add_entity(morph, material, surface, visualize_contact, name)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/simulator.py", line 166, in _add_entity
    entity = self.rigid_solver.add_entity(
        self.n_entities, material, morph, surface, visualize_contact, name=name
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/solvers/rigid/rigid_solver.py", line 302, in add_entity
    entity = EntityClass(
        scene=self._scene,
    ...<24 lines>...
        name=name,
    )
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2366, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        scene,
        ^^^^^^
    ...<16 lines>...
        name,
        ^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 136, in __init__
    self._load_model()
    ~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2477, in _load_model
    super()._load_model()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 373, in _load_model
    self._load_morph(self._morph)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 160, in _load_morph
    self._load_scene(morph, self._surface)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 2482, in _load_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = self._parse_scene(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/engine/entities/rigid_entity/rigid_entity.py", line 703, in _parse_scene
    l_infos, links_j_infos, links_g_infos, eqs_info = parse_usd_rigid_entity(morph, surface)
                                                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 653, in parse_usd_rigid_entity
    joint_prims = _compute_joint_prim_paths(stage, entity_prim)
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/usd/usd_rigid_entity.py", line 593, in _compute_joint_prim_paths
    gs.raise_exception(
    ~~~~~~~~~~~~~~~~~~^
        f"Mixed entity detected at {entity_prim.GetPath()}: "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        "Use scene.add_stage() to handle mixed entities, or ensure all rigid bodies are connected by joints."
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/alexis/Documents/python/robotics/Genesis/genesis/utils/misc.py", line 37, in raise_exception
    raise gs.GenesisException(msg)
genesis.GenesisException: Mixed entity detected at /root: has 4 joints but also has 2 rigid bodies not referenced by joints: ['/root/Dishwasher054_Door001', '/root/Dishwasher054_Button001']. Use scene.add_stage() to handle mixed entities, or ensure all rigid bodies are connected by joints.

Environment

  • OS: [Debian]
  • GPU/CPU [N/A]
  • GPU-driver version [N/A]
  • CUDA / CUDA-toolkit version [N/A ]

Release version or Commit ID

a1363a7

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions