IN THIS LESSON

Main objective:

Understand how robots use sensors to detect road markings and implement a basic line-following algorithm inspired by Lane Keeping Assist systems in modern cars.

Topics covered:

  • Line-detection sensors: Overview of different sensor types used for line following, including optical, magnetic, camera-based and touch sensors.

  • Reading sensor data: Practically retrieving and interpreting readings from the robot's sensors.

  • External lighting: Observing how changes in ambient lighting affect sensor readings and line detection.

  • State machines: Understanding what state machines are, how they work and when they are useful in robotics.

  • Bang-bang line-following algorithm: Programming a state machine to control the robot's movement as it follows a line.

Outcome:

The robot is able to follow a line using a simple bang-bang algorithm. Moreover, students will understand why PID controllers are needed and know how to apply the Ziegler–Nichols method to select PID parameters and control-loop frequency.

Voluntary Homework:

Fine-tune the robot's speed values to improve its line-following behaviour.