Skip to content

06 · Drive TurtleBot3 Lime with ROS 2 (/cmd_vel)

⏱ 20 min · Level: beginner · Script: isaac/06_ros2_drive.py

Goal. Build an Action Graph that publishes the simulation clock and turns ROS 2 geometry_msgs/Twist messages on /cmd_vel into wheel speeds. Then drive the Lime with your keyboard from the ROS 2 container.

ros2 topic pub /cmd_vel … {linear: {x: 0.25}, angular: {z: 0.5}} from the ROS 2 container: the Lime drives a circle.

ROS 2 in 10 minutes

From this tutorial on, Isaac Sim is one part of a ROS 2 system. These are the ROS 2 words the tutorials use. Already know them? Skip to Concepts.

Word What it is In these tutorials
node a running program, or part of one, that does one job and talks to other nodes RViz, Nav2's planner, the YOLO detector
topic a named channel. Publishers send messages to it, subscribers receive them, and neither needs to know the other /cmd_vel (speed commands), /odom, /scan, /clock
message type the data format of a topic /cmd_vel carries geometry_msgs/msg/Twist: a linear and an angular velocity, three numbers each
service a request and its answer asking a Nav2 node whether it is active (/amcl/get_state), clearing a costmap (tutorial 15)
action a longer job with feedback while it runs and a result at the end. It can be cancelled NavigateToPose (Nav2, tutorial 11), MoveGroup and GripperCommand (MoveIt 2, tutorial 12)
TF the tree of coordinate frames: where each part of the robot is tutorial 07
package a folder of ROS 2 code, settings and launch files ros2_ws/src/lime_isaac_bringup, lime_yolo, …
workspace, colcon the folder that holds the packages (ros2_ws/), and the tool that builds them ./scripts/build_ws.sh runs colcon build in the container
launch file a Python file that starts several nodes with their settings at once ros2 launch lime_isaac_bringup navigation.launch.py
parameter a setting of a node use_sim_time; Nav2's settings in nav2_params.yaml
/clock, use_sim_time Isaac Sim publishes the simulated time on /clock. Nodes started with use_sim_time: true use it instead of the PC's clock, so they agree with the simulation even when it runs slower than real time this project's launch files set it for you

Two kinds of node

Isaac Sim's Action Graphs are also made of nodes: the boxes in the graph editor, such as ROS2 Subscribe Twist. Those are OmniGraph nodes. When this page means a ROS 2 node, it says so.

Every ROS 2 command in these tutorials runs in the ROS 2 container: ./docker/run_ros.sh ros2 … runs one command, and ./docker/run_ros.sh alone opens a shell there. To learn these ideas hands-on, with small example programs, follow the official ROS 2 Jazzy tutorials: Beginner: CLI tools (nodes, topics, services, parameters, actions, launch) and Beginner: Client libraries (your own packages and nodes, colcon). The container has their turtlesim and example nodes.

Concepts

OmniGraph / Action Graph. Isaac Sim connects simulation and ROS 2 with graphs of nodes. An Action Graph runs when an event fires. On Playback Tick fires once per simulated frame while the simulation is playing. ROS 2 topics are only published or received while you are in Play.

ROS 2 bridge. The extension isaacsim.ros2.bridge provides the graph nodes that talk to ROS 2 (ROS2 Publish Clock, ROS2 Subscribe Twist, …). It runs on Isaac Sim's bundled Jazzy libraries (see Setup).

Differential drive. A Twist gives the robot's forward speed \(v\) and turn rate \(\omega\). The Differential Controller node converts them to wheel speeds:

\[ \omega_{left} = \frac{v - \omega\,\frac{L}{2}}{r}, \qquad \omega_{right} = \frac{v + \omega\,\frac{L}{2}}{r} \]

For the Lime the wheel radius is \(r = 0.06\) m and the wheel separation is \(L = 0.29425\) m (from the URDF).

The graph

