My programmers are trying to get the PID on a talon SRX to move an arm to a set of set points and hold it there. They have it working but when the set point button is pushed the arm appears to get maximum voltage at start and rapidly decreases to the set point. From start to stop it is less than a second and it holds position with no apparent oscilation so that is good but that high velocity start I am afraid is going to be hard on the VP planetary gears.
Is there a way to have the motors start at a lower voltage so the acceleration is not so violent?
Thanks
Look in the Talon SRX software manual for “closed loop ramp rate”
What Jared said.
Or, you could put a simple ramp or low-pass filter on your setpoint command.
In my java program I can use the
setOutputRange(min, max); // value from -1 to 1
function to limit the range the PIDSubsystem will use.
He doesn’t necessarily want to limit the range of the output.
He wants to limit the rate of change of the output.
That’s a good point. The OP asked for rate-limiting, and the Talon’s Ramp rate or Closed-Loop ramp rate could be used to accomplish this.
Unrelated but… capping the throttle limits can be done using the peak and nominal output settings.
As always, see Talon software reference manual and git hub examples for more info.
That’s output ramping, though. Restricting the output ramp rate can lead to instabilities and overshoot. What I’d really like in the next firmware for FRC is a setpoint ramp rate. You can do it using the motion profiling, but that’s moderately complicated for most teams. A setpoint ramp would get 90% of users what they want here.
I hear an echo…
Ether, I could and have done that, but it’s tricky to get smooth motion out of it. If you do it at the default program loop rate, you end up with audibly chunky motion, especially at higher speeds. So you have to do it in a timed task with a higher update rate, which is a decent bit to ask of a team that’s just starting out with PID and just wants to slow things down a bit.
*No argument. Putting the input ramp in the SRX where it could update at 1KHz would be better.
Restricting the rate after tuning the PID gains can do that, certainly. But having the rate limit in place first is a close simulation of adding inertia to the system. Oscillations and overshoot can be tuned out as usual.
Programmer from Op’s team here.
We tried using this method as well as the setVoltageRampRate() method but they are not working. We have tried calling it in robot init as well as directly before and after we set the target position.
You should be able to see the ramp rate that’s been set in the roboRIO web config for that Talon. Pull that up and confirm you’re setting the ramp rate. If you are, you probably just aren’t setting it low enough. In C++/Java, it’s set in Volts per second. Something like 2V per second would be pretty slow and atleast noticeable. You could work up from there at that point.
I been trying to do this as well. I set the mymotor.setVoltageRampRate(2). This also seems to allow w the deceleration too. I now get over shoot with a kp of .001.