|
Re: PID Loop Question
How I tuned the gain of our drivetrain, on a practice bot (to get the code right):
1. Run the robot in each direction to determine the maximum forward/reverse speed of the slower side (since that limits the forward/reverse speed)
2. Setup LabVIEW to graph the Sensor, Setpoint, Delta, and Output (basically just open the VI that shows the graph, and open the constants VI as well)
3. Set the gain to a known in-range number (in my case, that was 0.01)
4. Jack up the gain until the graphs show a reasonable rise time and minimum overshoot.
5. Decide if I need to write a gain scheduler (and I decided to, so I did write a linear gain scheduler)
6. Tune the gains again (go back to 4) for each end of the spectrum, and check that the performance is good in all zones
7. See how the extreme and precise response is, and decide what to do about those. I found that with an I only, the robot backs up slightly when stopping (integral windup), so I wrote some code to handle sign mismatches between setpoint and sensor differently.
8. Drive it again and tune, repeat until perfect.
On the chassis I tested (34 lbs chassis w/ everything but 1 front bumper and the battery, + 50lbs in weights) with 6" kit wheels and a 1-speed, I was fine with 1 set of constants. I assume I will need to tune High and Low separately, but that comes when the robot is done.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|