An automated, scientific benchmarking suite for evaluating, comparing, and extending path planning algorithms within the ROS 2 Navigation 2 stack — including a custom C++ A* planner plugin.
Selecting the right path planner is critical for autonomous mobile robotics. NavBench provides a reproducible framework to rigorously test and compare multiple global planners and local trajectory controllers in identical simulation conditions.
The suite features:
- Six global planners: NavFn A*, Dijkstra, SMAC 2D, SMAC Hybrid-A*, State Lattice, and a custom-built C++ A* Nav2 plugin
- Two local controllers: DWB and MPPI, with dynamic obstacle injection support
- Full automation: a single shell script orchestrates the complete ROS 2 lifecycle — startup, goal execution, metric capture, and teardown — for every algorithm in sequence
- Interactive dashboard: a Plotly HTML report with per-planner bar charts and a 2D trajectory overlay
This workspace contains two ROS 2 packages:
| Package | Type | Purpose |
|---|---|---|
navbench |
Python (ament_python) |
Benchmark orchestration, metric logging, and analysis |
navbench_planners |
C++ (ament_cmake) |
Custom Nav2 global planner plugin (navbench_planners/CustomAStar) |
- Custom C++ Planner: A production-style Nav2
GlobalPlannerplugin implementing A* with costmap-weighted edge costs, diagonal movement, and fullpluginlibexport — benchmarkable alongside the built-in Nav2 algorithms - Local Planner Benchmarking: Swap between DWB and MPPI controllers via a single launch argument; a dynamic obstacle node moves a cylinder across the robot's path to test reactive avoidance
- End-to-End Automation:
run_all_benchmarks.shmanages the full Nav2 lifecycle — monitoring/planner_serverstate transitions before proceeding to the next algorithm - Interactive Analytics: Pandas + Plotly generate a multi-panel HTML dashboard with mean ± std error bars and a 2D trajectory overlay per planner
- Costmap Parameter Sweeping:
run_costmap_sweep.shsweepsinflation_radiusacross runs to find the mathematically optimal costmap configuration - Unit Tested Math:
pytest/unittestverifies the curvature (mean κ) and Euclidean path length calculations against analytically known ground truth values - DevOps Ready: Multi-stage
Dockerfile, GitHub Actions CI (lint + build + test), andflake8code style enforcement
| Metric | Source | Description |
|---|---|---|
| Planning Time | Action Server | Time for the global planner to compute a path (ms) |
| Execution Time | Action Server | Total time for the robot to reach the goal (s) |
| Path Length | nav_msgs/Path |
Euclidean arc length of the generated trajectory (m) |
| Mean Curvature | Math | Average change in path angle — lower is smoother (κ) |
| Recoveries | /behavior_tree_log |
Count of recovery behaviors triggered (Spin, BackUp, etc.) |
| Mean/Peak CPU | psutil |
CPU utilisation of the Nav2 planner server process (%) |
| Mean RAM | psutil |
Resident memory footprint of the Nav2 planner server (MB) |
NavBench Workspace
├── src/
│ ├── navbench/ # Python package
│ │ ├── navbench/
│ │ │ ├── benchmark_node.py # Async Action Client + metric capture
│ │ │ ├── metrics_logger.py # Pandas + Plotly dashboard generator
│ │ │ └── obstacle_mover.py # Sine-wave dynamic obstacle publisher
│ │ ├── launch/
│ │ │ ├── benchmark.launch.py # Main launch: merges planner + controller YAMLs
│ │ │ ├── dynamic_obstacle.launch.py
│ │ │ └── bringup.launch.py
│ │ └── config/
│ │ ├── planners/ # Per-planner nav2 YAML overrides
│ │ └── controllers/ # Per-controller nav2 YAML overrides (DWB, MPPI)
│ │
│ └── navbench_planners/ # C++ package
│ ├── include/navbench_planners/
│ │ └── custom_astar_planner.hpp
│ ├── src/
│ │ └── custom_astar_planner.cpp # nav2_core::GlobalPlanner implementation
│ └── plugins.xml # pluginlib export
│
├── run_all_benchmarks.sh # Orchestration entrypoint
├── run_costmap_sweep.sh # Parameter sweep entrypoint
├── Dockerfile
└── .github/workflows/ci.yml
Execution flow:
run_all_benchmarks.shloops over all planners, launchingbenchmark.launch.pyfor each- The launch file merges
nav2_params_base.yaml+ the per-planner YAML and starts the full Nav2 stack benchmark_node.py(Action Client) sends waypoint goals, captures metrics via topic subscriptions andpsutil, and saves timestamped CSVs- After all algorithms complete,
metrics_logger.pyaggregates the CSVs and renders an interactive HTML dashboard
sudo apt install \
ros-humble-navigation2 \
ros-humble-nav2-bringup \
ros-humble-turtlebot3-gazebo
pip3 install -r requirements.txtcd ~/Documents/NavBench
source /opt/ros/humble/setup.bash
colcon build
source install/setup.bashPoint the benchmark at your map by setting the NAV_MAP_PATH environment variable:
export NAV_MAP_PATH=~/my_map.yamlDefine goal waypoints in src/navbench/config/waypoints.yaml:
/**:
ros__parameters:
waypoints:
- "0.0,-2.0,0.0" # X, Y, Yaw (radians)
- "2.0,0.0,1.57"./run_all_benchmarks.shThis will sequentially benchmark all six planners (A*, Dijkstra, SMAC 2D, SMAC Hybrid, Lattice, Custom A*) and save CSVs to src/navbench/results/.
ros2 launch navbench benchmark.launch.py \
planner:=custom_astar \
controller:=mppi \
map:=$NAV_MAP_PATHAvailable planners: astar | dijkstra | smac_2d | smac_hybrid | lattice | custom_astar
Available controllers: dwb | mppi
In a second terminal, launch the moving cylinder obstacle while your benchmark is running:
ros2 launch navbench dynamic_obstacle.launch.pyThis spawns a cylinder in Gazebo and runs obstacle_mover.py, which publishes a sinusoidal velocity to move it across the robot's path — stressing the local controller's reactive avoidance.
./run_costmap_sweep.shSweeps inflation_radius across a range of values to find the mathematically optimal costmap configuration for your environment.
python3 src/navbench/navbench/metrics_logger.pyOpens src/navbench/results/benchmark_dashboard.html — an interactive multi-panel Plotly report with per-planner comparisons and a 2D trajectory overlay.
Run the complete suite in an isolated, reproducible container:
docker build -t navbench .
docker run -it navbenchThe navbench_planners package implements a Nav2 GlobalPlanner plugin in C++17 — demonstrating how to write and integrate a custom algorithm into the Nav2 stack at the plugin level.
Key implementation details:
| Aspect | Implementation |
|---|---|
| Algorithm | Priority-queue A* with closed-set bitmap |
| Heuristic | Euclidean distance (admissible, optimal) |
| Edge cost | Move cost + costmap cell cost scaled to [0, 1] |
| Obstacle handling | Skips LETHAL_OBSTACLE and INSCRIBED_INFLATED_OBSTACLE cells |
| Diagonal movement | Configurable via use_diagonal ROS parameter |
| Safety | Signed-arithmetic bounds checking prevents unsigned integer underflow at map edges |
| Integration | pluginlib export via plugins.xml — drop-in compatible with nav2_bringup |
Build only the C++ package:
source /opt/ros/humble/setup.bash
colcon build --packages-select navbench_plannerssource /opt/ros/humble/setup.bash
source install/setup.bash
colcon test --packages-select navbench
colcon test-result --verboseTests validate the analytical correctness of _path_length (3-4-5 triangle → 7 m) and _smoothness (90° turn → κ = √2, straight line → κ = 0).
Warning
Benchmark node hangs at startup
Ensure NAV_MAP_PATH points to a valid YAML map file. Nav2 will not reach the active lifecycle state if the map cannot be loaded.
Caution
CPU / RAM metrics show 0.0
If Nav2 is not running in composition mode, component_container_isolated will not exist. Update the _find_planner_process regex in benchmark_node.py to match the process name on your system.
Note
"Goal rejected" during execution
Your waypoints.yaml coordinates may land inside an obstacle or outside the map bounds. Verify them against your map using RViz.
Note
custom_astar planner not found
Ensure you have built navbench_planners and sourced install/setup.bash before launching.
- Kinematic Constraints: Extend the custom planner to enforce a minimum turning radius for Ackermann-steering vehicles (car-like robot path planning)
- Hardware Deployment: Extend orchestration scripts to run on a physical TurtleBot3 over Wi-Fi
- Algorithmic Profiling: Add Valgrind /
perfflamegraph analysis of the C++ planner to characterise memory allocation and cache behaviour - RRT* / D* Lite Plugin: Implement additional sampling-based and incremental planners as further
navbench_plannersplugins
This project is licensed under the Apache 2.0 License — see the LICENSE file for details.