![]() |
Speed PID Function
As far as I know PID Control is normally applied to move a motor, ei. an arm or wheel to a set target/position/distance.
What I NEED to implement is a speed based PID method. I input a rate. In my java encoder.java class it lists a method getRate(); I suspect this works by returning......a rate which I could use to set my speed. from the rate/speed I input... I need to implement a PID method so when voltage drops or a ball passes through the shooter I am using, the POWER % will increase to compensate to allow the shooter to hold a constant SPEED. |
Re: Speed PID Function
If you perform a search on "velocity speed control" you will find all the formulas you require derived for you by a mentor from team 341. He also does an excellent job explaining how a velocity pid differs from a positional pid.
|
Re: Speed PID Function
Can you provide a link I can't find the exact page.
I saw something about Jaguar 2012 using PID.....I use Victors it shouldn't matter right. :O mostly because I am not a fan of the current flow fail-safe on the Jags. |
Re: Speed PID Function
Quote:
Here are some links which may be of interest: http://www.chiefdelphi.com/forums/sh...80&postcount=7 http://www.chiefdelphi.com/forums/sh...5&postcount=15 http://www.chiefdelphi.com/forums/sh...28&postcount=6 http://www.chiefdelphi.com/forums/sh...04&postcount=3 http://www.chiefdelphi.com/forums/sh...7&postcount=34 http://www.chiefdelphi.com/forums/sh...7&postcount=29 |
Re: Speed PID Function
Quote:
|
Re: Speed PID Function
Quote:
When a PID derived for position passes the set point, it reverses the motor. Reversing a motor on a spinning wheel going at 4000 rpm can have negative consequences. The derivations are different. Once you see the final formula, you will understand why position PID and velocity PID are different. |
Re: Speed PID Function
Quote:
|
Re: Speed PID Function
You need to use and encoder to "measure" the Back EMF of the motor.
BackEMF = EncoderRPM * 12V/(12V Free RMP) Motor output = Control Output + BackEMF This essentially linearizes the motor to act as a torque source. Now you can set up a standard PID with RPM as input. and Plug in the output to the equation : Motor output = Control Output + BackEMF. |
Re: Speed PID Function
I've been looking at the PID drive example in the FRC Java example projects.
SO. what I AM understanding is instead of putting distance in as the SETPOINT you would put the rate. Now what I'm also understanding is that the Error HAS to be 0. because you never want to stop the motor once you've reached your target velocity. I'm a client side coder once I have enough examples I can make my own functions and classes from that. I'm confused as to what BACK EMF is? Code:
/*----------------------------------------------------------------------------*/ |
Re: Speed PID Function
@BornaE:
The BackEMF term seems to react in the wrong direction to disturbances or changes in setpoint. For example, if a change in load causes the motor speed to decrease, this causes the BackEMF term to decrease as well, instead of holding fast (as might be desired). Or suppose there is a step decrease in setpoint. Instead of immediately decreasing (as might be desired), the BackEMF term will only decrease as the PID overcomes it and slows down the motor. Also, at steady state, the BackEMF term provides only the voltage necessary to hold speed for an unloaded system. So the PID must contain an integrator to make up the difference. Why not just replace the BackEMF term with the expected voltage* necessary to achieve the desired speed ? Read the links provided in post #4. They provide further detail. * As might be the case with a spinning wheel shooter for example where the load is predictable and the expected volts vs speed curve can be known. You can determine this voltage empirically by just reading the PWM from the dashboard. |
Re: Speed PID Function
I understand the theoretical stuff with the PID now.
I just need some psuedo-code or something to help me implement it. I'm currently clueless. |
Re: Speed PID Function
Quote:
http://www.chiefdelphi.com/forums/sh...15&postcount=5 |
Re: Speed PID Function
Code:
Code:
because actually using a rangefinder is exactly what I'm going to be doing in the end. |
Re: Speed PID Function
Quote:
Code:
previous_error = setpoint - process_feedback |
Re: Speed PID Function
I just ran a test with my encoder and I get a HUGE amount of oscillation when I'm just pulling the number from the getRate() method even when I'm running at a constant speed.
I can't get a RPM reading with this much oscillation. |
| All times are GMT -5. The time now is 20:35. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi