Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   controlling the speed that a PID on the talon moves an arm (http://www.chiefdelphi.com/forums/showthread.php?t=145165)

Bruceb 03-04-2016 11:46 AM

controlling the speed that a PID on the talon moves an arm
 
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

Jared Russell 03-04-2016 11:51 AM

Re: controlling the speed that a PID on the talon moves an arm
 
Look in the Talon SRX software manual for "closed loop ramp rate"

Ether 03-04-2016 11:58 AM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by Bruceb (Post 1551285)
Is there a way to have the motors start at a lower voltage so the acceleration is not so violent?
Thanks

Quote:

Originally Posted by Jared Russell (Post 1551289)
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.



fireXtract 03-04-2016 12:18 PM

Re: controlling the speed that a PID on the talon moves an arm
 
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.

Ether 03-04-2016 01:38 PM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by fireXtract (Post 1551301)
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.



ozrien 03-04-2016 02:41 PM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by Ether (Post 1551339)
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.

Kevin Sevcik 03-04-2016 03:17 PM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by ozrien (Post 1551369)
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.

Ether 03-04-2016 03:22 PM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by Kevin Sevcik (Post 1551388)
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.

I hear an echo...
Quote:

Originally Posted by Ether (Post 1551291)
Or, you could put a simple ramp or low-pass filter on your setpoint command.


Kevin Sevcik 03-04-2016 03:35 PM

Re: controlling the speed that a PID on the talon moves an arm
 
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.

Ether 03-04-2016 03:38 PM

Re: controlling the speed that a PID on the talon moves an arm
 

No argument. Putting the input ramp in the SRX where it could update at 1KHz would be better.



Alan Anderson 03-04-2016 04:06 PM

Re: controlling the speed that a PID on the talon moves an arm
 
Quote:

Originally Posted by Kevin Sevcik (Post 1551388)
Restricting the output ramp rate can lead to instabilities and overshoot.

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.

Tuxedolarry 03-04-2016 09:16 PM

Re: controlling the speed that a PID on the talon moves an arm
 
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.

Kevin Sevcik 03-04-2016 10:33 PM

Re: controlling the speed that a PID on the talon moves an arm
 
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.

cpapplefamily 03-10-2016 12:37 AM

Re: controlling the speed that a PID on the talon moves an arm
 
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.


All times are GMT -5. The time now is 05:25 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi