Skip to the content
FixTheRobot Explore Robotics / UAV / Module 5 / M5-T2

UAV Systems Engineering · Module 5

M5-T2: Quadrotor dynamic modelling

A model is only as good as its parameters: measure mass, inertia, thrust curve and motor lag, then check the model against a log.

  • Lesson 2 of 17
  • UAV Guidance, Navigation and Control (GNC)
  • Established engineering
  • About 6 minutes to read

The equations of lesson M1-T5 need numbers. This lesson shows how to obtain them from bench measurements and flight data, and how to choose an integration step so that the simulator itself is not the source of error.

Learning objectives

After this lesson, you should be able to:

  • List the parameters of a quadrotor model and how each is measured.
  • Estimate inertia from a pendulum test and the motor time constant from a step response.
  • Choose an integration scheme and step size for the stiff motor dynamics.
  • Validate the model against flight data by comparing step responses.

Conceptual explanation

The model needs: mass mm, centre of mass and inertia JJ, arm geometry, the propeller thrust and drag-torque as functions of rotor speed (TT = kkT Ω², QQ = kkQ Ω² as the standard approximation), the motor and ESC time constant τm\tau _{m} and limits, aerodynamic drag, and sensor models. Parameters from CAD are a starting point; measured values replace them.

Parameter identificationMass by scale; centre of mass by suspension; inertia by pendulum test; thrust and torque coefficients on a thrust stand; motor lag from a step command; drag from constant-speed flight; then validate the assembled model against flight logs.Mass, CoMscale, balanceInertiapendulum testThrust / torquethrust standMotor lagstep responseValidatevs flight logmeasure what dominates the response; check the rest by validation
Where each parameter comes from.
Animation of the step response of a motor with a 50 millisecond time constant, computed with explicit Euler and with fourth-order Runge-Kutta for a simulation step that grows from 5 to 130 milliseconds. Both follow the exact exponential for small steps; as the step approaches twice the time constant the Euler response overshoots and rings, and beyond it Euler oscillates with growing amplitude and diverges, while RK4 stays stable for much longer.
w˙=(u−w)/τ\dot{w}=(u-w)/\tau with τ=50 ms\tau =50\,\mathrm{ms}. Explicit Euler multiplies the error by (1 − dt/τ\tau ) each step: stable only for dt < 2τ(100 ms)2\tau (100\,\mathrm{ms}), oscillatory above τ\tau , and divergent beyond 2τ2\tau . Choose dt several times smaller than the fastest time constant (motor lag, rate loop) or use a higher-order integrator. Computed responses. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

Not all parameters matter equally for the controller you are tuning: the attitude loop is dominated by inertia and the motor lag; altitude hold by thrust-to-weight and the thrust curve; position hold by drag. Measure those first. The validation step is the honest one: command a small attitude step in flight, compare it with the same step in the model; mismatch in rise time points to inertia or motor lag, mismatch in overshoot to damping or delay.

Mathematical formulation

Thrust and drag torque from rotor speed, first-order motor dynamics, and the discretisation:

Rotor thrust and drag torque
Ti=kT Ωi2,Qi=kQ Ωi2T_i = k_T\,\Omega_i^{2}, \qquad Q_i = k_Q\,\Omega_i^{2}
Thrust and reaction torque grow with the square of the rotor speed.
Motor and ESC lag
τm Ω˙i=Ωcmd,i−Ωi\tau_m\,\dot{\Omega}_i = \Omega_{\text{cmd},i} - \Omega_i
First-order response with time constant τm.
Exact discretisation of the lag
Ωk+1=Ωcmd+(Ωk−Ωcmd) e−Δt/τm\Omega_{k+1} = \Omega_{\text{cmd}} + (\Omega_k - \Omega_{\text{cmd}})\,e^{-\Delta t/\tau_m}
Stable for any step Δt, unlike explicit Euler.

Inertia about a horizontal axis from a pendulum test with period PP (small oscillations), mass mm, suspension height dd from the centre of mass and the suspension’s own inertia negligible:

