11 · Navigation with Nav2¶
Goal. Make a map of the lime_room with Isaac Sim, then let Nav2, the ROS 2 navigation stack, drive the Lime to a goal: localise with AMCL, plan around obstacles, follow the path.
RViz (navigation.rviz):
- Nav2 Goal, in the toolbar: click it, then drag an arrow on the map to send a goal.
- The map: the walls, the divider, the crate (here) and the pillar.
- The costmaps: pink = inflated obstacles.
- The traffic cone: only in the costmaps, because only the LiDAR knows about it. It is not in the map.
- AMCL's particles (green): its guesses of where the robot is.
- The LiDAR scan: the dots along the walls.
- The planned path (pink line), round the cone and the pillar.
Concepts¶
Nav2 needs five things from the robot. Isaac Sim provides all of them, built in tutorials 06–09:
| Nav2 needs | Topic | Tutorial |
|---|---|---|
| a clock | /clock |
06 |
| a way to drive | /cmd_vel (Nav2 publishes, Isaac Sim's graph subscribes) |
06 |
odometry and TF odom → base_footprint |
/odom, /tf |
07 |
| the robot's frames | /joint_states → robot_state_publisher |
07 |
| a laser scan | /scan |
09 |
…plus a map, which is new in this tutorial.
The map is for what stays put. The costmaps see what's new
The map holds the walls, the pillar, the crate and the divider: the things that stay put. The objects of
tutorials 08–10 are cleared away. Instead, 11_nav2.py puts a traffic cone from NVIDIA's warehouse props
right on the robot's way, after the map was made, so the map doesn't know about it. The LiDAR sees it, the
costmaps' obstacle layers mark it, and the planner goes round it, just as it would go round a box someone
left on the floor.
The cone is 46 cm tall. The LiDAR only sees what crosses its plane, 16 cm above the floor: a banana (4 cm) would be invisible to it (tutorial 09). Real robots add a depth camera to the costmaps for low obstacles.
add_traffic_cone() in isaac/common/scene.py
def add_traffic_cone(stage, x: float = CONE_XY[0], y: float = CONE_XY[1], root: str = "/World/LimeRoom") -> str:
"""Tutorial 11: put a traffic cone on the floor AFTER the map was made, so it is not in the map.
It is a rigid body (1 kg): if the robot touches it, it moves. The asset already has a mesh collider."""
from isaacsim.core.experimental.prims import XformPrim
from isaacsim.storage.native import get_assets_root_path
from pxr import Usd, UsdGeom, UsdPhysics
import isaacsim.core.experimental.utils.stage as stage_utils
path = f"{root}/Cone"
stage_utils.add_reference_to_stage(get_assets_root_path() + CONE_ASSET, path)
XformPrim(path, reset_xform_op_properties=True).set_world_poses(positions=[[x, y, 0.002]])
prim = stage.GetPrimAtPath(path)
UsdPhysics.RigidBodyAPI.Apply(prim)
UsdPhysics.MassAPI.Apply(prim).CreateMassAttr(1.0) # kg
for p in Usd.PrimRange(prim):
if p.IsA(UsdGeom.Mesh): # a moving body needs a convex collider (a cone is convex anyway)
UsdPhysics.MeshCollisionAPI.Apply(p).CreateApproximationAttr("convexHull")
return path
flowchart LR
map[map_server<br/>lime_room.yaml] --> amcl[AMCL<br/>map → odom]
scan["/scan"] --> amcl
amcl --> planner[planner_server<br/>NavFn]
goal([Nav2 Goal]) --> bt[bt_navigator]
bt --> planner --> ctrl[controller_server<br/>MPPI]
ctrl --> vs[velocity_smoother] --> cm[collision_monitor] -- "/cmd_vel" --> isaac[Isaac Sim]
isaac -- "/odom, /tf, /scan" --> amcl & ctrl
Part 1: make the map¶
Nav2 localises against an occupancy grid: an image in which black means occupied, white means free and grey means unknown, plus a YAML file with its resolution and origin. On a real robot you would drive around with SLAM (tutorial 14). In simulation the scene is the ground truth, so Isaac Sim can compute the map directly from the colliders.
The generator looks at a height band of the scene and flattens it into one 2D map. We use 1–50 cm above the floor: high enough to skip the floor itself, and above the top of every obstacle. The floor is cleared first: a map is for what stays put.
- Open
assets/scenes/lime_room.usda(without the robot). - Clear the floor: in the Stage panel, select
/World/LimeRoom/Objectsand press Delete. Don't save the scene afterwards: tutorials 08–10 and 13 need the objects. - Tools ▸ Robotics ▸ Occupancy Map.
- Origin: a free point, (0.5, 0, 0.16). Lower Bound (−2.7, −2.7, −0.15) and Upper Bound (3.7, 2.7, 0.34), relative to the origin: the band from 1 cm to 50 cm above the floor. Cell Size 0.05.
- CALCULATE, then VISUALIZE IMAGE, then Save Image and Save YAML in
ros2_ws/src/lime_isaac_bringup/maps/.

With these values the GUI computes the same map as the script. Keep Rotate Image = 180 (the default),
which puts north at the top. Set Map Name to lime_room before saving. Its YAML origin
[-2.175, -2.675] differs from the script's [-2.2, -2.7] by half a cell (2.5 cm), and either works.
generator = _omap.Generator(omni.physx.get_physx_interface(), omni.usd.get_context().get_stage_id())
generator.update_settings(0.05, 4.0, 5.0, 6.0) # cell size, occupied / free / unknown values
generator.set_transform((0.5, 0.0, 0.16), lo, hi) # origin (a free point); bounds: x, y and the 1-50 cm band
generator.generate2d() # needs the simulation playing (PhysX queries)
occupied = generator.get_occupied_positions() # world coordinates
The script turns the occupied and free cells into lime_room.pgm and lime_room.yaml, with
origin: [-2.2, -2.7, 0.0], the world position of the bottom-left pixel. It checks known cells: a wall and the
pillar must be occupied, the start, the room centre and the cone's spot free:
[11] generator: 1863 occupied, 11961 free cells
[11] map 128 x 108 cells (6.40 x 5.40 m) -> ros2_ws/src/lime_isaac_bringup/maps
[11][check] ok north wall (1.0, 2.55) occupied
[11][check] ok pillar (2.0, -1.2) occupied
[11][check] ok robot start (0, 0) free
[11][check] ok room centre (1.0, -0.5) free
[11][check] ok where the cone will stand (1.2, -0.3) free (not in the map)
[11][test] map PASS
Full script: isaac/11_make_map.py
# SPDX-FileCopyrightText: 2026 An (an-robotics)
# SPDX-License-Identifier: Apache-2.0
"""Tutorial 11 (part 1) - Make a Nav2 map of the lime_room with Isaac Sim's occupancy map generator.
source scripts/isaac_env.sh
python isaac/11_make_map.py --headless
Writes ros2_ws/src/lime_isaac_bringup/maps/lime_room.pgm + lime_room.yaml (the ROS map_server format).
The generator (extension isaacsim.asset.gen.omap) checks, cell by cell, whether a physics collider occupies a
height band of the scene, and flattens the band into one 2D map. We map everything from 1 cm to 50 cm above the
floor. A map is for what stays put: the walls, the pillar, the crate and the divider. The floor is cleared first
(no objects); things that come and go, like the traffic cone of 11_nav2.py, are the costmaps' job.
"""
import sys
from common.cli import parse_args
args = parse_args(
__doc__.splitlines()[0],
extra=lambda p: p.add_argument("--out", default=None, help="write the map to this folder instead"),
)
from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": args.headless})
import isaacsim.core.experimental.utils.app as app_utils
import isaacsim.core.experimental.utils.stage as stage_utils
import numpy as np
from common.paths import IMG_DIR, REPO_ROOT
from common.scene import CONE_XY, ROOM_X, ROOM_Y, WALL_THICKNESS, build_lime_room
from isaacsim.core.simulation_manager import SimulationManager
RESOLUTION = 0.05 # m per cell (the usual value for small indoor robots)
BAND = (0.01, 0.50) # m above the floor: from just above the floor (not the floor itself) to above the obstacles
MAP_DIR = REPO_ROOT / "ros2_ws" / "src" / "lime_isaac_bringup" / "maps"
if args.out:
MAP_DIR = REPO_ROOT / args.out
app_utils.enable_extension("isaacsim.asset.gen.omap")
simulation_app.update()
import omni.physx
import omni.usd
from isaacsim.asset.gen.omap.bindings import _omap
stage = stage_utils.create_new_stage(template="empty")
build_lime_room(stage, with_objects=False) # only what stays put - no objects, no robot (not in its own map)
while stage_utils.is_stage_loading():
simulation_app.update()
# The generator uses PhysX queries: the simulation must be playing.
SimulationManager.setup_simulation(dt=1.0 / 60.0)
app_utils.play()
for _ in range(10):
simulation_app.update()
# Map the inside of the room plus the walls (bounds are offsets from the origin).
pad = WALL_THICKNESS + 0.1
origin = (0.5, 0.0, 0.16) # any FREE point inside the room
lo = (ROOM_X[0] - pad - origin[0], ROOM_Y[0] - pad - origin[1], BAND[0] - origin[2])
hi = (ROOM_X[1] + pad - origin[0], ROOM_Y[1] + pad - origin[1], BAND[1] - origin[2])
generator = _omap.Generator(omni.physx.get_physx_interface(), omni.usd.get_context().get_stage_id())
generator.update_settings(RESOLUTION, 4.0, 5.0, 6.0) # cell size, occupied / free / unknown marker values
generator.set_transform(origin, lo, hi)
generator.generate2d()
occupied = np.array([(p.x, p.y) for p in generator.get_occupied_positions()])
free = np.array([(p.x, p.y) for p in generator.get_free_positions()])
app_utils.stop()
print(f"[11] generator: {len(occupied)} occupied, {len(free)} free cells", flush=True)
# --- Rasterise into a ROS map image: row 0 = largest y (north), column 0 = smallest x (west) ----------------
x_min, y_min = origin[0] + lo[0], origin[1] + lo[1]
width = int(round((hi[0] - lo[0]) / RESOLUTION))
height = int(round((hi[1] - lo[1]) / RESOLUTION))
grid = np.full((height, width), 205, dtype=np.uint8) # 205 = unknown (grey)
def paint(points, value):
cols = np.floor((points[:, 0] - x_min) / RESOLUTION).astype(int)
rows = height - 1 - np.floor((points[:, 1] - y_min) / RESOLUTION).astype(int)
keep = (cols >= 0) & (cols < width) & (rows >= 0) & (rows < height)
grid[rows[keep], cols[keep]] = value
paint(free, 254) # free (white)
paint(occupied, 0) # occupied (black)
MAP_DIR.mkdir(parents=True, exist_ok=True)
from PIL import Image
Image.fromarray(grid, mode="L").save(MAP_DIR / "lime_room.pgm")
(MAP_DIR / "lime_room.yaml").write_text(
"image: lime_room.pgm\n"
"mode: trinary\n"
f"resolution: {RESOLUTION}\n"
f"origin: [{x_min:.3f}, {y_min:.3f}, 0.0] # world position of the bottom-left pixel\n"
"negate: 0\n"
"occupied_thresh: 0.65\n"
"free_thresh: 0.25\n"
)
print(f"[11] map {width} x {height} cells ({width * RESOLUTION:.2f} x {height * RESOLUTION:.2f} m) -> {MAP_DIR}", flush=True)
ok = True
if args.test or args.record:
# Spot checks against the known room: a wall cell must be occupied, the robot's start must be free.
def cell(x, y):
return grid[height - 1 - int((y - y_min) / RESOLUTION), int((x - x_min) / RESOLUTION)]
checks = {
"north wall (1.0, 2.55) occupied": cell(1.0, ROOM_Y[1] + 0.05) == 0,
"pillar (2.0, -1.2) occupied": cell(2.0, -1.2) == 0,
"robot start (0, 0) free": cell(0.0, 0.0) == 254,
"room centre (1.0, -0.5) free": cell(1.0, -0.5) == 254,
f"where the cone will stand {CONE_XY} free (not in the map)": cell(*CONE_XY) == 254,
}
for text, passed in checks.items():
print(f"[11][check] {'ok ' if passed else 'FAIL'} {text}")
ok = all(checks.values())
if args.test:
print(f"[11][test] map {'PASS' if ok else 'FAIL'}")
if args.record:
Image.fromarray(grid, mode="L").resize((width * 4, height * 4), Image.NEAREST).save(IMG_DIR / f"{args.record}.png")
simulation_app.close(exit_code=0 if ok else 1)
sys.exit(0 if ok else 1)

The map: the walls, the divider, the crate and the pillar, and nothing else. The traffic cone comes later (part 2).
Because the map comes from the same coordinates as the simulation, map frame = world frame. The robot starts at
(0, 0) facing +x, and AMCL is told exactly that (set_initial_pose: true).
Part 2: navigate¶
Terminal 1, Isaac Sim:
source scripts/isaac_env.sh
python isaac/11_nav2.py # the lime_room with a traffic cone on the floor
Terminal 2, Nav2 + RViz:
./scripts/build_ws.sh lime_isaac_bringup # once
./docker/run_ros.sh ros2 launch lime_isaac_bringup navigation.launch.py
Wait for Managed nodes are active, then click Nav2 Goal in RViz and drag an arrow on the map.
Or send the goal from the command line:
./docker/run_ros.sh ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose \
"{pose: {header: {frame_id: map}, pose: {position: {x: 3.2, y: -1.8}, orientation: {w: 1.0}}}}"
What the cone changes. Restart Isaac Sim with python isaac/11_nav2.py --no-cone (and Nav2 too) and send the
same goal. Without the cone, Nav2 drives almost straight and passes north of the pillar. With the cone on that
line, it goes south of the cone and then south of the pillar. The map is the same both times; only the costmaps,
fed by the LiDAR, are different.
The Lime's Nav2 parameters¶
lime_isaac_bringup/config/nav2_params.yaml is generated from Jazzy's own nav2_bringup/params/nav2_params.yaml,
with only these changes:
| Parameter | Value | Why |
|---|---|---|
robot_base_frame (bt_navigator, costmaps, behaviours) |
base_footprint |
Isaac Sim publishes odom → base_footprint |
costmap footprint |
[[0.075, 0.165], [0.075, -0.165], [-0.205, -0.165], [-0.205, 0.165]] |
the base box and the wheels; the base is not centred on the wheel axis |
inflation_radius |
0.30 m | small room, small robot |
AMCL laser_min_range / laser_max_range, costmap ranges |
0.12 / 3.5 m | LDS-01 |
AMCL set_initial_pose, initial_pose |
true, (0, 0, 0) | the robot's start in the map |
vx_max, wz_max, velocity smoother limits |
0.3 m/s, 1.2 rad/s | gentle indoor speeds (the Lime can do about 0.48 m/s) |
Don't reuse Humble Nav2 parameter files on Jazzy
Jazzy changed plugin names (:: instead of /), loads the default BT plugins itself, and starts extra servers
(collision monitor, docking, route server) that need parameters. Starting from the distro's own file avoids
all of that.
Isaac Sim side: isaac/11_nav2.py
# SPDX-FileCopyrightText: 2026 An (an-robotics)
# SPDX-License-Identifier: Apache-2.0
"""Tutorial 11 (part 2) - Navigate the lime_room with Nav2.
source scripts/isaac_env.sh
python isaac/11_make_map.py --headless # once: the map (part 1)
python isaac/11_nav2.py # with a traffic cone on the way - it is not in the map
python isaac/11_nav2.py --no-cone # the same room without the cone: compare the paths
# ROS 2 container: Nav2 + RViz. Click "Nav2 Goal" in RViz, or:
./docker/run_ros.sh ros2 launch lime_isaac_bringup navigation.launch.py
./docker/run_ros.sh ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose \\
"{pose: {header: {frame_id: map}, pose: {position: {x: 3.2, y: -1.8}, orientation: {w: 1.0}}}}"
Isaac Sim provides everything Nav2 needs - nothing new to build, only the pieces of tutorials 06-09:
/clock, /cmd_vel (subscribed), /odom, /tf (odom -> base_footprint), /joint_states, /scan
The robot starts at (0, 0) facing +x, the pose AMCL is told to start from (config/nav2_params.yaml).
The traffic cone is not in the map: the LiDAR sees it, the costmaps mark it, and the planner goes round it.
"""
import math
import sys
from common.cli import parse_args
args = parse_args(
__doc__.splitlines()[0],
extra=lambda p: (
p.add_argument("--goal", type=float, nargs=2, default=[3.2, -1.8], help="goal x y checked by --test"),
p.add_argument("--no-cone", action="store_true", help="leave the traffic cone out"),
),
)
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, sensors
from common.scene import add_traffic_cone, build_lime_room
from isaacsim.core.experimental.prims import Articulation, XformPrim
from isaacsim.core.simulation_manager import SimulationManager
graphs.enable_ros2_realtime(simulation_app)
stage = stage_utils.create_new_stage(template="empty")
build_lime_room(stage, with_objects=False) # the room as it was mapped (part 1)
cone = None if args.no_cone else add_traffic_cone(stage) # something new on the floor: not in the map
while stage_utils.is_stage_loading():
simulation_app.update()
robot_path = "/World/turtlebot3_lime"
articulation_root = lime.add_lime(robot_path)
graphs.create_clock_graph() # 06
graphs.create_drive_graph(articulation_root) # 06 /cmd_vel
graphs.create_odom_tf_joint_states_graph(articulation_root) # 07 /odom /tf /joint_states
graphs.create_lidar_graph(sensors.add_lds_lidar(robot_path)) # 09 /scan
recorder = None
if args.record:
from common.recorder import Recorder
recorder = Recorder(args.record, eye=(1.0, -4.6, 4.2), target=(1.0, -0.2, 0.0), every_n=6, fps=20)
SimulationManager.setup_simulation(dt=1.0 / 60.0)
app_utils.play()
simulation_app.update()
robot = Articulation(articulation_root)
print("[11] ready: start Nav2 (ros2 launch lime_isaac_bringup navigation.launch.py) and send a goal", flush=True)
goal = np.array(args.goal)
steps, reached_at, path = 0, None, []
cone_prim = XformPrim(cone) if cone else None
rest, closest = None, 9.9 # where the cone stands once it has settled; closest approach of the robot
def footprint_distance(robot_pose, point):
"""Distance from a point to the robot's footprint (the Nav2 rectangle), 0 = inside."""
(x, y, _), (w, qx, qy, qz) = robot_pose
yaw = math.atan2(2 * (w * qz + qx * qy), 1 - 2 * (qy * qy + qz * qz))
dx, dy = point[0] - x, point[1] - y
fx, fy = dx * math.cos(yaw) + dy * math.sin(yaw), -dx * math.sin(yaw) + dy * math.cos(yaw)
return math.hypot(max(-0.205 - fx, 0.0, fx - 0.075), max(-0.165 - fy, 0.0, fy - 0.165))
while simulation_app.is_running():
simulation_app.update()
steps += 1
if recorder:
recorder.capture()
if args.test or args.record:
pos, quat = robot.get_world_poses()
xy = pos.numpy()[0, :2]
if cone_prim and steps == 60: # the cone has settled
rest = cone_prim.get_world_poses()[0].numpy()[0].copy()
if rest is not None and steps % 6 == 0:
d = footprint_distance((pos.numpy()[0], quat.numpy()[0]), cone_prim.get_world_poses()[0].numpy()[0])
closest = min(closest, d)
if steps % 30 == 0:
path.append(xy.copy())
if reached_at is None and np.linalg.norm(xy - goal) < 0.25:
reached_at = steps
print(f"[11] goal reached after {steps / 60:.1f} s (sim time), {np.linalg.norm(xy - goal):.2f} m from the goal", flush=True)
if (reached_at is not None and steps - reached_at > 3 * 60) or steps > 240 * 60:
break
ok = True
if args.test:
ok = reached_at is not None
length = sum(np.linalg.norm(b - a) for a, b in zip(path, path[1:]))
print(f"[11][check] {'ok ' if ok else 'FAIL'} robot reached ({goal[0]}, {goal[1]}) within 0.25 m (ground truth); driven {length:.2f} m")
if cone_prim: # the cone is a rigid body: if the robot touched it, it moved
moved = np.linalg.norm(cone_prim.get_world_poses()[0].numpy()[0] - rest)
untouched = moved < 0.01
ok = ok and untouched
print(f"[11][check] {'ok ' if untouched else 'FAIL'} cone not touched (moved {moved * 100:.1f} cm); "
f"closest approach of the robot's footprint to its centre: {closest * 100:.0f} cm")
print(f"[11][test] {'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)
Automatic check¶
python isaac/11_nav2.py --headless --test waits until the robot's ground-truth position in Isaac Sim is
within 0.25 m of the goal (3.2, −1.8). tools/run_all_checks.sh 11 starts Nav2 and sends the goal:
[11] goal reached after 25.0 s (sim time), 0.25 m from the goal
[11][check] ok robot reached (3.2, -1.8) within 0.25 m (ground truth); driven 3.96 m
[11][check] ok cone not touched (moved 0.0 cm); closest approach of the robot's footprint to its centre: 58 cm
[11][test] PASS
The cone is a rigid body (1 kg), so the test also knows if the robot touched it: it would have moved.
Troubleshooting¶
| Symptom | Fix |
|---|---|
| RViz: no map / "Frame [map] does not exist" | AMCL has no initial pose yet: wait for Managed nodes are active, or set one with 2D Pose Estimate. |
| The robot spins, or does not move | Is the simulation playing, and is /clock published? Is only one simulation running? |
| The robot is mislocalised after you restart Isaac Sim | Restart Nav2 too: simulation time went back to 0. |
| Nav2 plans straight through the cone | The cone is only in the costmaps, which get it from /scan: is the LiDAR publishing? Anything lower than the scan plane (16 cm) is invisible to the LiDAR. |