Reliable, Quick Calibration of PID Speed Controller

We calibrated the PID controller using the Ziegler-Nichols method.  This required us to use solely proportional control and to identify the kp at which the speed control first beings to oscillate.  To speed calibration up, we were able to change kp up and down through the wireless serial so that we could look at the result on the fly without having to redownload the entire code each time (the whole process of the full recalibration only takes about 10 minutes total, which is useful when we need to swap in new hardware and conditions change).  We recalibrated the car for the race to go about twice as fast (roughly 6 ft/sec) and found the first kp to be about 0.05.

Once this value is found we need to figure out the period of oscillation.  To do this, we send the time in 1/10th milliseconds between hall pulses over through serial and plotted it in Matlab.  The time of the period can then be found by adding up all of these time intervals over the length of the period.  Here is a matlab plot of the times, with the identified period highlighted with two red lines:

 

pid_zieglernichols.jpg

The period here was identified to be about 1.1 seconds.  We then use the following equations to determine the proportional, integral, and derivative coefficients:

ku = 0.05, pu = 1.1, kp = 0.6ku, ki = 2kp / pu, kd = kppu / 8

NOTE: This got our car to go about twice the speed it did before, but it didn’t work reliably during the race because we were never able to recalibrate turning well enough to compensate.  Our original values that worked extremely reliably for 3 ft/sec (including compensating perfectly for bumps, etc) were:

Ku = 0.09, kp = 1.3027

Which means that:

Kp = 0.048                    ki = 0.0737                   kd = 0.0078