flowchart LR
  tick([On Playback Tick])
  time[Isaac Read<br/>Simulation Time]
  clock[ROS2 Publish Clock<br/><i>/clock</i>]
  twist[ROS2 Subscribe Twist<br/><i>/cmd_vel</i>]
  bl[Break 3-Vector]
  ba[Break 3-Vector]
  diff[Differential Controller<br/>r = 0.06, L = 0.29425]
  art[Articulation Controller<br/>wheel_left_joint, wheel_right_joint]
  tick --> clock
  time -- "simulationTime" --> clock
  tick --> twist
  tick --> art
  twist -- "execOut" --> diff
  twist -- "linearVelocity" --> bl -- "x" --> diff
  twist -- "angularVelocity" --> ba -- "z" --> diff
  diff -- "velocityCommand" --> art

Build it

  1. Make a stage with the tuned robot: File ▸ New, Create ▸ Physics ▸ Ground Plane, then File ▸ Add Reference assets/usd/turtlebot3_lime_tuned.usda. (Don't open the robot file itself: if you saved it, every later tutorial would load your changes.)
  2. Window ▸ Visual Scripting ▸ Action Graph, then New Action Graph.
  3. Search for each node by name in the node library (left side) and drag it into the graph: On Playback Tick, Isaac Read Simulation Time, ROS2 Publish Clock, ROS2 Subscribe Twist, 2× Break 3-Vector, Differential Controller, Articulation Controller.
  4. Connect them as in the diagram above.
  5. Set the inputs in the Property panel:

    Node Input Value
    ROS2 Subscribe Twist topicName /cmd_vel
    Differential Controller wheelRadius / wheelDistance / maxWheelSpeed 0.06 / 0.29425 / 8.063
    Articulation Controller targetPrim …/Geometry/base_footprint/base_link (the articulation root)
    Articulation Controller jointNames wheel_left_joint, wheel_right_joint
  6. Press Play ▶.

  7. Drive it (next section). Afterwards press Stop ■ and save your stage: File ▸ Save As my_stages/06_ros2_drive.usd. Tutorial 07 continues from it.

Shortcuts

Isaac Sim has graph builders for common cases. Tools ▸ Robotics ▸ OmniGraph Controllers ▸ Differential Controller creates the controller half of this graph. Tools ▸ Robotics ▸ ROS 2 OmniGraphs creates ROS 2 graphs for clock, TF, odometry, cameras and LiDAR. Building this one by hand once is the best way to understand what those shortcuts produce.

The finished graph in the Action Graph editor

source scripts/isaac_env.sh
python isaac/06_ros2_drive.py

og.Controller.edit() creates nodes, sets values and connects ports in one call. These are the same three steps you do by hand in the GUI:

og.Controller.edit(
    {"graph_path": "/World/ROS2_Drive", "evaluator_name": "execution"},
    {
        keys.CREATE_NODES: [
            ("OnPlaybackTick", "omni.graph.action.OnPlaybackTick"),
            ("SubscribeTwist", "isaacsim.ros2.bridge.ROS2SubscribeTwist"),
            ("DiffController", "isaacsim.robot.wheeled_robots.DifferentialController"),
            ("ArticulationController", "isaacsim.core.nodes.IsaacArticulationController"),
            # ...
        ],
        keys.SET_VALUES: [("DiffController.inputs:wheelRadius", 0.06), ...],
        keys.CONNECT: [("DiffController.outputs:velocityCommand",
                        "ArticulationController.inputs:velocityCommand"), ...],
    },
)

Two more details in the script:

  • app_utils.enable_extension("isaacsim.ros2.bridge"): standalone apps start without the bridge.
  • The main loop is capped at 60 Hz (/app/runLoops/main/rateLimitEnabled). A headless script otherwise runs faster than real time, and ROS tools such as teleop, RViz and Nav2 expect roughly real time.
Full script: isaac/06_ros2_drive.py
# SPDX-FileCopyrightText: 2026 An (an-robotics)
# SPDX-License-Identifier: Apache-2.0

"""Tutorial 06 - Drive TurtleBot3 Lime from ROS 2 (/cmd_vel) with an Action Graph.

    source scripts/isaac_env.sh
    python isaac/06_ros2_drive.py

    # in another terminal (ROS 2 Jazzy container):
    ./docker/run_ros.sh ros2 run teleop_twist_keyboard teleop_twist_keyboard

The Action Graph built here:

    On Playback Tick --+--> ROS2 Publish Clock  <-- Isaac Read Simulation Time      (/clock)
                       |
                       +--> ROS2 Subscribe Twist (/cmd_vel)
                       |        |-- linear  --> Break Vector3 --x--+
                       |        |-- angular --> Break Vector3 --z--+--> Differential Controller
                       |                                                  | wheel velocities
                       +--> Articulation Controller  <--------------------+
                                (wheel_left_joint, wheel_right_joint)
"""

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 carb
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 lime
from isaacsim.core.experimental.objects import Cube, GroundPlane
from isaacsim.core.experimental.prims import Articulation
from isaacsim.core.simulation_manager import SimulationManager
from pxr import UsdLux

# --- 1. ROS 2 bridge + real-time pacing ------------------------------------------------------------
# The ROS 2 bridge is an extension. It uses Isaac Sim's bundled ROS 2 Jazzy libraries
# (scripts/isaac_env.sh puts them on LD_LIBRARY_PATH before Isaac Sim starts).
app_utils.enable_extension("isaacsim.ros2.bridge")
# Standalone scripts run "as fast as possible". ROS tools expect roughly real time, so cap the
# main loop at 60 Hz (= one 1/60 s physics step per frame).
settings = carb.settings.get_settings()
settings.set("/app/runLoops/main/rateLimitEnabled", True)
settings.set("/app/runLoops/main/rateLimitFrequency", 60)
simulation_app.update()

import omni.graph.core as og
import usdrt.Sdf

# --- 2. Scene -------------------------------------------------------------------------------------------
stage = stage_utils.create_new_stage(template="sunlight")
UsdLux.DomeLight.Define(stage, "/World/DomeLight").GetIntensityAttr().Set(500.0)
GroundPlane("/World/GroundPlane")
for i, (x, y) in enumerate([(1.5, 0.0), (0.0, 1.5), (-1.5, 0.0), (0.0, -1.5)]):  # landmarks
    Cube(f"/World/Landmark_{i}", sizes=0.2, positions=[x, y, 0.1], colors=[0.6, 0.85, 0.2])
robot_path = "/World/turtlebot3_lime"
articulation_root = lime.add_lime(robot_path)

# --- 3. The Action Graph ------------------------------------------------------------------------------
keys = og.Controller.Keys
og.Controller.edit(
    {"graph_path": "/World/ROS2_Drive", "evaluator_name": "execution"},
    {
        keys.CREATE_NODES: [
            ("OnPlaybackTick", "omni.graph.action.OnPlaybackTick"),
            ("ReadSimTime", "isaacsim.core.nodes.IsaacReadSimulationTime"),
            ("PublishClock", "isaacsim.ros2.bridge.ROS2PublishClock"),
            ("SubscribeTwist", "isaacsim.ros2.bridge.ROS2SubscribeTwist"),
            ("BreakLinear", "omni.graph.nodes.BreakVector3"),
            ("BreakAngular", "omni.graph.nodes.BreakVector3"),
            ("DiffController", "isaacsim.robot.wheeled_robots.DifferentialController"),
            ("ArticulationController", "isaacsim.core.nodes.IsaacArticulationController"),
        ],
        keys.SET_VALUES: [
            ("PublishClock.inputs:topicName", "/clock"),
            ("SubscribeTwist.inputs:topicName", "/cmd_vel"),
            ("DiffController.inputs:wheelRadius", lime.WHEEL_RADIUS),
            ("DiffController.inputs:wheelDistance", lime.WHEEL_BASE),
            ("DiffController.inputs:maxWheelSpeed", lime.MAX_WHEEL_SPEED),
            ("ArticulationController.inputs:targetPrim", [usdrt.Sdf.Path(articulation_root)]),
            ("ArticulationController.inputs:jointNames", lime.WHEEL_JOINTS),
        ],
        keys.CONNECT: [
            ("OnPlaybackTick.outputs:tick", "PublishClock.inputs:execIn"),
            ("ReadSimTime.outputs:simulationTime", "PublishClock.inputs:timeStamp"),
            ("OnPlaybackTick.outputs:tick", "SubscribeTwist.inputs:execIn"),
            ("OnPlaybackTick.outputs:tick", "ArticulationController.inputs:execIn"),
            ("SubscribeTwist.outputs:execOut", "DiffController.inputs:execIn"),
            ("SubscribeTwist.outputs:linearVelocity", "BreakLinear.inputs:tuple"),
            ("BreakLinear.outputs:x", "DiffController.inputs:linearVelocity"),
            ("SubscribeTwist.outputs:angularVelocity", "BreakAngular.inputs:tuple"),
            ("BreakAngular.outputs:z", "DiffController.inputs:angularVelocity"),
            ("DiffController.outputs:velocityCommand", "ArticulationController.inputs:velocityCommand"),
        ],
    },
)

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

    recorder = Recorder(args.record, eye=(2.2, -2.2, 1.6), target=(0.0, 0.0, 0.1), every_n=3, fps=20)

# --- 4. Run -----------------------------------------------------------------------------------------------
SimulationManager.setup_simulation(dt=1.0 / 60.0)
app_utils.play()
simulation_app.update()
robot = Articulation(articulation_root)
start = robot.get_world_poses()[0].numpy()[0, :2].copy()
print("[06] ready: publish geometry_msgs/Twist on /cmd_vel to drive the robot", flush=True)

steps, moved, first_move_step = 0, 0.0, None
while simulation_app.is_running():
    simulation_app.update()
    steps += 1
    if not (args.test or args.record):
        continue  # interactive: run until you close the window
    # --test / --record: wait (max 60 s) for /cmd_vel commands, then watch the robot for 10 s
    moved = float(np.linalg.norm(robot.get_world_poses()[0].numpy()[0, :2] - start))
    if first_move_step is None and moved > 0.05:
        first_move_step = steps
    if first_move_step is None and steps > 60 * 60:
        break  # nobody published /cmd_vel
    if first_move_step is not None:
        if recorder:
            recorder.capture()
        if steps - first_move_step > 10 * 60:
            break

ok = True
if args.test:
    ok = moved > 0.3
    print(f"[06][test] robot moved {moved:.2f} m after /cmd_vel commands -> {'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)

Drive it from ROS 2

With the simulation playing, open a second terminal. First look at what ROS 2 sees:

./docker/run_ros.sh ros2 topic list                               # the topics that exist now
./docker/run_ros.sh ros2 topic info /cmd_vel                      # its message type, who publishes, who listens
./docker/run_ros.sh ros2 interface show geometry_msgs/msg/Twist   # what a Twist message contains
/clock
/cmd_vel
/parameter_events
/rosout

Type: geometry_msgs/msg/Twist
Publisher count: 0
Subscription count: 1

# This expresses velocity in free space broken into its linear and angular parts.

Vector3  linear
    float64 x
    float64 y
    float64 z
Vector3  angular
    float64 x
    float64 y
    float64 z

The Lime uses linear.x (forward speed) and angular.z (turn rate). The one subscriber is your ROS2 Subscribe Twist graph node in Isaac Sim. Nobody publishes on /cmd_vel yet: that is your job now.

./docker/run_ros.sh ros2 run teleop_twist_keyboard teleop_twist_keyboard

i forward, , backward, j / l turn, k stop. q / z change the speed.

./docker/run_ros.sh ros2 topic pub -r 10 /cmd_vel geometry_msgs/msg/Twist \
  "{linear: {x: 0.25}, angular: {z: 0.5}}"

Look at the clock as well:

./docker/run_ros.sh ros2 topic hz /clock        # ≈ 60 Hz

Automatic check

python isaac/06_ros2_drive.py --headless --test waits for /cmd_vel messages, then checks that the robot moved more than 0.3 m from its start. With the topic pub command above (12 s on a circle of 0.5 m radius) it reports robot moved 0.47 m … PASS.

Driving

Troubleshooting

Symptom Fix
/cmd_vel is published but the robot does not move Is the simulation playing? Is targetPrim the articulation root (…/base_link)?
The robot turns the wrong way or drives backwards Check the jointNames order: left first, then right.
The robot is slow or jittery You are not using the tuned asset (see 03).

Next: 07 · Odometry, TF & RViz