PID

Proportional Integral Derivative (PID) is a feedback control scheme which generates control actions as a weighted linear combination of three terms:

  1. Proportional to the error
  2. Integral of the error
  3. Derivative of the error

The weights are referred to as feedback gains, and can be tuned according to model-free heuristics e.g. the Ziegler–Nichols method.

Despite its simplicity, PID is extremely (often surprisingly) effective in practice on a wide variety of systems, even when stochastic disturbances, plant nonlinearities, input delays, and other challenging aspects are present.

Interactive demo: balancing a cart-pole

The cart-pole (inverted pendulum on a cart) is a canonical benchmark for control.

Here the pole starts tilted and the controller applies horizontal forces to the cart to keep it balanced in an upright configuration at the center position.

There are two PID controllers: one for the pole angle and one for the cart position.

Tune the gains. Notice how:

  • K_p alone causes oscillation
  • K_d damps the oscillation
  • K_i corrects low-frequency disturbances

Simulation controls:

  • Reset will set the cart and pole back to a fixed initial state
  • Kick left/right will apply a strong short transient disturbance to the pole

Disturbance settings:

  • HF Amt sets the amount of high-frequency disturbance
  • LF Amt sets the amount of low-frequency disturbance
  • LF τ sets the time between sign flips of the low-frequency square-wave disturbance in seconds
s

Learn more