PID loop for line follower - EasyC V4

Can anyone help me in understanding how a PID loop works? I sort of get what they do by reading this article.
http://robotics.org.nz/tips-and-tricks/46-vex/62-line-following-with-robotc

Also, does anyone have a sample code for one they can give me? I checked out the sample one from EasyC but it is still confusing.
Help would be appreciated!!!

This is a good article to read. It is for NXT but the concept remains the same.

I am in the process of reading it and sort of get the concept, still not having a great hold on it though. Do you know of any other readings/sites/articles?

This was very helpful – thank you!

This a such a long paper!!! i am about 1/3 the way through it (not even fully understanding yet) and my brain is like jelly.

I did this a few years ago with 5 sensors I created a formula that took the analog value from all of the sensor and computed how far on/off the line the robot was.

Left-Outside = GetAnalog(1) - LeftOutsideZeroValue;
LeftInside = GetAnalog(2) - LeftInsideZeroValue;
RightOutside = GetAnalog(3) - RightOutsideZeroValue;
RightInside = GetAnalog(4) - RightInsideZeroValue;

I did something like: Direction = (LeftOutside2) + LeftInside + (RightInside-1) + (RightOutside*-2)

Speed = GetAnalog(5) - MiddleSensorZeroValue;

You need to get the no line value from each sensor at startup . Then subtract that from the actual reading so the sensor returns 0 off the line and a number on the line. One side should be positive and the other should be negative. The middle most sensor should only be used for speed.

As a note I’ve been told the new Revision of the line following sensors are smaller and track standard electrical tape better. If you have the old rev sensors use wider electrical tape to avoid dead zones.

Another PID paper that’s quite good.

http://igor.chudov.com/manuals/Servo-Tuning/PID-without-a-PhD.pdf

google search for
tuning PID loop
shows some pocket guides with useful information on setting PID parameters, once it is coded.

Also, just as a side note P - Proportional is usually good enough.

I found two excellent books that explain PID Control using LEGO Mindstorm and Rugwarrior based robots. The books are “MOBILE ROBOTS: Inspiration to Implementation” by Joseph L. Jones and Anita M. Flynn and “Robotic Explorations” by Fred G. Martin. The concepts and examples are easily applied to VEX.