This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
PID Theory And Tuning
WebCoder49 edited this page Jan 25, 2024
·
1 revision
To implement a PID controller in code, please click here.
This description refers to this image:
-
The purpose of PID is to get a variable like motor position (measured using encoders) to a certain value, without overshooting, by setting the motor powers to a certain value depending on the "error", the difference between current and target positions.
- The three coefficients for PID are:
- P, for Proportional, which sets the power to the coefficient multiplied by the error, therefore, for example, moving the wheel to the desired position but slowing down before reaching it to avoid overshoot (red line has P only).
- I, for Integral, which "tries harder and harder" to get to the target value by increasing the power in the order of the cumulative sum of past errors, therefore overcoming "static friction" where low motor powers have little effect and make the value settle on a non-target value (as shown in the red line below). (Yellow line has P and I coefficients).
- D, for Derivative, prevents oscillation by acting against quick changes in the value (steep gradients). (Reaches the pink line when P, I and D, are all set, the best algorithm).
- The three coefficients for PID are:
- The art of setting PID values is called "tuning" and you can do it either manually (as we will be doing), or using software such as SysID (I believe).
If you want a more mathematical description (generally unnecessary), please click here.