Auto-tune PID controller

[Code]

While designing any PID-based control system, everybody come across the problem of finding the right Kp, Ki, and Kd values which will keep the system stable, and produce least amount of error.

"Traditional way" of finding those three values, can be found here. But there is better way.

This algorithm is called as "coordinate ascent" or some call it as "twiddle". I learned this algorithm in CS373 - AI for Robotics. Explanation of twiddle algorithm can be found here.

This algorithm was used inĀ Stanford's robot "Stanley" - an autonomous car, who won DARPA Grand Challenge 2005.

So I decided to implement it on my old line follower, running on ATmega16 @ 16 MHz.

Complete code can be found here.

I tried shooting video of line tracer learning those three values. But it was very quick, in order of milliseconds. Anyway here is a video of my line tracer initialized with zeros.
(Those oscillations are due to my poor crafting skills - that black tape was out of order)


* I will try to upload another video capturing slow motion of robot learning those 3 values.