PID Arm Not reaching setpoint

Our team was able to get motion magic to work on both our arm and elevator systems. However, we’re having some issues with reaching the desired encoder value. On both the arm and elevator, whenever we want to raise the arm to a higher setpoint, they accelerate/deaccelerate until they reach a value that’s a few hundred or so ticks below what we want, basically stopping at too low a value. However, the motor is still trying to turn; after a few seconds, the motor is able to slowly actuate to the desired position, sometimes even overshooting the position. Basically we want the arm and elevator to reach the position, instead of stopping below it and then slowly moving upwards. Is there any way to fix this?

Sounds like you P-gain is too high. Maybe try decreasing it and see what happens?

I’ll try it when mechanical is done making changes do the robot. Just curious, what would decreasing P do/why would it fix it?

Essentially, the P-gain controls how fast you want your systems to reach their set points. A higher P-gain causes whatever system you’re tuning to move faster to its set point and with more oscillation. The lower it is, the system moves more slowly and with less oscillation.

The problem isn’t with the oscillation though. The problem is that it stops just below the position, then moves painfully slow upwards to the desired spot. Do you think that decreasing P would fix that?

Sorry, I’m rereading your description now, and it looks like your arm isn’t moving to its set point fast enough, right? If so, then increasing P should make the arm move faster to its position. After this, if you experience oscillation, increasing D should smooth out the motion.

Yup, P first just until you start to get steady state oscillation, then D to eliminate the oscillations. Then, if it’s not good-enough, use I to correct for steady-state gain (though I’m not 100% sure how this ends up working with motion magic).

Alternately to I, you could look into using an arbitrary feed-forward term to account for gravity (presumably you’re currently undershooting?).

After you’ve tuned, be sure to test impulse disturbances (like, wack the arm with a stick) to ensure you can’t induce unstable oscillation.

What order did you determine the gains for motion magic?

Start with arbitrary feedforward to offset gravity. Then determine kF (theoretical calculation might be good enough). Add in P until there’s slight steady-state oscillation, and add D to dampen out the oscillations.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.