Effective Use of PID in Robotics Systems
PID algorithms are used in a variety of control systems in industry. In robotics and for FRC specifically,
you will commonly see PID implemented for motion control, either for drive train motors or for other
servo actuators. Before you decide to use PID control on your robot, you will want to consider a couple
of different factors to evaluate if PID is warranted:
1) Do you need PID in the first place?
If your system doesn't exibit error outside of your acceptable performance parameters...
If all possible inputs to the system cannot result in undesired or possibly dangerous behavior...
If you don't need to improve the response of your system...
…then you don't really need PID control, and your time is probably better spent on other areas
of your robot.
2) Is the system you are trying to control linear?
PID control is only effective for linear systems. If you have a system with non-linear response,
the PID gains that are effective in tuning your system for one section of the response curve will
not be valid for other parts of the response curve, resulting in erratic and uncontrolled behavior
of your system. You will have to implement gain scheduling (applying different PID gains for
each approximately linear section of the response curve) or PID in combination with feed-
forward control to implement an effective control system.
Almost all motors will have documentation containing a Torque/Speed Curve. Use this curve to
determine the linearity of your motor. A straight line with a constant slope indicates a linear
motor. An exponential or polynomial curve indicates a non-linear motor. If you can't find
information or specifications on your motor or other device, then you will need to perform a
characterization of your system to determine its linearity.
3) Do you have adequate real-world feedback?
You must have some method to measure the output of your system to provide feedback in
calculating the system error. For motion systems this usually means an encoder or a gear tooth
sensor.
Once you have determined that you have a linear system, and that you have some
means of providing the necessary feedback, the next step is learning how to implement a PID
controller.