An autonomous ROS 2 navigation stack for the TurtleBot3 Waffle in Gazebo that integrates SLAM-based mapping, Nav2 path planning, and predictive avoidance of dynamic obstacles. Uses a C++ perception pipeline (DBSCAN clustering, Hungarian data association, constant-velocity Kalman filter) to track moving obstacles from LiDAR and a custom Nav2 costmap plugin to inflate cost along their predicted trajectories.
ROS 2 Jazzy · C++ · Gazebo Harmonic · Nav2 · SLAM Toolbox · AMCL · TF2 · pluginlib · DBSCAN · Hungarian algorithm · Kalman filter · Eigen3
All packages live under src/.
reactive_avoider(C++) — Standalone sector-based reactive controller. Subscribes to/scanand publishes/cmd_velon a 20 Hz timer, stopping and rotating when obstacles enter a configurable forward safety arc.dynamic_obstacle_tracker(C++) — Multi-object LiDAR tracker. Pipeline: DBSCAN segmentation of/scanreturns → Hungarian assignment of clusters to existing tracks → per-track Kalman filter (constant-velocity model). Publishes/tracked_obstacles(customTrackedObstacleArraymessage with position, velocity, and covariance) and aMarkerArrayfor RViz.predictive_costmap_layer(C++) — Nav2 costmap plugin registered viapluginlib. Consumes/tracked_obstaclesand inflates cost along each obstacle's predicted trajectory, so Nav2's planner routes around where obstacles will be, not just where they are. Loaded into the layered costmap alongside the static and obstacle layers.avoidance_bringup— Launch orchestration, Nav2 and SLAM Toolbox parameter YAML, RViz configs, maps, and Gazebo SDF models (including a moving obstacle for exercising the predictive pipeline).
- Ubuntu 24.04
- ROS 2 Jazzy with Gazebo Harmonic
- TurtleBot3 and Nav2 packages:
sudo apt install ros-jazzy-turtlebot3* ros-jazzy-nav2-bringup \ ros-jazzy-slam-toolbox ros-jazzy-ros-gz export TURTLEBOT3_MODEL=waffle
cd robo-sim
colcon build --symlink-install
source install/setup.bashOpen four terminals; re-source install/setup.bash in each.
# Terminal 1 — Gazebo simulator with TurtleBot3 Waffle
ros2 launch avoidance_bringup sim.launch.py
# Terminal 2 — SLAM Toolbox (online mapping)
ros2 launch avoidance_bringup slam.launch.py
# Terminal 3 — Nav2 with the predictive costmap layer
ros2 launch avoidance_bringup nav.launch.py
# Terminal 4 — spawn a moving obstacle to exercise the tracker
ros2 launch avoidance_bringup spawn_moving_box.launch.pySend a goal via the Nav2 Goal tool in RViz.
To run the standalone reactive avoider instead of the full Nav2 stack:
ros2 run reactive_avoider reactive_avoidersrc/
├── avoidance_bringup/ # launch files, params, maps, RViz, SDF models
├── reactive_avoider/ # standalone reactive obstacle avoidance node
├── dynamic_obstacle_tracker/ # LiDAR-based multi-object tracker
└── predictive_costmap_layer/ # Nav2 costmap plugin consuming tracked obstacles
docs/ # design notes and references