Adding multiple robots in a scene

Good day. I have a USD file of a robot.

I wonder how I can add multiple robots to a scene programmatically. Given the adding must be performed by coding, not adding the robot through GUI.
Something like the spawn function.

The problem setting is actually similar to this post. But I could not get the answer.

Thank you.

You can use something like this:

from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.manipulators import SingleManipulator

add_reference_to_stage(usd_path=path_to_robot, prim_path="/World/robot1")
add_reference_to_stage(usd_path=path_to_robot, prim_path="/World/robot2")
add_reference_to_stage(usd_path=path_to_robot, prim_path="/World/robot3")

robot1 = world.scene.add(SingleManipulator(prim_path="/World/robot1", name="robot1", end_effector_prim_name="robot_end_effector", position=[0.,0.,0.]))
robot2 = world.scene.add(SingleManipulator(prim_path="/World/robot2", name="robot2", end_effector_prim_name="robot_end_effector", position=[1.,0.,0.]))
robot3 = world.scene.add(SingleManipulator(prim_path="/World/robot3", name="robot3", end_effector_prim_name="robot_end_effector", position=[-1.,0.,0.]))

If you want to make your own class for your robot, e.g. look into how the classes: UR10 and WheeledRobot are made.
from omni.isaac.universal_robots import UR10
from omni.isaac.wheeled_robots.robots import WheeledRobot

Otherwise check this:

Thank you so much.

So, can I understand it like this:
unless I make the class of my robot, I will have to work on my USD file to spawn my robot using GUI one by one?

Thank you.

You dont need a class to spawn the robots.

The robot class makes it easier to control your robot through python.

Referring to your solution, the “path_to_robot” USD file need to have three robots for the code to work.

What I wanted to do is, I only have a USD file containing one robot. And, I want to spawn more than one robot in the script.

Thank you.

No you don’t need three robots in the same USD file. “path_to_robot” is the path to your USD file containing your single robot.
Here is an example of how to spawn 3 robots of the same type with one USD file of a single robot.

from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"headless": False})
from omni.isaac.core import World
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.prims import XFormPrim
import carb

my_world = World(stage_units_in_meters=1.0)

assets_root_path = get_assets_root_path()
if assets_root_path is None:
    carb.log_error("Could not find Isaac Sim assets folder")
usd_path = assets_root_path + "/Isaac/Robots/UR10/ur10.usd"

my_world.scene.add(XFormPrim(prim_path="/World/robot1", name="robot1", position=[0,0,0],orientation=[0.7071068,0, 0,0.7071068]))
my_world.scene.add(XFormPrim(prim_path="/World/robot2", name="robot2", position=[-1,0,0],orientation=[0.7071068,0, 0,0.7071068]))
my_world.scene.add(XFormPrim(prim_path="/World/robot3", name="robot3", position=[1,0,0],orientation=[0.7071068,0, 0,0.7071068]))


while simulation_app.is_running():
    if my_world.is_playing():
        if my_world.current_time_step_index == 0:


This is the result:

“/Isaac/Robots/UR10/ur10.usd” is just an USD file containing a single UR10 robot.

I see. I didn’t make the robot as default prim, which is why I could not make it work.
Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.