This video shows a robot which is trying to centralise the sensor on the white line.
It drives the motors according to the position over the line.
The potentiometer on the right (That gets adjusted) controls how much derivative is added to the sensed position.
If zero, it uses the current position
If more than zero, it uses a prediction of the expected position some short time in the future.

Derivative



This is intended to increase stability.
The instability is caused by the time delay between sensing the position over the line
and the speed changes actually resulting from the changes in motor voltages.
The technique requires storing the sensor reading from a previous sample
(10 ms or so) and combining that with the current reading, to calculate a future reading.

To predict a value, you measure the change from "last" reading to "this" reading.
Then add this value to "this" reading, and you get a prediction of "next" reading.
For extra effect you can multiply the extra to be added by a constant (called Kd).

A typical Derivative implementation is to calculate a "corrected" version of the sensor reading,
which is a prediction of a future value.
Corrected = (presentValue - previousValue) * Kd + presentValue
- Where Kd can be an integer value up to about 10.
------------------------------------


© Copyright St Albans Robots