← Kybernetes

The PID Playground

Hold this car at a target speed. Sounds trivial. But the engine responds with a lag, drag grows with speed and hills arrive uninvited. Try it by hand first (↑/↓), then hand over to a PID controller and tune the three gains live: P reacts to the present error, I remembers the past, D predicts the future. This is the controller inside your thermostat, your drone and every cruise control ever shipped.

Who's driving?

Hold ↑/↓ (or W/S) to drive. Your score below is the share of the last 20 s spent within ±1 m/s of target.

Target speed

Step response

Rise time (10–90%)–
Overshoot–
Settling time (±2%)–
Steady-state error–
Time on target (last 20 s)–
Current error–

Drive manually for a bit to get a feel for the engine lag, then press 🤖 PID and try the presets left to right: P, PI, PID.

The three gains

P: the present

Push in proportion to how wrong you are right now. Big error, big throttle. Simple and fast, but on a hill it only pushes when there's already an error, so it settles below the target forever. That gap is steady-state error.

I: the past

Accumulate the error over time and push on the total. Any persistent gap keeps growing the response until the gap is gone. That's what erases steady-state error. Too much, and the accumulated push overshoots and oscillates.

D: the future

React to how fast the error is changing: brake before you arrive, not after. D is the damper: it kills overshoot and calms oscillation, at the cost of amplifying noise (which is why real systems filter it).