Talon SRX - PID and closed loop ramping

We are using Talon SRX with CTRE encoders.

Wondering if there is interaction between closed loop PID (e.g. MotionMagic) and closed loop ramping.

If the system overshoots the target, the PID will want to reverse the motor.

If closed loop ramping is in effect, will that affect the response of the PID?

Yes, this will delay large responses from your PID controller. How bad this is depends on the dynamics of your system. “Springier” systems will have significantly degraded closed-loop performance with a ramp rate, and might even become unstable. Very damped systems won’t notice as much.

So are you asking do these:


setVoltageRampRate(double voltPerSec)
setCloseLoopRampRate()
setVoltageCompensationRampRate()

have any effect in motion magic when setting these too:


/* set acceleration and vcruise velocity - see documentation */
_talon.configMotionCruiseVelocity(15000, Constants.kTimeoutMs);
_talon.configMotionAcceleration(6000, Constants.kTimeoutMs);

no longer valid:
[STRIKE]I’m going on a limb here but I would assume the first block is ignored when driving the device in controlmode.MotionMagic.[/STRIKE]

We tune the device using the sample code given here https://github.com/CrossTheRoadElec/Phoenix-Examples-Languages and run the turorial in the book Page 115 https://github.com/CrossTheRoadElec/Phoenix-Documentation/blob/master/Talon%20SRX%20Victor%20SPX%20-%20Software%20Reference%20Manual.pdf

Here are all the formulas to plug your data points into:

Motion Magic Calculations.xlsx (5.84 KB)

The ramp rate (if enabled) is definitely not ignored in Motion Magic mode.

ok good to know thats one of those gotcha, why is this not working when recycled a talon form years past and didn’t reset the presistant values.

Thanks to both of you for the replies - very interesting.

I suspected as much when our elevator started oscillating in position hold.

Now - the reason we put in ramping was because the PID was slamming the elevator to a hard stop.

Do you know if MotionMagic will hold position at the end of the movement, when it is at the target?

Yes, motion magic essentially turns into position PID at the end of the movement.

Awesome - thanks