Inertia from the pendulum period
Jpivot=m g d P24π2J_{\text{pivot}} = \frac{m\,g\,d\,P^{2}}{4\pi^{2}}
Jcm=Jpivot−m d2J_{cm} = J_{\text{pivot}} - m\,d^{2}

Motor time constant from a step response: the time to reach 63.2% of the final value. Integration: the fastest dynamics set the step; with τm=30 ms\tau _{m}=30\,\mathrm{ms} an explicit Euler step above about 2τm2\tau _{m} is unstable, while the exact exponential update is stable for any Δt\Delta t; choose Δt≤τm/10\Delta t\le \tau _{m}/10 for accuracy of the rest.

Thrust, weight and the sign of gravity

The rotor model feeds the translational equation of lesson M1-T5. With zz up, the total thrust is T=∑ikT Ωi2T = \sum_i k_T\,\Omega_i^2 along the body zz axis and the equation is

Translational dynamics (z up)
m v˙=R[00T]−mg z^+Fdm\,\dot{\mathbf{v}} = \mathbf{R}\begin{bmatrix}0\\0\\T\end{bmatrix} - mg\,\hat{\mathbf{z}} + \mathbf{F}_d
Thrust from the rotors, weight, and drag.

The weight is not negative: its size mgmg is positive (14.7 NN for a 1.5 kg vehicle). The minus sign is its direction. z^=[0,0,1]⊤\hat{\mathbf{z}} = [0,0,1]^{\top} points up and gravity pulls down, so the weight vector is [0,0,−mg]⊤[0,0,-mg]^{\top}. On the vertical axis, level thrust gives +T and the weight −mg, so mv˙z=T−mgm\dot v_z = T - mg. In a simulator this is one line, a = R @ [0, 0, T] / m - [0, 0, g]. In a z-down frame (NED) z^\hat{z} points down, the weight is +mg z^\hat{z} and thrust is −TT z^\hat{z}; the physics is the same, so pick one convention for the whole simulator and convert at the boundary.

Hover is the case mv˙z=0m\dot v_z = 0: the four rotors must together produce T=mgT = mg. With equal rotor speeds this fixes the hover speed, and it is the number to check first when a simulated or real vehicle climbs or sinks at zero command:

Hover rotor speed
4 kT Ωhover2=mg⟹Ωhover=mg4 kT4\,k_T\,\Omega_{\text{hover}}^2 = mg \quad\Longrightarrow\quad \Omega_{\text{hover}} = \sqrt{\dfrac{mg}{4\,k_T}}
kTk_{T}, kQk_{Q}
thrust and torque coefficients (N/(rad/s)2^{2}, NN·m/(rad/s)2^{2}).
τm\tau _{m}
motor-ESC time constant.
PP, dd
pendulum period and distance from pivot to the centre of mass.

Architecture and data flow

Parameter file (YAML) shared by simulator, controller design scripts and planner; versioned with the airframe (lesson M7-T19). Gazebo vehicle models used with PX4 SITL have their own parameter sets: keep them aligned with your measured values if you want SITL to predict your flight.

Real-world UAV applications

  • Tuning in simulation before the first flight.
  • Checking that a payload change leaves the controller stable.
  • Model-based estimators and MPC.
  • Detecting a damaged motor from a changed time constant.

Implementation example

This runs as shown: inertia from a simulated pendulum test, motor time constant fitted from a noisy step response, and the stability of explicit Euler versus the exact update.

import numpy as np
rng = np.random.default_rng(0)
g = 9.81

# 1) inertia from a pendulum test: the airframe hangs on a pivot 0.12 m above its centre of mass
m, d, J_true = 1.5, 0.12, 0.020
P_true = 2 * np.pi * np.sqrt((J_true + m * d * d) / (m * g * d))                   # the period the experiment would give
P_meas = P_true * (1 + 0.005 * rng.standard_normal())                              # 0.5 % timing error
J_est = m * g * d * P_meas ** 2 / (4 * np.pi ** 2) - m * d * d
print(f"inertia: true {J_true:.4f}, estimated {J_est:.4f} kg m^2")
assert abs(J_est - J_true) / J_true < 0.10

