What is it?
The most used controller in the world: correct proportionally to the error (P), to its accumulated integral (I, removes steady offset) and to its derivative (D, anticipates and damps). Calculus in one line, running in thermostats, drones, cruise control and hard-disk heads.
Formulas
- discrete version on a microcontroller (Riemann sum + finite difference)
The mathematics behind it
The D term reacts to the derivative of the error, anticipating where the system is going.
Tuning a controller is choosing the damping ratio of the closed loop: fast without overshoot.
Derivative and integral actions become and : PID design is pole placement in .
Where is it used?
Computing topics reachable from here, through the chain of ideas that leads to them:
What depends on it
Exercises
A drone hovers 2 m below its target height. Explain what each of P, I and D contributes, and what goes wrong with only P.
Solution
P pushes up in proportion to the 2 m error; D brakes as the error shrinks quickly, preventing overshoot; I accumulates any persistent error. With only P, gravity needs a non-zero thrust, which requires a non-zero error: the drone settles below the target (steady-state error) and may oscillate if is large.
This page has the essentials. A fuller treatment (intuition, formal definition, worked example) is on the way.