CodeTheRobot

ROS 2 Lyrical Luth · Lesson 86 of 86

Building a full warehouse robot: AMR, perception and Nav2

Capstone: one warehouse robot that perceives, navigates, docks and reports.

Estimated time · 180–240 min

Learning goals

What you will understand

  • Explain building a full warehouse robot: amr, perception and nav2 in your own words
  • Use it in a small robotics example
  • Verify the result instead of assuming it worked

Understand the idea first

The mental model

The capstone joins all phases: a described and simulated AMR, sensors, localization and Nav2 navigation, a perception pipeline that finds pallets or markers, docking and charging, a lifecycle-managed start-up, safety supervision and logging. It is the best proof that you can build a complete ROS 2 robot.

Define acceptance tests before you start: start-up in under 60 seconds from one command, ten deliveries with no collision, recovery from a blocked aisle, docking success above 95%, stop within 0.5 s when commands stop, and metrics recorded for every run. Write down what is not covered, especially real-world safety requirements.

Guided lesson

Work through these steps

  1. 1.

    Source the ROS 2 Lyrical environment in a fresh terminal.

  2. 2.

    Read the building a full warehouse robot: amr, perception and nav2 example and identify what each line does.

  3. 3.

    Build only the affected package, source the workspace overlay, and run the example.

  4. 4.

    Inspect the result from a second terminal with the ros2 CLI or RViz2 and compare it with the expected result.

Worked example

Read it before you run it

ros2 launch warehouse_robot bringup.launch.py sim:=true
# One command starts the simulator, drivers, Nav2, perception and supervisor.
ros2 lifecycle get /supervisor
# The supervisor is a lifecycle node; it must be active.
ros2 action send_goal /deliver warehouse_interfaces/action/Deliver "{pickup: 'shelf_3', dropoff: 'dock_1'}"
# Command a delivery through your own action.
ros2 topic echo /metrics --once
# Read the metrics for the latest run.
ros2 bag record -o acceptance_run -a
# Record everything for the acceptance report.

What the example is doing

  1. 1.The ros2 commands query the running graph; they do not prove that a node's internal behavior is correct.
  2. 2.Build from the workspace root, then source install/setup.bash so the shell can discover the new package.
  3. 3.Use a second sourced terminal to inspect nodes and interfaces while the example runs.

Watch it run · Mobile robot

See what this code does

The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.

goalMOBILE ROBOT

Demo for Building a full warehouse robot: AMR, perception and Nav2. Expected result: Deliver action succeeds and /metrics shows one completed task

Practice code

Now type it yourself

Copy the starter into your ROS 2 package, replace every TODO, then build with colcon build and run it from a sourced terminal.

# TODO: send a Deliver goal from shelf_3 to dock_1 and print feedback
ros2 topic echo /metrics --once

Expected output

Deliver action succeeds and /metrics shows one completed task
Stuck? Show the full solution (try it yourself first)
ros2 action send_goal /deliver warehouse_interfaces/action/Deliver "{pickup: 'shelf_3', dropoff: 'dock_1'}" --feedback
ros2 topic echo /metrics --once

Expected result

How you know it worked

  • ROS_DISTRO is lyrical in every terminal used for the exercise.
  • The complete package from the exercise builds and the expected graph entity appears in a second terminal.

Practical exercise

Apply the lesson

Assemble the capstone in simulation, run the acceptance tests ten times, write a one-page report with success rate, timing, recoveries and known limitations, and list five things you would test on real hardware first.

Before you continue

  • ROS_DISTRO reports lyrical in every terminal you used
  • The example builds and runs without errors
  • You checked the result with a ros2 command, RViz2 or a test, not just by reading the code

If something goes wrong

ros2 cannot find a package or executable.

Source /opt/ros/lyrical/setup.bash, build from the workspace root, then source install/setup.bash in that terminal.

Nodes run but cannot discover each other.

Confirm both terminals use Lyrical, the same ROS_DOMAIN_ID, and compatible network/discovery settings.