![]() |
Re: Tuning PID Constants Over a Range
Quote:
I love playing with control systems, and like pushing the limits. That being said, I don't recommend using the controllers we use unless you have a strong math background and time to learn what is going on. The Talon SRXs have good support for all of this as well. |
Re: Tuning PID Constants Over a Range
1 Attachment(s)
Wesley did a great job of summarizing our process for tuning, but I'd like to add a few things, especially with respect to the trapezoidal motion component:
Quote:
2b) The regression that Wesley is referring to is an exponential regression against the solution to the second-order differential equation that the drivetrain (theoretically) should follow: x'' = ax' + bu where x is distance (or angle - we controlled angle and distance with two separate controllers) and u is voltage, assumed to be constant at 12V. You basically just collect a bunch of data and then do a regression on that to find the constants a and b. You can also not bother with this part for acceleration and just try to manually tune constants, which can work just as well or better in some cases but can require more time. 2c) You definitely need to set the motion profile's acceleration and velocity parameters to lower than the maximum, but not only because of wear/tear/battery voltage/other pesky things that happen in the real world. If you set the velocity to the maximum the robot can possibly go, you will not be able to actually control it when it is going that speed - to properly control a system, you should not be saturating its inputs or the system and controller will respond in a pretty strange manner (nonlinearities are unlikely to play well with PID controllers), being "less responsive" when moving at full speed than when accelerating or decelerating. In addition, the end of the acceleration period will get cut off and will not act nicely (the middle plot is velocity and the bottom plot is voltage): Attachment 21083 3a) I don't have anything to add on this point, but I just wanted to emphasize how important it is to have some way to visualize everything that's happening on your robot. Not only for tuning purposes, but for debugging as well - log everything you can in some way; it will serve you well when you are tearing your hair out over some strange bug. |
Re: Tuning PID Constants Over a Range
One more idea is to use PID alone for small movements (like < 5 deg) and motion profile (w/ PID position control) for larger turns. If you tune your controller for using motion profile the gains will be relatively high and should work well for small angle corrections.
|
Re: Tuning PID Constants Over a Range
I agree that a motion profile + feedforward to overcome static friction can solve this problem adequately for FRC purposes. However, the Talon SRX makes precise 1KHz velocity control stupidly easy to achieve; hiding the stiction nonlinearity behind a Talon and using plain old position PID is just as workable a solution these days. (But is still improved by using a motion profile of course)
|
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
Quote:
* For differentially steered robots, this equation looks something like: Code:
drive_wheel_linear_velocity = wheelbase_width_meters * desired_turning_rate_rads_per_second / 2To tune this, start with the Talon SRX velocity loop and work backwards. Make sure you can accurately track a variety of speeds (both fast and slow) in straight line, turn in place, and arcing motions. We were able to find that one set of gains did a good job in all of these cases, but YMMV. Once you can accurately track your velocity commands, tune your kinematics by adjusting the equation's corrective factor while turning in place (ex. command each side of the drive to go +/- a couple feet per second and measure the actual turning rate with the gyro...repeat and find the best fit for your model). Finally, you can then tune the gyro PID loop (which will be really easy, likely P-only, because of the fast velocity loop underneath). |
Re: Tuning PID Constants Over a Range
Quote:
S = (1+f2)(W/2)ω S is drive wheel linear speed W is trackwidth ω is desired turning rate in radians per second f the the ratio L/W, where L is wheelbase |
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
2 Attachment(s)
...
|
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
for 6WD drop-center skidsteer with most of the weight over the center wheels "f" is essentially zero so it reduces to Jared's formula. |
Re: Tuning PID Constants Over a Range
Quote:
|
Re: Tuning PID Constants Over a Range
If all you're doing is tuning a turn-to-angle loop, though, do you really need to take the extra step to figure out the proper scaling factor for turning rate? You could just "absorb" that constant (whatever it is) into the value of p.
|
| All times are GMT -5. The time now is 05:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi