View Single Post
  #13   Spotlight this post!  
Unread 27-09-2016, 18:25
wesleyac's Avatar
wesleyac wesleyac is offline
Registered User
AKA: Wesley Aptekar-Cassels
FRC #1678
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Davis, CA
Posts: 45
wesleyac is a glorious beacon of lightwesleyac is a glorious beacon of lightwesleyac is a glorious beacon of lightwesleyac is a glorious beacon of lightwesleyac is a glorious beacon of light
Re: Tuning PID Constants Over a Range

I would agree that motion profiling + feed forward will help a lot. 254 and 971 did a great video on this at champs in 2015 (https://www.youtube.com/watch?v=8319J1BEHwM).

The process that we used for tuning our turning went something like this:

1.) Write and test motion profile code (graph it to make sure that it is actually doing what it is supposed to).
2.) Find motion profile parameters. We used trapezoidal motion.
2a.) You can find the maximum velocity by sending 12v to both motors and looking at the maximum slope of the line.
2b.) From the same plot of the velocity, you can run a regression to get the acceleration.
2c.) You should set you FF parameters to something slightly lower than the actual values - as the season wears on, your robot will get less efficient, and you don't want to ask your robot to follow a profile that it's incapable of following.
3.) Find FF parameters
3a.) You can use the dynamics of the system to calculate what these should be, but we found that for turning, they ended up being fairly inaccurate (probably wheel scrub + static friction were a lot of that. pneumatic wheels can be a pain ) We started with calculated values, and tuned them by hand until they largely matched the motion profile. Again, having plots of angle over time as well as target angle over time on the same axes helps hugely here. If you don't have some system to graph variables over time, make one! it will save time in the long run. Test every change with multiple values.
4.) Start tuning PID. There are many different strategies for this. The one that you are using looks fine. Test every change for a range of values (90deg, 25deg, 10deg, 5deg, 2deg, etc. This also applies to tuning the FF values.) Again, graph everything. You can very easily see the effects of changing PID parameters from the graphs.

Another thing to consider it when you want to terminate the loop. If you don't need to be very accurate (for example, in an initial turn before starting vision), then don't have strict termination conditions. Also, if you have problems with the robot continuing to turn after the profile is over, consider adding a minimum derivative as a termination condition.

If you have any questions, feel free to ask.
__________________
Quote:
Originally Posted by The programming team
Define "works."

Last edited by wesleyac : 27-09-2016 at 18:40. Reason: Pushed submit too early :o
Reply With Quote