Problems with kF in Talon SRX's velocity control

Hey guys, were experiencing a weird issue with the Talon SRX’s velocity control. When using only kF we are getting a lot of oscillations, while percent output osscilates a lot less. This doesn’t make sense because kF is open loop and there shouldn’t be any difference between feedforward and percent output control.
Does anyone have any idea what’s going on?
Thank you!

If you have your feedforward tuned correctly to have an output range from 0% to 100%, then yes, you should be able to get the exact same results out of PercentOutput that you get out of using a velocity control loop only using feedforward.

Really, you shouldn’t be getting oscillations with PercentOutput at all unless you are changing the set point or if there’s some outside force causing it to slow down.

Have you looked at this link? https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html#how-to-calculate-kf

Also, if you posted the part of your code where you configure PIDF values or could show a graph of what’s happening, it will be easier for us to see what the problem is.

In the attached graph, the red trace is the current velocity measured by the encoder. The green trace shows the velocity setpoint (when using closed-loop control). As you can see, the mechanism’s velocity is much more stable when using percentage output control.

What plotting software did you use for that? I like it.

I’m not really sure then. Maybe on of the CTRE devs can help you out. I’m assuming that you are making sure to factory reset your talons when you configure them?

Can confirm that the voltage output graphs look identical between the pure open loop (via Phoenix Tuner) and the feedforward-only “closed loop”. Yet the sensor reading are clearly different. I’m really not sure why this is the case.

Could you check it with arbitraryff instead of kF?

Just as a heads up, this is something we’re currently working on.
There are certain conditions/configurations where the velocity measurement from the Talon SRX can be noisier than normal. We’ve had one other report very recently of this manifesting in Velocity vs. Percent Output, and I’m fairly certain you’re seeing the same issue.

We have a candidate firmware fix we’re testing internally. Once it’s ready to go we’ll get it up on the website for download, hopefully within the next day or so.

4 Likes

Thank you! It’s great to hear a fix on the way. Just to make sure, this noise you’re talking influences the control loop itself too, not just the reading from getSelectedSensorVelocity, right?

We use Team 225’s FireLog (note that the text on the photo was added afterwards). We found it in their Ri3D video here, and the source code can be found here. This tool was and is very helpful for us.

The issue specifically affects the raw sensor measurement, so anything that uses that would be affected.

Firmware with the fix is here:

2 Likes

Thanks! This firmware fix eliminated the problem.

Why would noise in velocity measurement affect a velocity loop with only kF?

2 Likes

It’s not affecting the output of the motor - if you were to plot the motor’s percent output from the kF-only velocity loop it would be a static line.

What’s affected is the velocity measurement itself (specifically the quadrature input).
So this won’t affect the output until you start using the closed-loop terms in addition to kF.

In the graph I attached above, I’m pretty sure all the gains except kF were zero.

The graph you attached above is the velocity setpoint and the velocity measurement, per your post.

This is confirmed by the fact that the firmware fix resolved your issue. Had you plotted specifically the percent output, you would have seen a straight line - the actual output of your motor wasn’t affected since you were doing open-loop via kF.

Out of curiosity, could you share what caused the bug?

1 Like