#software #algorithm #control


PID stands for proportional, integral and derivative.

A PID controller is a control-loop mechanism acting on a system's control based on a set-point. Its input is a measurement of the difference between the current value and the set-point (the error), its output is a correction to a steering mechanism once derived from the target ; for example: it controls steering to set direction, throttle to set speed, valve aperture to control flow. PIDs can be combined in series to operate on controls twice derived from the target ; for example, PID1 controls speed to obtain altitude target, giving input to PID2 which controls throttle based on speed target.

It works through calculating the correction required to the controlling mechanism by the sum of weighted factors of the error, its differential over time, and its integral sum:

$$u(t) = P(t) + I(t) + D(t) = K_p e(t) + K_i \int_0^t e(\tau) \mathrm{d}\tau + K_d \frac{\mathrm{d}e(t)}{\mathrm{d}t}$$

With \(u(t)\) the correction applied to the steering mechanism, \(e(t)\) the measured error at a given time, and \(K_i\), \(K_d\) and \(K_p\) the PID parameters, obtained empirically.

PIDs are very ubiquitous and used for lots of uses.