I have a concept question about PID control, to which NI recently posted a new tutorial in their FRC hardware and software programming tutorials page, a great resource.
Here's the deal:
I see an alternative to this type of algorithm/programming which is to just figure out the error and correct it by exactly that amount. Then you land right on the setpoint instead of landing on it eventually after oscillating for a bit. Am I correct in saying thatyou would use a PID control algorithm because you know that if you use my alternative method that it will automatically overshoot when it corrects because of a known outside force (momentum, contact with the setpoint, etc) and need to be corrected again. This correction will be constantly oscillating, constantly correcting, will be rough, or undesirable or unstable in any way. Thereforeyou use a PID control algorithm to slowly come to the setpoint or land on it with a "soft landing", even though it might still oscillate (critically-damped) or come to the set point slowly (over-damped).
Is that right? Is there any other reason why you would use a PID control?
Thanks for your help with this question!
Also, thanks for posting another tutorial on that page. I find that a great resource and I am anxiously awaiting the "release" of the rest of the tutorials. If you could put those up soon, it would be greatly appreciated. Thanks!
PID algorithms are the industry standard for creating adaptive algorithms that need feedback to determine their set point. PID algorithms can be difficult to tune. TUNE is the key word here. If you correct too fast you will overshoot and oscillate. If you undertune it maybe too slow to react in a timely fashion. Tuning is done by experimental testing and many trials. It maybe OK to overshoot as long as it dampens quickly depending on the application.
In the case you can’t find the magic tuning parameters then consider a two phase PID algorithm. The first PID setting is to get you close and the other PID Setting is fine to keep you on the set point. PID select can be simple to implement with a simple case statement.
Yes, LabViewEnthusiast, you are correct. If you have enough gain to actually reach your target location you will end up overshooting and oscillating and if you lower the gain to stop the oscillations then the system will be very sluggish.
It may seem that if you just use the error signal to drive the motor, it would stop at the correct location but in real applications that doesn't work very well. Friction, loading, and inertia all play major roles and in most cases they are continuously changing. The PID (Proportional, Integral, Derivative) uses the same error signal but adds history about how the error has been changing. This allows the control to compensate for these forces and changing conditions which provides much better performance.
Proportion - The difference between the desired condition and the current condition (speed, location, temperature, or whatever). This the same difference error as you were using in your method.
Integral - Error that persists over time. With something like a motor or heater it might take a certain amount of power to get the motor to move or to maintain a position or temperature. If you just used the error signal to control the power to the motor or heating element then the power would decrease as you got close and your system would never actually reach the desired point. Information about how long an error has existed allows the system to achieve higher accuracy with out sacrificing stability.
Derivative - How fast the error is changing. This allows the system to look ahead and adjust to the actual conditions. It is basically calculates whether the system is coming in too fast or too slow to hit the target setting.
The PID allows the control system to adapt to changes within reasonable limits but system characteristics can be vastly different as can the desired response (a machine that moves a cutting tool at an exact speed and needs to stop without any overshoot requires very different PID response from an arm that picks up a full glass of water and moves it without spilling). The PID, therefore, needs to be tuned to the system that it is controlling to function properly. Tuning the PID is nothing more than determining how important each of the 3 parameters are to the particular system. This is done by assigning a constant to multiply with each value (Kp, Ki, Kd) then adding the three results together to produce the final control signal.