Robot motion planning

Nav2

Nav2 is a ROS 2 navigation stack for mobile robots. It provides planners, controllers, behavior trees and costmaps but expects valid localization, odometry, transforms and velocity-control interfaces from the robot.

Practical engineering guide

What you can build with Nav2 and where problems start

Nav2 is a ROS 2 navigation stack for mobile robots. It provides planners, controllers, behavior trees and costmaps but expects valid localization, odometry, transforms and velocity-control interfaces from the robot.

Download, install and launch Nav2

On Ubuntu 24.04 with ROS 2 Jazzy, install the Navigation2 and bringup packages. Use the documented simulated robot launch for your simulator and distribution before connecting the real mobile base.

Download Nav2
sudo apt update
sudo apt install ros-jazzy-navigation2 ros-jazzy-nav2-bringup
source /opt/ros/jazzy/setup.bash
ros2 pkg prefix nav2_bringup

A first test you can reproduce

  1. 01.Publish a consistent map -> odom -> base_link transform chain and a valid robot footprint.
  2. 02.Verify wheel odometry and laser/depth observations with real timestamps in RViz.
  3. 03.Start Nav2 lifecycle nodes and confirm planners, controllers and costmaps reach the active state.
  4. 04.Send a short navigation goal in an open space and inspect local/global paths, command output and recovery behavior.

Questions that come up during real implementation

Why does Nav2 refuse to move although a map appears in RViz?

Check TF transforms and frame names, the localization pose, lifecycle states, costmap clearing and whether the controller receives a valid path. Confirm that /cmd_vel reaches the base driver and is accepted. A visible occupancy grid does not prove that the robot knows its location.

Why does a robot oscillate or stop near a doorway?

Verify footprint and inflation radius, velocity and acceleration limits, controller lookahead and localization covariance. A doorway that is geometrically wide enough may be blocked in the inflated costmap. Replay the same route after changing one parameter at a time.

Do I need SLAM Toolbox or RTAB-Map with Nav2?

Not always. A map plus an appropriate localization method can be enough. SLAM builds or updates maps; Nav2 plans and controls navigation. Choose SLAM only when map creation or updating is part of the task.

Checks before using it on a robot

  • Measure stopped distance, clearance and recovery from a blocked path.
  • Test restart localization after physically moving the robot while navigation is paused.

Official technical reference

https://docs.nav2.org/rolling/configuration_and_development/first_time_robot_setup_guide/

Compatibility and installation

Developer
Open Navigation project
License
Open source
Operating systems
Linux
ROS support
ROS 2
Languages
C++, Python
Installation method
ROS packages and source builds

Profile sources

Explore the connected robotics directories