|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Tuning PID Constants Over a Range
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): 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. |
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||||
|
|||||
|
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)
|
|
#4
|
|||
|
|||
|
Re: Tuning PID Constants Over a Range
Quote:
|
|
#5
|
|||
|
|||
|
Re: Tuning PID Constants Over a Range
Yes, but he's proposing that the output of the position PID and (maybe) profile would be a velocity to feed to the velocity PID running on the talon.
|
|
#6
|
|||
|
|||
|
Re: Tuning PID Constants Over a Range
So run a traditional PID control loop with the Gyro as the input and a fake output that sends a target velocity to the velocity PID on the talons?
|
|
#7
|
|||||
|
|||||
|
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 / 2 left_motor_desired_linear_velocity = -drive_wheel_linear_velocity right_motor_desired_linear_velocity = +drive_wheel_linear_velocity To 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). Last edited by Jared Russell : 29-09-2016 at 11:58. |
|
#8
|
||||
|
||||
|
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 |
|
#9
|
|||
|
|||
|
Re: Tuning PID Constants Over a Range
And by L (wheelbase) you mean contact patch (I think that's the terminology Hibner used)? So, for most teams it would be either the distance between the inner 2 sets of wheels (4/8wd) or the distance between the sets of wheels that the CoM is between (6/10wd). I'm going to ignore the option of a moving CoM because it's going to make my head hurt.
|
|
#10
|
||||
|
||||
|
Re: Tuning PID Constants Over a Range
...
|
|
#11
|
|||
|
|||
|
Re: Tuning PID Constants Over a Range
Yes, I know the traditional definitions. Perhaps a better question would be, do I measure wheel base as the distance from the front wheel to the back wheel or do I measure it from the front wheel that touches to the back wheel that touches for drop center drive systems?
|
|
#12
|
||||
|
||||
|
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. Last edited by Ether : 29-09-2016 at 14:17. |
|
#13
|
|||||
|
|||||
|
Re: Tuning PID Constants Over a Range
Yep, and this is the equation we actually used as our starting point (using the track width and wheelbase length of our inner four wheels). Our CoG was within an inch or two of the geometric center (ignoring dynamics). We found that even with this correction, we were ~50% off of the true value (a bit unsurprising since even though our outside wheels were raised, they still bore some weight because of deflection of our 15-20 PSI inner wheels).
|
|
#14
|
|||
|
|||
|
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.
|
|
#15
|
||||
|
||||
|
Re: Tuning PID Constants Over a Range
Don't forget that you are tuning an electro-mechanical system.
For example if it is too hard to (begin) a turn then tuning the servo, by any means, is very difficult. This past year things like proper inflation of the pneumatic tires made all the difference (we were running Austin's state-space code). An arm-like mechanism that takes much more power to move up than down is also very difficult to tune - so balance the motion against gravity with a gas shock or surgical tubing. Set yourself up for success with good mechanical design, software can only do so much! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|