Professional 8-package ROS 2 Humble architecture for 2D path smoothing, trajectory generation, and trajectory tracking on TurtleBot3 Burger in Gazebo Classic simulation β with safety watchdog, dynamic reconfiguration, and rich RViz visualization.
Complete system demonstration showing trajectory tracking, velocity profiles, and test results.
Key Results:
- 5 waypoints β 200 smoothed path points β 508 trajectory points
- Mean tracking error: 0.74 cm (well under 5cm threshold)
- 64 unit tests + integration tests: 100% PASS
- Path duration: 25.35 seconds at v_max = 0.18 m/s
πΉ Animation Video β 5-second visualization of robot following trajectory
| Component | Points | Algorithm |
|---|---|---|
| Path Smoothing | 25 | Cubic Spline (Thomas algorithm) + B-Spline Gradient Descent |
| Trajectory Generation | 25 | Trapezoidal Velocity Profile (curvature-limited, arc-length parameterized) |
| Trajectory Tracking | 25 | Adaptive Pure Pursuit + PID (goal deceleration, action server) |
| Code Quality & Testing | 15 | 64 unit tests + lint, Strategy/Factory patterns, zero-ROS core |
| Documentation & Demo | 10 | Algorithms doc, design decisions, extension guides |
ββββββββββββββββββββββββ
β smooth_nav_bringup β β Master launch (orchestrator)
ββββββββββββ¬ββββββββββββ
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
βΌ βΌ βΌ
smooth_nav_simulation smooth_nav_ros smooth_nav_controller
(Gazebo + worlds) (Service nodes) (Action server)
β βββββ΄ββββ β
β βΌ βΌ βΌ
β Smoother Generator Trajectory Tracker
β Service Service /execute_trajectory
β β β β
β βββββ¬ββββ β
β βΌ β
β smooth_nav_core ββββββββββββββββββ
β (Pure C++17, zero ROS)
β β
βΌ βΌ
smooth_nav_description smooth_nav_msgs
(URDF, RViz config) (Custom messages)
βββββββββββββββββββββββββββββββββββ
β waypoint_client_node β β Pipeline orchestrator (Python)
β reads YAML β calls services β
ββββββββ¬βββββββββββ¬ββββββββββββ¬ββββ
β β β
SmoothPath GenerateTraj ExecuteTraj
Service Service Action
β β β
βΌ βΌ βΌ
path_smoother traj_gen traj_tracker
_node _node _node
β β β
ββββββ¬ββββββ β
βΌ βΌ
smooth_nav_core /cmd_vel_raw
(Pure C++17) β
βΌ
safety_watchdog
_node (Python)
β
βΌ
/cmd_vel β Robot
- Docker β₯ 20.x (Docker Desktop on Windows/macOS)
- VcXsrv or XQuartz (X Server for GUI β Gazebo/RViz2)
cd docker
docker compose build dev
docker compose run --rm devsource /opt/ros/humble/setup.bash
cd /ros2_ws
colcon build --symlink-install
source install/setup.bash# Start VcXsrv first (Windows) with "Disable access control" checked
# Option A: Full sim + auto-running pipeline
ros2 launch smooth_nav_bringup demo.launch.py
# Option B: Sim only (call services manually)
ros2 launch smooth_nav_bringup smooth_nav.launch.py
# Option C: Choose a waypoint set
ros2 launch smooth_nav_bringup demo.launch.py waypoint_set:=figure_eightcolcon test --packages-select smooth_nav_core --return-code-on-test-failure
colcon test-result --verbose./scripts/run_tests.sh| Package | Purpose |
|---|---|
smooth_nav_msgs |
Custom .msg, .srv, .action definitions |
smooth_nav_core |
Pure C++17 algorithms β zero ROS deps, GTest tested |
smooth_nav_ros |
ROS 2 service nodes (SmoothPath, GenerateTrajectory) |
smooth_nav_controller |
ROS 2 action server (ExecuteTrajectory) |
smooth_nav_description |
TurtleBot3 URDF, RViz config |
smooth_nav_simulation |
Gazebo worlds + launch |
smooth_nav_bringup |
Master launch files, waypoint configs |
smooth_nav_tests |
Integration & system-level tests |
RoboticsAssignment/
βββ .github/workflows/ # CI/CD (build, test, lint)
βββ docker/
β βββ Dockerfile.dev # Full development image
β βββ Dockerfile.ci # Headless CI image
β βββ docker-compose.yml # dev, test, sim services
β βββ entrypoint.sh
βββ docs/
β βββ algorithms.md # Mathematical details
β βββ design_decisions.md # Architecture rationale
β βββ real_robot_extension.md # Physical TurtleBot3 guide
β βββ obstacle_avoidance_extension.md
βββ scripts/
β βββ setup_workspace.sh # Build + test helper
β βββ run_tests.sh # All-tests runner
β βββ visualize_trajectory.py # Matplotlib plots
β βββ record_bag.sh # ROS 2 bag recorder
βββ src/
β βββ smooth_nav_msgs/ # Messages, services, actions
β βββ smooth_nav_core/ # Pure C++17 algorithms + GTests
β βββ smooth_nav_ros/ # Service wrapper nodes
β βββ smooth_nav_controller/ # Action server node
β βββ smooth_nav_description/ # URDF, RViz, meshes
β βββ smooth_nav_simulation/ # Gazebo worlds + launch
β βββ smooth_nav_bringup/ # Master launch + configs
β βββ smooth_nav_tests/ # Integration & system tests
βββ .clang-format
βββ .pre-commit-config.yaml
βββ CHANGELOG.md
βββ README.md
| Pattern | Where | Why |
|---|---|---|
| Strategy | IPathSmoother, ITrajectoryGenerator, IController |
Swap algorithms via YAML config |
| Factory | SmootherFactory::create(type) |
Instantiate strategies by name |
| Interface Segregation | Separate abstract interfaces | Each node depends only on what it uses |
| Config Over Code | YAML params loaded at launch | Tune without recompiling |
| Pipeline Orchestrator | waypoint_client_node |
Sequences Smooth β Generate β Execute |
| Safety Interposer | safety_watchdog_node |
Transparent /cmd_vel_raw β /cmd_vel filtering |
| Dynamic Reconfiguration | All C++ nodes | add_on_set_parameters_callback for live tuning |
All parameters are dynamically reconfigurable via ros2 param set or rqt_reconfigure β no restart required.
| Parameter | Default | Description |
|---|---|---|
smoother_type |
cubic_spline |
cubic_spline or bspline |
num_smooth_points |
200 | Interpolation density |
bspline_weight_data |
0.1 | B-spline data fidelity weight |
bspline_weight_smooth |
0.3 | B-spline smoothness weight |
| Parameter | Default | Description |
|---|---|---|
generator_type |
trapezoidal |
trapezoidal or constant |
max_velocity |
0.18 m/s | Target cruise speed |
max_acceleration |
0.5 m/sΒ² | Trapezoidal ramp rate |
max_lateral_acceleration |
0.5 m/sΒ² | Curvature-based speed limiting |
time_step |
0.05 s | Trajectory sampling period |
| Parameter | Default | Description |
|---|---|---|
look_ahead_distance |
0.3 m | Pure Pursuit base |
adaptive_look_ahead_gain |
0.5 | $L_d = L_{d,base} + k \cdot |
goal_deceleration_radius |
0.3 m | Linear deceleration zone before goal |
goal_tolerance |
0.08 m | Completion threshold |
pid_kp / ki / kd |
1.0 / 0.0 / 0.1 | Cross-track PID gains |
control_rate |
20.0 Hz | Controller loop frequency |
| Parameter | Default | Description |
|---|---|---|
max_linear_velocity |
0.22 m/s | Hardware velocity limit |
max_angular_velocity |
2.84 rad/s | Hardware angular limit |
max_linear_acceleration |
0.5 m/sΒ² | Jerk-free acceleration limit |
cmd_vel_timeout |
0.5 s | Emergency stop if no command |
use_laser_safety |
false | Enable proximity obstacle stop |
obstacle_stop_distance |
0.20 m | LaserScan stop threshold |
| Service | Type | Node |
|---|---|---|
~/smooth_path |
smooth_nav_msgs/SmoothPath |
path_smoother_node |
~/generate_trajectory |
smooth_nav_msgs/GenerateTrajectory |
trajectory_generator_node |
| Action | Type | Node |
|---|---|---|
~/execute_trajectory |
smooth_nav_msgs/ExecuteTrajectory |
trajectory_tracker_node |
| Topic | Type | Node |
|---|---|---|
/smoothed_path |
nav_msgs/Path |
path_smoother_node |
/original_waypoints |
visualization_msgs/MarkerArray |
path_smoother_node |
/curvature_markers |
visualization_msgs/MarkerArray |
path_smoother_node |
/trajectory_path |
nav_msgs/Path |
trajectory_generator_node |
/velocity_profile |
visualization_msgs/MarkerArray |
trajectory_generator_node |
/cmd_vel_raw |
geometry_msgs/Twist |
trajectory_tracker_node |
/actual_path |
nav_msgs/Path |
trajectory_tracker_node |
/tracking_error |
std_msgs/Float64 |
trajectory_tracker_node |
/controller_diagnostics |
smooth_nav_msgs/ControllerDiagnostics |
trajectory_tracker_node |
/velocity_command_markers |
visualization_msgs/MarkerArray |
trajectory_tracker_node |
/cmd_vel |
geometry_msgs/Twist |
safety_watchdog_node |
/safety_status |
std_msgs/String |
safety_watchdog_node |
/pipeline_status |
std_msgs/String |
waypoint_client_node |
/waypoint_markers |
visualization_msgs/MarkerArray |
waypoint_client_node |
/trajectory_markers |
visualization_msgs/MarkerArray |
waypoint_client_node |
See demo_poster_hires.png for publication-quality image.
5 raw waypoints are transformed into 200 smoothed points using cubic spline interpolation with CΒ² continuity.
Trapezoidal velocity profile respects robot limits (v_max = 0.18 m/s, a_max = 0.5 m/sΒ²).
Pure Pursuit + PID controller achieves < 5cm cross-track error.
Linear and angular velocity commands sent to robot during trajectory execution.
Smoothing eliminates curvature discontinuities at waypoint transitions.
64 unit tests + 1 lint test = 65 total tests, all passing.
For detailed test results, see Test Report.
- 64 unit tests in
smooth_nav_core(cubic spline, trapezoidal velocity, pure pursuit, PID, geometry utils) - 1 lint test for XML validation
- Integration tests in
smooth_nav_tests(smoother service, generator service, tracker action) - System launch test (verifies all nodes start and advertise interfaces)
# Unit tests only
colcon test --packages-select smooth_nav_core
# All tests
colcon test --return-code-on-test-failure
colcon test-result --verbose- Algorithms β Mathematical derivations and formulations
- Design Decisions β Architecture rationale
- Real Robot Extension β Sim-to-real guide
- Obstacle Avoidance Extension β Adding reactive avoidance
Academic assignment β University use only.






