The simplest possible control algorithm — full power until past the target, full reverse until back, repeat. Zero tuning parameters. Five lines of code. Useful as an emergency replacement when PID isn't working and as a teaching bridge to understand why PID exists.
The name comes from the behavior: the output bangs between full-on and full-off. There is no smooth deceleration, no proportional response — just a binary decision made every control loop.
Notice the oscillation — the system never truly settles, it bounces around the target. This is the fundamental weakness of bang-bang. The deadband slider shows how adding a small tolerance reduces oscillation at the cost of some precision.
Bang-bang is actually well-suited to flywheel velocity control — the flywheel needs to reach and maintain a target RPM, and oscillation is less visible in a spinning flywheel than in a positional arm.
| Situation | Bang-Bang? | Notes |
|---|---|---|
| PID broken night before competition | ✅ Yes | Emergency fallback. Zero tuning required. |
| Flywheel velocity (low precision ok) | ✅ Yes | Works well. TBH is better if you have time. |
| Teaching how closed-loop works | ✅ Yes | Best starting point before introducing PID. |
| Precise arm positioning | ❌ No | Oscillation is visible and problematic. Use PID. |
| Drive autonomous movements | ❌ No | Bang-bang on drive causes wheel screeching and poor accuracy. EZ Template PID is far better. |