![]() |
PID Loops
Besides the name proportional, integral, and derivative (if that's how you spell it) what exactly is this special algorithm used for? I understand its used for fine tuning but when would I ever use it and also how do I use it. I followed the National Instruments tutorial however I still don't understand how it exactly works. Could anybody shed some light on the dirt on how and when PID loops are used?
|
Re: PID Loops
Quote:
There are many ways to use this for your robot. Let's say you have an arm that you want to control. You can put a sensor on that arm that measures the angle of the arm (for example, a potentiometer or an encoder). Using a PID loop, you can tell your arm what angle to go to, and the PID will command the motor automatically to get to that angle. If you can measure the heading of your robot (using a gyro or two encoders) you can use a PID loop to automatically drive along a desired heading in autonomous. There are unlimited uses: if you can think of something you want the robot to do automatically, a PID loop can help you do it. How does it work? It's actually fairly simple. Let's say you're driving your car and you want to accelerate to 40 MPH and hold that speed. How much do you push the pedal while you accelerate? (think about that for a minute before going on). I'm willing to bet that when you are far away from 40 MPH you push the pedal a lot, and as you get closer to 40 MPH you gradually back off. In other words, the farther you are from your desired speed, the more you push the pedal. Let's add some mathematics to this driving technique: You can determine how far you are away from your desired speed with a simple subtraction: How Far From Desired Speed = DesredSpeed - ActualSpeed The jargon is to call the above subtraction the "error". In other words, the "error" is how far away you are from what you desire. Mathematically: Error = Desired - Actual For the cruise control: Error = DesiredSpeed - ActualSpeed. Example: you want to be going 40 MPH (above example) and you are going 30 MPH. Then: Error = 40 MPH - 30 MPH Error = 10 MPH As we said before, when you drive you push the pedal more when you're farther away from 40 MPH and back off as you get closer. We can restate this by saying that as the "Error" is larger, you push the pedal more. When the Error is smaller, you back off on the pedal. Mathematically, this is: Pedal = K * Error Where K is some constant to convert between the Error and how much you push the pedal. The above equation (Pedal = K * Error) is exactly what is being done by the P part of the PID. P means proportional, and the above equation pushes the pedal in proportion to how much error you have. The I and the D part are a little more complicated. If this all makes sense so far, let me know and we can continue on with the I and the D part. |
Re: PID Loops
Quote:
The integral adds up all the errors and then multiplies by a constant (one of the gains) to adjust the speed. The derivative takes the current speed and somehow uses that to adjust the speed? How does it do that? Also, looking at the labview vi again, I'm wondering why they use minutes instead of milliseconds. If I rewrite it (to learn about it) to use milliseconds, would I have to the input D by 60,000 for it to work? |
Re: PID Loops
Quote:
|
Re: PID Loops
When looking at the LV VI, be a little careful that it doesn't add to the confusion. You know how there are multiple formulas for computing the slope of a line? Well there are multiple ways to write the formula for a PID.
The one most often used in robotics is called the parallel form or ideal form, and the terms are independent and the P, I, and D coefficients are all multiplied gains. The LV VI implements the academic form or standard form, the one most often used for industrial plant control. The proportion gain affects the I and D results as well, and the I and D coefficients are time based and the I coefficient is a divisor instead of a gain. The time units are long because the processes often change slowly, and convention is to use seconds. The wikipedia article (near the bottom) covers the conversions and some of the other implementation techniques in the LV one that make it more stable for industry. By the way, we are considering including both forms and a number of additional control tools in the future. Any feedback or requests? Greg McKaskle |
Re: PID Loops
So you could make an arm hold a certain position without a mechanical lock? I've been wondering how to get an arm to drive and hold a position in the vertical without it falling down and without using the window motors. is that what a PID loop does?
|
Re: PID Loops
Quote:
|
Re: PID Loops
If we have approx 30-35 ft.lbs. of torque from the weight of the arm, fp would defiantly move it with ease, but it won't stay in a position. What would be needed with a PID to make it work?
|
Re: PID Loops
read this starting at page 23
http://www.cs.cmu.edu/afs/cs/academi...y_friction.pdf Basically, PID is a function that takes an input a target (set point) you want to achieve and your current error to this target and outputs the motor speed to get there. P refers to a term that is proportional to the error. It is used to achieve the desired rise time to get to the set point. However having a high P will cause the system to oscillate around the set point. D refers to a term that is proportional to he derivative of the error. It is used to dampen the system to reduced the oscillations. If you overly dampen the system, you may rob it of the power it needs to actually reach the set point. This is called steady state error. I refers to a term that is proportional to the integral of the error. It is used to address steady state error. Basically, as long as error persists, the system will try harder and harder to reduce the error. This may become dangerous because of wind up. E.g. say that you disable power to a motor for a moment. The I term will cause the speed output to rise as the error is not going away (the motor is disabled). When the motor is finally re enabled, it will go flying. Sometimes you can get away with just using P especially if there is a lot of friction in the system which would make it hard to shoot past the set point. Hope that helps. |
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
Re: PID Loops
1 Attachment(s)
Quote:
All you need supply are: the setpoint (the target value), See attached screenshot of LabVIEW's PID |
Re: PID Loops
Computing the derivative is easy as it is just change over time. Computing the integral is a bit more involved. You can use Fourth order Runge-Kutta to estimate the integral
http://mathworld.wolfram.com/Runge-KuttaMethod.html http://doswa.com/blog/2009/01/02/fou...l-integration/ If you are using a PID function of some library, you probably don't need to worry about computing derivatives and integrals and will probably just need to pass it the desired set point and the current location/sensor reading (like in Labview) |
Re: PID Loops
Quote:
"Euler's Method is the most common integration method for control systems . Control methods such as PID do not need exact integration to work well. This is because the purpose of the integral is usually to force the average error to zero to ensure that the controlled signal matches the command signal over long periods of time. Only rarely is there a need to control the integral of a signal. In those cases you may need a more accurate integration method." Control System Design Guide Second Edition George Ellis Page 82 |
| All times are GMT -5. The time now is 03:52. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi