I want to create a script node that generates multiple falling objects on a conveyor. For instance, as a simulation starts running one box should be dropped from a certain height on a conveyor or ground for that matter and after a certain time period/delay another box need to be dropped from the same position. I am somehow not able simulate this action. I have tried numerous for looping attempts but it fails at saying “Cannot add object to the scene since its name is not unique”. Can anyone please share a sample working script node code.
Below are the system specifications:
Isaac Sim 2022.2.0 and Isaac Sim 2022.2.1 (tested on both)
Ubuntu - 20.04
CPU - Intel Core i7
Cores - 24
RAM - 32 GB
GeForce RTX 3060-Ti
VRAM - 16GB
Disk - 2TB SSD
1 Like
Good question. I’d like to implement the exact same functionality.
Hi @deveshkumar21398 - The error message you’re seeing is because you’re trying to add multiple objects with the same name to the scene. Each object in the scene must have a unique name.
You can solve this by generating a unique name for each object. Here’s a simple example of how you can do this:
from omni.isaac.dynamic_control import _dynamic_control
from omni.physx import _physx
dc = _dynamic_control.acquire_dynamic_control_interface()
physx = _physx.acquire_physx_interface()
Create a box every second
for i in range(10):
# Generate a unique name for the box
box_name = f"box_{i}"
# Create the box
box = dc.create_rigid_body(box_name, "box", "/path/to/box/mesh.usd", _dynamic_control.RigidBodyType.DYNAMIC)
# Set the initial position of the box
box.set_world_pose(_dynamic_control.Transform([[0, 0, 0], [0, 0, i * 10]]))
# Add the box to the scene
dc.add_articulation(box)
# Wait for a second
time.sleep(1)
This script will create 10 boxes, each with a unique name, and drop them from increasing heights every second. You can adjust the parameters to fit your specific use case.
dc.create_rigid_body raises an exception, telling that create_rigid_body is not defined.