## In the simplest terms, how does a PID controller work?

Interestingly your intuitive, human control is not that different from a PID controller.

Imagine you are driving a car, trying to reach and maintain speed of 50 kilometers per hour.
– You watch the difference (error) between your speed and the desired speed.
– You press more or less on the gas pedal (control output).

The PID control has three parts (rules): P, I, D.
Each contributes to the control output.

P – proportional
The less you have, the more you push.

The farther you are from the desired speed, the more you press the gas pedal; the closer you are, the less you press it. This works well, but has a small accuracy problem: When you get at the desired speed, according to this rule you let off the gas pedal completely. The end result is that you car slows down and stays a little below the desired speed of 50 (static error).
Proportional control is the main ingredient of any control. May be a little inaccurate.

I – integral
You wait a little, if no improvement you push a little more.

If you are stuck below the desired speed for a long time without progress, you push the gas pedal a little further. If you still do not make it to the desired speed for some time, you again push the pedal a little further down. Once you get to the desired speed you leave the pedal where it is.
Integral control gives you accuracy (zero static error) but you have to wait.

D – derivative
You react to sudden changes.

A strong wind gust pushes your car. Suddenly your speed surges fast upward toward 50. Startled you release the gas pedal. As the speed surge ends and the speed stabilizes, you return the pedal to where it was.
Derivative control manages sudden surges and may prevent overshooting your target speed.

That’s it!

Check out our other interesting blog posts here!
https://robolab.in/blog/