Calculating PID Constants for Motion Magic

Our Arm has a small oscillation that we are struggling to get rid of!

Following the Motion Magic tutorial provided by CTRE. One thing I noticed is we scaled our encoder (by adding a coefficient) so our encoder is basically true to 1 degree.

Should the P,I,D values also be scaled by this? I’ve noticed my gain values such as P would be greater than 1 if this was the case.

Or should they remain true to native encoder units in their measurements? I know the D value is supposed to help remove the small oscillation, but whatever value we set in seems to not help.

PS: CTRE used to have that motion magic arm example up on github, is that now gone?

also tagging @Jacob_C

Stryke Force Talon SRX Motor Training Course Dec 2017 – Chapter 8 - YouTube

You’d better look at 2767’s tutorial if you are using CTRE’s motor, like TalonSRX.

OUr team had followed this tutorial and successfully implemented Motion Magic on our swerve.

Is gravity effecting your arm? Your PID may just be constantly trying to fight gravity. You might want to add an arbitrary feed-forward, which is available with motion magic. The CTRE documentation has two use cases, an elevator (with constant effect by gravity) and a swinging arm (with variable effect based on the position of the arm).

yeah we have that actually! We tuned a feedforward that is cosine based to it’ll vary. I’ve gone through that whole tutorial

Its just some pesky oscillation in one specific spot…

Cool. It smoothed out our intake and a few other things for us. It’s a nice feature that’s easy to add once you’ve got the rest of motion magic.

Good luck tuning things!

1 Like

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