Line follower simulator

The applet simulates a line following robot. It demonstrates how changes in robot's geometry and adjusting PID constants affect the line following performance.


Robot model

A model of differential driven wheeled robot is implemented. The width of the line sensor, the line sensor position and the wheel gauge (distance between the two wheels) can be adjusted.

Apart from the geometry settings, there is also a possibility to adjust the motor behavior. The "acceleration" scrollbar sets how quickly the robot chassis reacts to commands form the PID regulator.

PID regulator and line following

The PID abbreviation stands for proportional–integral–derivative controller. The PID controller adjusts the motors’ speed according to the actual line deflection and previous states. In other words, the PID controller should drive the robot in a way that the line is always centered to the middle of the sensor module, so that the robot performs smooth line following. The line position is evaluated periodically, with a frequency set in the "Update frequency" box.

In case the line is lost (there is no line under the sensor module, eg. the line segment doesn't cross the curve), the robot stops one of its wheels while the second keeps turning, so that the robot rotates in direction where the line was seen last.

The guideline and the line sensor

Joined cubic Bezier curves represent the guideline. The line sensor is represented as a line segment. A point of intersection between the line segment and Bezier curves is calculated effectively; using a coordinate transformation and then by finding roots of cubic polynomial.

The Line follower simulator project


Ondřej Staněk,
published 29.7. 2010
updated: 18.8.2010