PID Motion Magic w/ Tuner

Hey everyone,

I’m trying to run PID on our drive train using a motion magic control loop. I’m working with phoenix tuner to set my PID and F gains. I initialized my F gain to .1042, after seeing that our max velocity was roughly 9816. But I noticed that the plotter always shows that the closed-loop error is 0, no matter what my F gain is.

How can I find my error? It’d be helpful if anyone can clarify the steps I need to take to tune PID after finding the F gain.

Thanks!

The error will depend on the setpoint of the controller, once set you can view the error using Tuner either with the Plot tab (live) or Self Test tab (instantaneous).

You mention you are using Motion Magic and talk about setting PIDF but did you set the MM Acceleration and Cruise Velocity values as well?

Can you clarify what this setpoint is measuring? also where do you set it in tuner?

yeah, I did. Still nothing.

I’m not particularly familiar with motion magic, however when using position or velocity control (which I believe motion magic uses) the error is the difference between where the mechanism should be and where it currently is.

So would this be a distance measured by the encoders?

Yes, for example if the encoded reported 700 and you set the talon to 1000, the error would be 300.

I believe motion magic dynmically changes the setpoint as time goes on, if you run the talon using this mode, I would expect you to see the error changing.
Essentially, you don’t set the error, the PID loop is tuned to minimise it.

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