PID Tuning

THE PID ALGORITHM

The MoveCar myblock uses a PID algorithm to control each motor, however the NXT-g software actually uses a PID algorithm to control each motor as well.

After you've run GenerateTextFiles.rbt or GenerateTextFiles2.rbt on each NXT, the PID constants are generated as text files on the NXT car. The PID text files are aptly named Kp.txt, Ki.txt and Kd.txt. The default settings for version 1 are Kp = 1.41, Ki = 3.6, and Kd = .07. For version 2, kp = 1 and the rest are set to zero since percent error correction rocks!

I have made manual tuning programs called pidTVA.rbt and pidTVA2.rbt which use the input screen of the NXT to tune the PID parameters. You simply change the PID parameters, then enter a time, initial velocity and acceleration to test how well the car performs with those parameters.

If you would like to tune the 1st version PID parameters but simply simulate the results (without having to run the car to check the results each time), I have created a Google Spreadsheet that can do that. Open the spreadsheet, make a copy, and go nuts! The results have proved interesting but not highly accurate to the cars.