I made it finally
After 8–10 days of struggles and debugging, I finally managed to build a closed-loop vision-based line follower robot using ROS2, URDF, and Gazebo.
The hardest part for me wasn’t designing the robot or making it move, but actually using the camera sensor to detect the track and make the robot follow it. Initially I thought I would need to deeply learn OpenCV, but for this project I ended up needing only a handful of functions, which I learned along the way.
I also reused some ideas from my first ROS2 project (a turtle follower), especially integrating PID control for smoother turning behavior. The bot still struggles a bit with sharp 90° turns, probably due to PID tuning or camera resolution/FOV limitations, but overall the tracking is fairly stable.
The project uses:
- ROS2
- Gazebo
- URDF
- OpenCV + cv_bridge
- PID control
- Camera-based centroid tracking using image moments
(i used chatgpt to organise the uses into points)
(will add github link later-on)