Quote:
Originally Posted by reversed_rocker
when we built our crab drive, one problem we had was that the motor would over shoot the intended position, then try to swing back, and the process repeats.
|
This is a classic controls problem. You guys have implemented a "P" controller. Adding a derivative term will help, and make it a "PD" controller. One way to tune the system is to increase Kp until it gets pretty close to oscillating constantly, and then increase Kd until it doesn't overshoot any more. If at any point it starts acting "funny", decrease the constant some. One thing that really helps is to get back the position data at each point in time and then plot it.
I believe that there are some white papers around, but until I finally got the chance to take a controls class and talk with someone who does controls for a living, I had a little trouble with tuning the loops too.
I've used the following successfully many times in the past.
Code:
power = Kp * error + Kd * (error - last_error)