Adding a Manipulator Robot#
Learning Objectives#
This tutorial introduces a manipulator robot to the simulation, a Franka Panda. It describes how to add the robot to the scene and execute a pick-and-place operation. After this tutorial, you will have more experience using manipulator robots and controlling them with inverse kinematics in NVIDIA Isaac Sim.
15-20 Minute Tutorial
Getting Started#
Prerequisites
Review Hello Robot prior to beginning this tutorial.
This tutorial uses standalone Python scripts. Run them with a Python environment where Isaac Sim is installed:
Creating the Scene with a Franka Robot#
Add a Franka robot and a cube for the robot to pick up using the FrankaExperimental class.
This class inherits from Articulation and provides high-level control methods including
inverse kinematics and gripper control.
When you set create_robot=True in the constructor, FrankaExperimental automatically
spawns the Franka robot USD asset at the specified path.
1"""Create a scene with ground, Franka robot, and blue cube."""
2
3from isaacsim import SimulationApp
4
5simulation_app = SimulationApp({"headless": False})
6
7import isaacsim.core.experimental.utils.app as app_utils
8import isaacsim.core.experimental.utils.stage as stage_utils
9from isaacsim.core.experimental.materials import PreviewSurfaceMaterial
10from isaacsim.core.experimental.objects import Cube
11from isaacsim.core.experimental.prims import GeomPrim, RigidPrim
12from isaacsim.core.simulation_manager import SimulationManager
13from isaacsim.robot.manipulators.examples.franka import FrankaExperimental
14from isaacsim.storage.native import get_assets_root_path
15
16DEVICE = "cpu"
17
18assets_root_path = get_assets_root_path()
19
20# Add ground plane
21stage_utils.add_reference_to_stage(
22 usd_path=assets_root_path + "/Isaac/Environments/Grid/default_environment.usd",
23 path="/World/ground",
24)
25
26# Create the Franka robot
27robot = FrankaExperimental(robot_path="/World/robot", create_robot=True)
28
29# Create a blue cube for the robot to pick up
30visual_material = PreviewSurfaceMaterial("/World/Materials/blue")
31visual_material.set_input_values("diffuseColor", [0.0, 0.0, 1.0])
32cube_shape = Cube(
33 paths="/World/Cube",
34 positions=[0.5, 0.0, 0.0258],
35 sizes=1.0,
36 scales=[0.0515, 0.0515, 0.0515],
37)
38GeomPrim(paths=cube_shape.paths, apply_collision_apis=True)
39RigidPrim(paths=cube_shape.paths)
40cube_shape.apply_visual_materials(visual_material)
41
42SimulationManager.setup_simulation(dt=1.0 / 60.0, device=DEVICE)
43physics_scene = SimulationManager.get_physics_scenes()[0]
44physics_scene.set_enabled_gpu_dynamics(False)
45app_utils.play()
46app_utils.update_app(steps=20)
47
48while simulation_app.is_running():
49 simulation_app.update()
50
51app_utils.stop()
52simulation_app.close()
Run the script. A window opens with the Franka robot and cube in the scene; the simulation runs until you close the window.
The FrankaExperimental class provides these key methods for robot control:
set_end_effector_pose(position, orientation)- Move end-effector using inverse kinematicsopen_gripper()/close_gripper()- Control the gripperget_current_state()- Get DOF positions and end-effector poseget_downward_orientation()- Get quaternion for downward-facing orientationreset_to_default_pose()- Reset robot to home position
Using FrankaPickPlace for Complete Pick-and-Place#
For a complete pick-and-place operation, use the FrankaPickPlace class. This class has a
setup_scene() method that spawns everything needed for pick-and-place: the Franka robot,
ground plane, and a cube to manipulate.
1"""Pick-and-place using FrankaPickPlace."""
2
3from isaacsim import SimulationApp
4
5simulation_app = SimulationApp({"headless": False})
6
7import isaacsim.core.experimental.utils.app as app_utils
8import isaacsim.core.experimental.utils.stage as stage_utils
9from isaacsim.core.simulation_manager import SimulationManager
10from isaacsim.robot.manipulators.examples.franka import FrankaPickPlace
11from isaacsim.storage.native import get_assets_root_path
12
13DEVICE = "cpu"
14
15assets_root_path = get_assets_root_path()
16
17stage_utils.set_stage_up_axis("Z")
18stage_utils.set_stage_units(meters_per_unit=1.0)
19stage_utils.add_reference_to_stage(
20 usd_path=assets_root_path + "/Isaac/Environments/Grid/default_environment.usd",
21 path="/World/ground",
22)
23
24# FrankaPickPlace spawns robot and cube, and provides the pick-place state machine
25controller = FrankaPickPlace()
26controller.setup_scene()
27
28SimulationManager.setup_simulation(dt=1.0 / 60.0, device=DEVICE)
29physics_scene = SimulationManager.get_physics_scenes()[0]
30physics_scene.set_enabled_gpu_dynamics(False)
31app_utils.play()
32# Run a few steps so the articulation's physics tensor entity is valid before `controller.reset()`
33app_utils.update_app(steps=20)
34controller.reset()
35
36# Main loop: run one pick-place step each physics frame until done
37while simulation_app.is_running():
38 simulation_app.update()
39 if app_utils.is_playing():
40 if not controller.is_done():
41 controller.forward()
42 else:
43 print("Pick-and-place completed")
44 app_utils.pause()
45
46app_utils.stop()
47simulation_app.close()
Run the script. The robot automatically executes all phases of picking up and placing the cube.
Customizing the FrankaPickPlace Scene#
The setup_scene() method accepts parameters to customize the cube position, size,
and target position:
1controller = FrankaPickPlace()
2controller.setup_scene(
3 cube_initial_position=[0.4, 0.2, 0.0258], cube_size=[0.05, 0.05, 0.05], target_position=[-0.4, 0.2, 0.12]
4)
Understanding the Pick-and-Place State Machine#
The FrankaPickPlace class uses a state machine with the following phases:
Phase |
Description |
Default Steps |
|---|---|---|
0 |
Move to x,y position above cube |
60 |
1 |
Approach down to cube |
40 |
2 |
Close gripper to grasp |
20 |
3 |
Lift cube upward |
40 |
4 |
Move cube to target location |
80 |
5 |
Open gripper to release |
20 |
6 |
Move up and away |
20 |
You can customize the phase durations by passing events_dt to the constructor:
# Custom phase durations (steps for each phase)
controller = FrankaPickPlace(events_dt=[80, 60, 30, 60, 100, 30, 30])
Summary#
This tutorial covered the following topics:
Adding a Franka manipulator robot using
FrankaExperimentalwithcreate_robot=TrueUsing the
FrankaPickPlace.setup_scene()method to spawn a complete pick-and-place sceneExecuting pick-and-place operations with the
forward()methodUnderstanding and customizing the pick-and-place state machine phases
Next Steps#
Continue to the next tutorial in our Essential Tutorials series, Adding Multiple Robots, to learn how to add multiple robots to the simulation.