A 5-inch class quadcopter with a cascaded angle → rate PID. Fly it, disturb it, and watch every loop respond while the Bode, Nyquist and step plots update with your gains.
Outer loop (angle mode only). Stick sets a target angle; the level gain Kₐ turns angle error into a rate target. In Acro the stick sets the rate target directly and this loop is bypassed.
Inner loop. P and I act on rate error. D acts on the measured rate only, so stick moves don't produce a D spike. The sum u is a fraction of available motor authority.
Plant. The mixer splits u into thrust differences, motors lag by τm, torque accelerates the inertia J, and the gyro reports it Td late with noise. Wind, kicks and CG offset enter as torque.
Solid: open-loop gain and phase. Dashed: closed-loop |T|. Phase margin is read at the 0 dB crossover; gain margin at −180°.
Radius compressed beyond 1 (rings at 1, 10, 100). The loop is stable when the curve keeps the −1 point on its left. Closest approach to −1 is 1/Ms.
Unit step in the setpoint through the linearised model, including delay and motor lag. Band is ±2%.
Saved in this browser and used on every Reset. Throttle starts at hover (or centre with alt hold) when the start altitude is above the floor.
A kick is a 40 ms torque pulse. A gust is a 1.6 s burst of extra wind plus a small roll torque. CG offset is a constant roll torque that only the I term can cancel.
| Number | Good | Meaning |
|---|---|---|
| Phase margin | 45–70° | Extra lag the loop tolerates at crossover. Low means overshoot and ringing. |
| Gain margin | > 6 dB | How much more gain until oscillation at the −180° frequency. |
| Delay margin | > 5 ms | Extra latency the loop can absorb. Compare with the loop delay. |
| Ms | < 1.6 | Peak disturbance amplification. 1/Ms is the closest the Nyquist curve gets to −1. |
| Crossover | — | Where |L| = 1. Roughly the loop's bandwidth. |