Ongoing Jun 2026 – Present

ROS 2 Vision-Based Autonomous Line Following Robot

A ROS 2 mobile robot that follows a line using nothing but a camera and a modular perception-to-control pipeline.

ROS 2 Vision-Based Autonomous Line Following Robot

Have a photo or video of this project? Send it over and I'll add it here.

Overview

This is a personal project to build a proper ROS 2 stack from scratch rather than relying on simple analog line sensors. A Raspberry Pi 5 runs the core ROS 2 graph, receiving frames from a camera and processing them through an OpenCV-based image pipeline to detect the line's position and curvature in real time.

Rather than one monolithic control script, the system is split into modular ROS 2 nodes — one for image processing and line detection, one for decision-making (translating detected line geometry into a target heading), and one for motion control that converts that heading into differential drive commands for the N20 motors, coordinated through an ESP32.

The modular node structure means each part of the pipeline — perception, decision, and control — can be tuned, tested or swapped independently, which has made it much easier to debug failure modes (e.g. lighting changes) in isolation.

Key Features

  • 01Camera-based real-time line detection and curvature estimation using OpenCV
  • 02Modular ROS 2 node architecture: perception, decision-making, and motion control as separate nodes
  • 03Runs on Raspberry Pi 5 with an ESP32 handling low-level motor control
  • 04rclcpp-based nodes for low-latency C++ performance in the perception pipeline
  • 05Designed to be extensible toward more complex path-following and obstacle-avoidance behaviors