Pick a scenario; every slider below stays editable.
Manual: use the on-screen pad, or W A S D (move), R / F (climb / descend), Q / E (yaw).
Bars show thrust of each rotor (FR, FL, RL, RR) as a share of the 7.9 N maximum. A red bar means the mixer clipped a command: the controller has run out of authority.
The science
Rotor thrust. Each propeller makes thrust T = kT ω² and a reaction torque Q = kQ ω² about its axis. Hover needs 4T = m g, so each rotor of the 1.2 kg airframe carries 2.94 N (about 8 800 rpm with kT = 3.5e-6 N s²). Real motors lag their command; here a first-order lag with time constant 40 ms.
Power: momentum theory. A rotor of disc area A accelerates air to induced speed vi = √(T / 2ρA), so the ideal power is P = T vi = T3/2 / √(2ρA). Real rotors reach a figure of merit FM = 0.6 of that; motor and speed controller add η = 0.85 and avionics 5 W. Because power grows as T3/2, adding payload costs more than proportionally: P ∝ m3/2.
Battery. A 4S LiPo pack: open-circuit voltage Voc = 4 (3.4 + 0.8 SoC) (a straight-line simplification of the real curve) with internal resistance R = 30 mΩ. The pack current satisfies Voc I - R I² = Pe, so as the cells discharge, the same power needs more current and the voltage sags. The model cuts out at 5 % state of charge.
Rigid body. Position, velocity, orientation (quaternion) and body rates are integrated with fourth-order Runge-Kutta at 2 ms: m dv/dt = R(q)(0,0,ΣT) + Fdrag - m g, J dω/dt = τ - ω × Jω, dq/dt = ½ q ⊗ (0, ω). Body drag is -½ ρ CdA |vrel| vrel using the velocity relative to the air.
Cascade control. Position error gives a desired velocity (P), velocity error a desired acceleration (PI, the integral cancels steady wind), and the desired thrust vector m (a + g) fixes a desired body-up direction. The attitude loop turns the tilt error zb × zdes into a desired body rate (gain Katt); the rate loop turns that into torque (Krate). A mixer converts thrust and three torques into four rotor thrusts and clips them to 0...7.9 N. Each loop must be about 3-5 times faster than the one outside it: set the attitude gain too high for the rate gain and the step response rings, then diverges.
Honest simplifications. No blade-flapping, no propeller wash on the ground or on the airframe (no ground effect), no aerodynamic rotor drag in forward flight, no sensor noise or state estimator (the controller sees the true state), constant air density, linear battery curve, drag treated per axis. Rotor, mass and battery constants are typical illustrative values for a 10-inch hobby quad, not a specific product. Gusts are an Ornstein-Uhlenbeck random wind, not a certified turbulence model.