# 2) motor time constant from a noisy step response (command 0 -> 1000 rad/s at t = 0)
tau_true, dt = 0.030, 0.002; t = np.arange(0, 0.3, dt); omega = 1000 * (1 - np.exp(-t / tau_true)) + 8 * rng.standard_normal(len(t))
A = np.stack([t, np.ones_like(t)], axis=1); y = np.log(np.clip(1 - omega / 1000, 1e-3, None)); m_ = t < 0.09                 # fit the early part of the decay
slope = np.linalg.lstsq(A[m_], y[m_], rcond=None)[0][0]; tau_est = -1 / slope
print(f"motor time constant: true {tau_true * 1000:.0f} ms, fitted {tau_est * 1000:.1f} ms")
assert abs(tau_est - tau_true) / tau_true < 0.2

# 3) explicit Euler versus the exact update for the first-order motor
def euler(dt, tau, n=200):
    w = 0.0
    for _ in range(n): w += (1000 - w) / tau * dt
    return w
def exact(dt, tau, n=200):
    w = 0.0
    for _ in range(n): w = 1000 + (w - 1000) * np.exp(-dt / tau)
    return w
assert abs(euler(0.001, 0.03, 300) - 1000) < 1.0 and abs(euler(0.07, 0.03) - 1000) > 1e6          # explicit Euler diverges when dt > 2 tau
assert abs(exact(0.07, 0.03) - 1000) < 1e-6                                                           # the exact update is stable for any step
Inertia from a pendulum, motor lag from a step, and integration stability.

Common engineering mistakes

Taking inertia from CAD without the wiring and battery

Measured inertia differs by tens of percent.

Using a quasi-static thrust curve for fast manoeuvres

Motor lag matters: include it.

Explicit Euler with a large step on stiff dynamics

Instability or numerical damping; use the exact exponential or a smaller step.

Identifying on one battery voltage

Thrust and lag change with voltage.

Skipping validation

The model may match the bench and not the flight.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Simulation stable, vehicle oscillatesReal vehicle rings at the attitude loop bandwidthMotor lag or delay not modelled
Hover thrust mismatchSimulated hover throttle differs from the real oneThrust curve wrong
Yaw too slow or too fastYaw response differsDrag torque coefficient wrong
Numerical blow-upNaN in simulationIntegration step too large

Debugging approach

  1. Compare step responses of roll rate between model and log.
  2. Check hover throttle in the log against the model.
  3. Run the simulation at half the step and see whether results change.
  4. Plot ESC command and measured rpm to estimate τm\tau _{m}.

Practical exercises

  1. Compute the inertia error if the centre-of-mass offset dd is mis-measured by 5 mm.
  2. Design a step test for the yaw axis and the fit to extract kQ/kTk_{Q}/k_{T}.
  3. Show that the exact update equals the analytic step response.
  4. Measure your own vehicle’s hover throttle and compare with the model.

Interview questions

Write an answer in your own words, then reveal the model answer. Nothing is sent anywhere.

Question 1

How do you measure a quadrotor’s inertia?

Model answer

With a pendulum or bifilar test: measure the oscillation period and use the pendulum formula with the pivot geometry, subtracting the parallel-axis term.

Question 2

Why does the motor time constant matter?

Model answer

It adds phase lag inside the attitude loop and limits achievable bandwidth; models without it predict better stability than the vehicle has.

Question 3

How would you validate a model?

Model answer

Apply the same small command to the vehicle in flight and to the model and compare the responses (rise time, overshoot, settling).

References and further reading

Primary papers, official documentation and standards. Each claim above that is specific to a tool or version points here.

What’s next

Mark this lesson

Saved in this browser and synced to your account when you are signed in.

Next lesson

M5-T3: Attitude representation and rotation matrices

Use rotation matrices and Euler angles correctly, compose rotations, and recognise gimbal lock.