AENGM0073 · Aerial Robotics Simulators and PX4 Framework

Simulation Lab

t = 0.0 s
Phase portrait, x against v/ω exact orbitsimulated
Energy E/E0 (log scale) simulatedpredictedexact (1)
Steps per period
100
Per-step energy factor
1.00395
E/E0 after 10 periods
51.4
Predicted
51.4
Attitude loop: tilt response to a 20° step (deg) selected integrator at Δttrue 250 Hz loop
Stable Controller at 250 Hz

Real physics engines typically step at Δt = 1–4 ms (Gazebo's default maximum step size is 1 ms; PX4's Gazebo worlds use 4 ms): small enough that integrator error is invisible for a drone, cheap enough to run faster than real time.

Oscillator: x = −ω²x, ω = 2π rad/s (period T = 1 s), x0 = 1 m, v0 = 0, energy per unit mass E = ½v² + ½ω²x²; the trajectory is computed directly for n = N T/Δt steps. Attitude loop: θ = u2/I, I = 0.01 kg·m², PD controller u2 = I(Kp(θref − θ) − Kdθ) with Kp = ωa² = 625 s⁻², Kd = 2ζaωa = 25 s⁻¹ (ωa = 25 rad/s, ζa = 0.5), updated at 250 Hz and held between updates. The controller can only see states the physics engine produces, so when Δt > 4 ms it runs once per physics step (lockstep). Rotor limits are ignored here. Stability is judged over 4 s: an error that still grows between 2–3 s and 3–4 s is flagged.

Try this

  1. Explicit Euler at Δt = 10 ms gains energy every step. Check the readout: is E/E0 after 10 periods equal to (1 + ω²Δt²)n with n = 1000? Halve Δt: why does the growth fall from ×51 to about ×7?
  2. Switch to Semi-implicit Euler at the same Δt. The energy now wobbles but never drifts. It costs the same as explicit Euler, so why do physics engines (ODE, Bullet, MuJoCo's default) use it?
  3. With explicit Euler, raise Δt until the attitude loop reads Simulation unstable. Which integrator survives the largest step? The real 250 Hz loop is stable at every step size, so what exactly is failing?
  4. In the real-time factor calculator, find the rendering cost that drops RTF below 1. What does Headless buy you, and why is RTF > 1 useful for test suites and learning-based controllers?