Skip to content

[Bug Report] RigidObjectCollection double counting of object names #4258

@tkgaolol

Description

@tkgaolol

Describe the bug

RigidObjectCollection experiences double counting of object names when simulation resets multiple times.

The _object_names_list in RigidObjectCollection accumulates duplicate entries when _initialize_impl() is called multiple times during simulation resets, particularly when using record_demos.py which performs both env.sim.reset() and env.reset() sequentially.

Bug locations:

  • scripts/tools/record_demos.py:447 - env.sim.reset()
  • source/isaaclab/isaaclab/envs/manager_based_env.py:171 - self.sim.reset()

Steps to reproduce

  1. Use a RigidObjectCollection in an environment (e.g., Isaac-Stack-Cube-Instance-Randomize-Franka-IK-Rel-v0)
  2. Run the record_demos.py script which triggers multiple simulation resets:
Traceback (most recent call last):
  File "$USER/IsaacLab/scripts/tools/record_demos.py", line 559, in <module>
    main()
  File "$USER/IsaacLab/scripts/tools/record_demos.py", line 549, in main
    current_recorded_demo_count = run_simulation_loop(env, None, success_term, rate_limiter)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$USER/IsaacLab/scripts/tools/record_demos.py", line 447, in run_simulation_loop
    env.sim.reset()
  File "$USER/IsaacLab/source/isaaclab/isaaclab/sim/simulation_context.py", line 522, in reset
    self.render()
  File "$USER/IsaacLab/source/isaaclab/isaaclab/sim/simulation_context.py", line 585, in render
    raise exception_to_raise
  File "$USER/IsaacLab/source/isaaclab/isaaclab/assets/asset_base.py", line 317, in _initialize_callback
    self._initialize_impl()
  File "$USER/IsaacLab/source/isaaclab/isaaclab/assets/rigid_object_collection/rigid_object_collection.py", line 662, in _initialize_impl
    self._create_buffers()
  File "$USER/IsaacLab/source/isaaclab/isaaclab/assets/rigid_object_collection/rigid_object_collection.py", line 684, in _create_buffers
    self._data.default_mass = self.reshape_view_to_data(self.root_physx_view.get_masses().clone())
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$USER/IsaacLab/source/isaaclab/isaaclab/assets/rigid_object_collection/rigid_object_collection.py", line 576, in reshape_view_to_data
    return torch.einsum("ijk -> jik", data.reshape(self.num_objects, self.num_instances, -1))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: shape '[4, 0, -1]' is invalid for input of size 2

System Info

  • Commit: [Current IsaacLab version]
  • Isaac Sim Version: [5.1]
  • OS: Linux (Ubuntu 22.04)
  • GPU: NVIDIA GeForce RTX 4090 D
  • CUDA: [12.8]
  • GPU Driver: 570.133.20

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions