Skip to content

12 · Arm control with MoveIt 2

⏱ 40 min · Level: intermediate · Script: isaac/12_moveit.py · ROS: lime_isaac_moveit

Goal. Plan and execute arm motions for the Lime with MoveIt 2, and open and close the gripper. ros2_control talks to Isaac Sim over two topics, exactly as it would talk to the real robot's hardware driver.

MoveIt plans a motion from the folded home pose to a reaching pose and opens the gripper. Executed by ros2_control, simulated by Isaac Sim.

Concepts

flowchart LR
  subgraph ISAAC["Isaac Sim (isaac/12_moveit.py)"]
    rjs[Isaac Read Joint State] --> pjs[ROS2 Publish Joint State]
    sjs[ROS2 Subscribe Joint State] --> ac[Articulation Controller]
  end
  subgraph ROS["ROS 2 container (lime_isaac_moveit)"]
    hw[ros2_control hardware:<br/>JointStateTopicSystem]
    jtc[arm_controller<br/>JointTrajectoryController]
    grip[gripper_controller<br/>GripperActionController]
    jsb[joint_state_broadcaster]
    mg[move_group<br/>MoveIt 2]
    rsp[robot_state_publisher]
  end
  pjs -- "/isaac_joint_states" --> hw
  hw -- "/isaac_joint_commands" --> sjs
  mg -- "FollowJointTrajectory" --> jtc --> hw
  mg -- "GripperCommand" --> grip --> hw
  hw --> jsb -- "/joint_states" --> rsp & mg
  • ros2_control is the standard ROS 2 layer between controllers and hardware. On the real Lime the hardware component talks to the Dynamixel servos. Here it is joint_state_topic_hardware_interface/JointStateTopicSystem: it reads joint states from a topic and writes joint commands to another topic. Isaac Sim is on the other side of those topics.
  • MoveIt 2 (move_group) plans collision-free trajectories with OMPL and sends them to arm_controller. Gripper goals go to gripper_controller.
  • One owner per topic. From this tutorial on, Isaac Sim publishes /isaac_joint_states, and only joint_state_broadcaster publishes /joint_states. In tutorial 07 Isaac Sim published /joint_states directly, because there was no ros2_control yet.

Isaac Sim side

Open your stage from tutorial 07, my_stages/07_odom_tf.usd. Then:

  1. In the tutorial 07 graph, change ROS2 Publish Joint State ▸ topicName to /isaac_joint_states.
  2. New Action Graph with: On Playback Tick → ROS2 Subscribe Joint State (topicName /isaac_joint_commands) → Articulation Controller (targetPrim = …/base_link). Connect execOut → execIn, jointNames → jointNames, and the positionCommand, velocityCommand and effortCommand outputs to the same-named inputs.
  3. Press Play.

The ROS2_JointCommands graph

source scripts/isaac_env.sh
python isaac/12_moveit.py
graphs.create_odom_tf_joint_states_graph(articulation_root, joint_states_topic="/isaac_joint_states")
graphs.create_joint_command_graph(articulation_root)   # /isaac_joint_commands -> Articulation Controller
create_joint_command_graph() in isaac/common/graphs.py
def create_joint_command_graph(
    articulation_root: str,
    graph_path: str = "/World/ROS2_JointCommands",
    topic: str = "/isaac_joint_commands",
):
    """Tutorial 12: apply sensor_msgs/JointState commands (from ros2_control) to the robot's joints."""
    import usdrt.Sdf

    og = _og()
    keys = og.Controller.Keys
    og.Controller.edit(
        {"graph_path": graph_path, "evaluator_name": "execution"},
        {
            keys.CREATE_NODES: [
                ("OnPlaybackTick", "omni.graph.action.OnPlaybackTick"),
                ("SubscribeJointState", "isaacsim.ros2.bridge.ROS2SubscribeJointState"),
                ("ArticulationController", "isaacsim.core.nodes.IsaacArticulationController"),
            ],
            keys.SET_VALUES: [
                ("SubscribeJointState.inputs:topicName", topic),
                ("ArticulationController.inputs:targetPrim", [usdrt.Sdf.Path(articulation_root)]),
            ],
            keys.CONNECT: [
                ("OnPlaybackTick.outputs:tick", "SubscribeJointState.inputs:execIn"),
                ("SubscribeJointState.outputs:execOut", "ArticulationController.inputs:execIn"),
                # The message says which joints it commands; pass the names through.
                ("SubscribeJointState.outputs:jointNames", "ArticulationController.inputs:jointNames"),
                ("SubscribeJointState.outputs:positionCommand", "ArticulationController.inputs:positionCommand"),
                ("SubscribeJointState.outputs:velocityCommand", "ArticulationController.inputs:velocityCommand"),
                ("SubscribeJointState.outputs:effortCommand", "ArticulationController.inputs:effortCommand"),
            ],
        },
    )
Full script: isaac/12_moveit.py
# SPDX-FileCopyrightText: 2026 An (an-robotics)
# SPDX-License-Identifier: Apache-2.0

"""Tutorial 12 - Control the TurtleBot3 Lime arm with MoveIt 2 (ros2_control over topics).

    source scripts/isaac_env.sh
    python isaac/12_moveit.py

    # ROS 2 container: ros2_control + MoveIt 2 + RViz (MotionPlanning panel)
    ./docker/run_ros.sh ros2 launch lime_isaac_moveit moveit.launch.py
    # or plan + execute from Python
    ./docker/run_ros.sh ros2 run lime_isaac_moveit arm_demo

How Isaac Sim and ros2_control are connected:

    Isaac Sim                                         ROS 2 (container)
    Isaac Read Joint State -> ROS2 Publish Joint State ---- /isaac_joint_states ---->  JointStateTopicSystem
    Articulation Controller <- ROS2 Subscribe Joint State <- /isaac_joint_commands ---  (ros2_control hardware)
                                                                                         |-- arm_controller (JointTrajectoryController) <- MoveIt
                                                                                         |-- gripper_controller (GripperActionController) <- MoveIt
                                                                                         '-- joint_state_broadcaster -> /joint_states
"""

import sys

from common.cli import parse_args

args = parse_args(__doc__.splitlines()[0])

from isaacsim import SimulationApp

simulation_app = SimulationApp({"headless": args.headless, "width": 1280, "height": 720})

import isaacsim.core.experimental.utils.app as app_utils
import isaacsim.core.experimental.utils.stage as stage_utils
import numpy as np
from common import graphs, lime
from isaacsim.core.experimental.objects import GroundPlane
from isaacsim.core.experimental.prims import Articulation
from isaacsim.core.simulation_manager import SimulationManager
from pxr import UsdLux

graphs.enable_ros2_realtime(simulation_app)

stage = stage_utils.create_new_stage(template="sunlight")
UsdLux.DomeLight.Define(stage, "/World/DomeLight").GetIntensityAttr().Set(500.0)
GroundPlane("/World/GroundPlane")
articulation_root = lime.add_lime("/World/turtlebot3_lime")

graphs.create_clock_graph()
graphs.create_drive_graph(articulation_root)
# Joint states now go to /isaac_joint_states: ros2_control reads them there, and its
# joint_state_broadcaster becomes the ONE publisher of /joint_states.
graphs.create_odom_tf_joint_states_graph(articulation_root, joint_states_topic="/isaac_joint_states")
graphs.create_joint_command_graph(articulation_root)  # NEW: /isaac_joint_commands -> arm + gripper

recorder = None
if args.record:
    from common.recorder import Recorder

    recorder = Recorder(args.record, eye=(0.75, -0.75, 0.6), target=(0.0, 0.0, 0.3), every_n=2, fps=30)

SimulationManager.setup_simulation(dt=1.0 / 60.0)
app_utils.play()
simulation_app.update()
robot = Articulation(articulation_root)
arm_idx = robot.get_dof_indices(lime.ARM_JOINTS)
grip_idx = robot.get_dof_indices([lime.GRIPPER_JOINT])
print("[12] ready: /isaac_joint_states published, /isaac_joint_commands subscribed", flush=True)

# The pose that lime_isaac_moveit's arm_demo plans to (see ros2_ws/src/lime_isaac_moveit/scripts/arm_demo.py)
DEMO_TARGET = np.array([0.0, -0.6, 0.3, 0.0, 1.2, 0.0])
steps, reached_at = 0, None
while simulation_app.is_running():
    simulation_app.update()
    steps += 1
    if recorder and steps % 2 == 0:
        recorder.capture()
    if args.test or args.record:
        q = robot.get_dof_positions(dof_indices=arm_idx).numpy()[0]
        g = float(robot.get_dof_positions(dof_indices=grip_idx).numpy()[0, 0])
        if reached_at is None and np.max(np.abs(q - DEMO_TARGET)) < 0.05 and g > 0.015:
            reached_at = steps
            print(f"[12] arm reached the demo pose (max error {np.max(np.abs(q - DEMO_TARGET)):.3f} rad), gripper open {g:.4f} m", flush=True)
        if reached_at is not None and steps - reached_at > 90:
            break
        if steps > 240 * 60:  # give up after 4 minutes
            break

ok = True
if args.test:
    ok = reached_at is not None
    print(f"[12][test] MoveIt plan executed in Isaac Sim: {'PASS' if ok else 'FAIL'}")
if recorder:
    recorder.save()
app_utils.stop()
simulation_app.close(exit_code=0 if ok else 1)
sys.exit(0 if ok else 1)

ROS side: plan in RViz

./scripts/build_ws.sh                      # once, if you have not built the workspace yet
./docker/run_ros.sh ros2 launch lime_isaac_moveit moveit.launch.py

In RViz's MotionPlanning panel: Planning Group arm, drag the interactive marker (or choose a Goal State such as home), then click Plan & Execute. Watch the arm move in Isaac Sim.

MoveIt 2 MotionPlanning in RViz

ROS side: plan from Python

lime_isaac_moveit/scripts/arm_demo.py sends a joint goal to MoveIt's /move_action (moveit_msgs/action/MoveGroup, plan and execute), then a control_msgs/action/GripperCommand:

./docker/run_ros.sh ros2 run lime_isaac_moveit arm_demo                         # reach forward, open
./docker/run_ros.sh ros2 run lime_isaac_moveit arm_demo --pose home --gripper close
[lime_arm_demo]: arm -> [0.0, -0.6, 0.3, 0.0, 1.2, 0.0]: SUCCESS
[lime_arm_demo]: gripper -> 0.019 m: reached=True stalled=False at 0.0174
arm_demo.py
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2026 An (an-robotics)
# SPDX-License-Identifier: Apache-2.0

"""Plan + execute arm motions with MoveIt 2 and open/close the gripper (tutorial 12).

    ros2 run lime_isaac_moveit arm_demo                  # demo pose, open gripper
    ros2 run lime_isaac_moveit arm_demo --pose home --gripper close

It talks to two ROS 2 actions:
  /move_action                       moveit_msgs/action/MoveGroup    (move_group: plan + execute)
  /gripper_controller/gripper_cmd    control_msgs/action/GripperCommand
"""

import argparse
import sys

import rclpy
from control_msgs.action import GripperCommand
from moveit_msgs.action import MoveGroup
from moveit_msgs.msg import Constraints, JointConstraint, MoveItErrorCodes
from rclpy.action import ActionClient

ARM_JOINTS = [f"joint{i}" for i in range(1, 7)]
POSES = {  # radians
    "home": [0.0, -1.10, 1.80, 0.0, 0.98, 0.0],  # folded (SRDF "home")
    "demo": [0.0, -0.6, 0.3, 0.0, 1.2, 0.0],  # reach forward, gripper pointing down/forward
    "left": [1.2, -0.6, 0.3, 0.0, 1.2, 0.0],
}
GRIPPER = {"open": 0.019, "close": -0.010}


def wait_result(node, future):
    rclpy.spin_until_future_complete(node, future)
    return future.result()


def move_arm(node, client, joints):
    goal = MoveGroup.Goal()
    req = goal.request
    req.group_name = "arm"
    req.num_planning_attempts = 5
    req.allowed_planning_time = 5.0
    req.max_velocity_scaling_factor = 0.5
    req.max_acceleration_scaling_factor = 0.5
    req.goal_constraints = [
        Constraints(
            joint_constraints=[
                JointConstraint(joint_name=n, position=p, tolerance_above=0.01, tolerance_below=0.01, weight=1.0)
                for n, p in zip(ARM_JOINTS, joints)
            ]
        )
    ]
    goal.planning_options.plan_only = False  # plan AND execute
    handle = wait_result(node, client.send_goal_async(goal))
    if not handle.accepted:
        node.get_logger().error("MoveGroup goal rejected")
        return False
    result = wait_result(node, handle.get_result_async()).result
    ok = result.error_code.val == MoveItErrorCodes.SUCCESS
    node.get_logger().info(f"arm -> {joints}: {'SUCCESS' if ok else f'error code {result.error_code.val}'}")
    return ok


def move_gripper(node, client, position):
    goal = GripperCommand.Goal()
    goal.command.position = position
    goal.command.max_effort = 5.0
    handle = wait_result(node, client.send_goal_async(goal))
    if not handle.accepted:
        node.get_logger().error("gripper goal rejected")
        return False
    result = wait_result(node, handle.get_result_async()).result
    node.get_logger().info(f"gripper -> {position:.3f} m: reached={result.reached_goal} stalled={result.stalled} at {result.position:.4f}")
    return result.reached_goal or result.stalled


def main():
    parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    parser.add_argument("--pose", choices=POSES, default="demo")
    parser.add_argument("--gripper", choices=GRIPPER, default="open")
    args, ros_args = parser.parse_known_args()

    rclpy.init(args=ros_args)
    node = rclpy.create_node("lime_arm_demo", parameter_overrides=[])
    node.set_parameters([rclpy.parameter.Parameter("use_sim_time", rclpy.Parameter.Type.BOOL, True)])
    arm = ActionClient(node, MoveGroup, "/move_action")
    gripper = ActionClient(node, GripperCommand, "/gripper_controller/gripper_cmd")
    for name, client in [("move_group", arm), ("gripper_controller", gripper)]:
        if not client.wait_for_server(timeout_sec=60.0):
            node.get_logger().error(f"{name} action server not available - is moveit.launch.py running?")
            sys.exit(1)

    ok = move_arm(node, arm, POSES[args.pose]) and move_gripper(node, gripper, GRIPPER[args.gripper])
    node.destroy_node()
    rclpy.shutdown()
    sys.exit(0 if ok else 1)


if __name__ == "__main__":
    main()

Porting the Lime's MoveIt config from Humble to Jazzy

The upstream turtlebot3_lime_moveit_config was written for Humble and real hardware. These are the changes this tutorial needed. The first two come from the Jazzy migration notes; every other row was found by running it:

Nine problems and their fixes
Symptom Cause Fix (in lime_isaac_moveit)
planning_plugin / default_planner_request_adapters/* not found Jazzy renamed them ompl_planning.yaml in Jazzy format: planning_plugins, default_planning_request_adapters/*, default_planning_response_adapters/*
topic_based_ros2_control not available on Jazzy package renamed joint_state_topic_hardware_interface/JointStateTopicSystem (same parameters)
The requested state interface not found: 'wheel_left_joint/effort'; hardware deactivated Isaac Sim's JointState carries effort too, and the topic system copies every field declare position, velocity and effort state interfaces
Arm never moves; Isaac Sim warns "ensure size of position … arrays match the number of actuators" wheels (state only) and arm in one component: the command message had 9 names but 7 positions two hardware components, IsaacArm (commands) and IsaacWheels (state only)
MoveIt: Start state out of bounds … joint3 SRDF home has joint3 = 1.87 but the URDF limit is 1.8567 home uses 1.80: with 1.85 the arm, sagging a few milliradians, could still end up on the limit
No acceleration limit was defined for joint joint1 Jazzy's time parameterization needs acceleration limits own joint_limits.yaml with max_acceleration
"SUCCESS" although the arm did not move without goal tolerances, a trajectory controller reports success when the time is over arm_controller.constraints.<joint>.goal: 0.05
Gripper "stalled at 0.0" immediately stall detection fired before the finger started stall_timeout: 2.0, stall_velocity_threshold: 0.0005
Seen once: Switch controller timed out after 5 seconds!, the spawner dies, and MoveIt has no arm or gripper controller activating the controllers took longer than the spawner's default 5 s (the PC was busy: Isaac Sim, YOLO and RViz at once) --switch-timeout 30 for the spawner in moveit.launch.py

Only one simulation at a time

Two running Isaac Sim instances both publish /clock. Every ROS node then sees time jumping back and forth ("Detected jump back in time. Clearing TF buffer."), and plans fail in strange ways. Stop old runs with tools/stop_isaac.sh, and stop old ROS processes with docker/ros_clean.sh.

Automatic check

python isaac/12_moveit.py --headless --test waits until the simulated arm reaches the arm_demo pose (within 0.05 rad) and the gripper is open. That is the real joint state in Isaac Sim, not the controller's report:

[12] arm reached the demo pose (max error 0.012 rad), gripper open 0.0154 m
[12][test] MoveIt plan executed in Isaac Sim: PASS

tools/run_all_checks.sh 12 starts MoveIt and arm_demo in the container for you.

Next: 13 · Pick and place