This project presents the design and simulation of an autonomous wheeled mobile robot capable of lane keeping and reactive obstacle avoidance, developed using ROS 2 Jazzy and Gazebo Harmonic.
The robot autonomously navigates a 10-meter track, avoids static obstacles through lane transitions, and detects a color-coded finish line to complete its mission. The work demonstrates a complete robotics pipeline from SolidWorks CAD design to real-time feedback control in simulation.
The system follows a modular Sense–Think–Act architecture:
- Sense: Camera and GPU LiDAR sensors
- Think: Perception algorithms and finite state machine
- Act: Feedback control and differential drive actuation
- URDF model derived from SolidWorks CAD
- Integrated with ros2_control using
ign_ros2_control - Accurate mass and inertia modeling
Lane Detection
- OpenCV moment-based centroid tracking of the black lane
Obstacle Detection
- GPU LiDAR (ultrasonic-style range filtering)
Finish Line Detection
- HSV-based segmentation for green line recognition
- 5-state Finite State Machine (FSM)
- Handles lane following, obstacle avoidance, and recovery
- Proportional (P) Controller
- Steering correction based on visual lateral error
- Designed in SolidWorks for mechanical realism
- Geometry simplification for stable physics simulation
- Exported as STL meshes
- Manual migration to ROS 2 Jazzy / Gazebo Harmonic
- Added modern sensor plugins and
ros2_controltags
Lateral Error Definition
Let the image width be ( W_{\text{image}} ) and the detected lane centroid be ( C_x(t) ):
Control Law
Parameters
- Proportional gain:
K_p = 0.005
- Constant linear velocity:
v_x = 0.2 m/s
| State | Action | Trigger Event |
|---|---|---|
| FOLLOW_LANE_1 | PID lane tracking | Obstacle distance < 0.5 m |
| SWITCH_LEFT | Open-loop arc maneuver | Timer > 4.0 s |
| FOLLOW_LANE_2 | Adjacent lane tracking | Obstacle distance < 0.5 m |
| SWITCH_RIGHT | Open-loop return maneuver | Lane / finish visible |
| FINISH | Deceleration and stop | Green area > threshold |
ros2 launch autonomous_rob auto_rob.launch.py world:=project_world.sdf
### Start Autonomous Controller
ros2 run autonomous_rob phase2_node
🛠️ Built With
SolidWorks – Mechanical Design & CAD
ROS 2 Jazzy – Middleware & Control
Gazebo Harmonic – Physics Simulation
OpenCV – Computer Vision & Perception
✅ Conclusion
This project demonstrates a complete autonomous navigation pipeline for a differential drive robot. The modular ROS 2 architecture enabled robust lane following, reliable obstacle avoidance, and accurate mission completion in simulation.