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

UAV Systems Engineering · Module 5

M5-T15: Guidance and control integration

Each controller can be correct and the stack can still fail at the interfaces: rates, saturation, hand-overs and mode changes.

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

A flying system is a stack of loops, each assuming the one below is fast and faithful. Integration is where those assumptions meet reality: a planner that outruns the controller, a saturated actuator that nobody told the outer loop about, a mode switch that makes the setpoint jump. This lesson is about the contracts between layers.

Learning objectives

After this lesson, you should be able to:

  • Describe the layers of a guidance, navigation and control stack and typical rates.
  • State the contract each layer expects from the one below, including bandwidth separation.
  • Explain saturation handling, setpoint continuity and priority between thrust, attitude and yaw.
  • Design mode transitions that do not produce setpoint jumps.

Conceptual explanation

Established The layered structure is standard practice. The exact rates, saturation priorities and mode logic differ between autopilots and are implementation-specific.

A multirotor stack is a hierarchy of control loops with decreasing bandwidth upward: rate (fastest), attitude, velocity, position, trajectory, planner, mission. The rule that makes the hierarchy work is bandwidth separation: each loop sees the one below as approximately an identity (its commanded quantity is achieved with small lag), which requires the lower loop to be several times faster than the upper.

The interface between two layers is a contract with four parts: the quantity passed (acceleration, attitude, rate), its frame, its rate and latency, and its limits (what the lower layer can actually deliver). Most integration failures are a violated contract:

  • Rate mismatch: a 5 Hz planner feeding a position controller without interpolation produces steps.
  • Frame mismatch: ENU commands to an NED controller.
  • Silent saturation: the outer loop keeps demanding what the inner loop cannot provide (integrator windup, lost altitude).
  • Discontinuity at hand-over: a mode change that switches setpoints without blending produces a transient.
Guidance, navigation and control layersMission logic selects goals; the planner produces a path; the trajectory generator makes it flyable; the controller tracks it; the estimator closes the loop. Each layer runs at its own rate and has its own failure monitor.Mission~1 Hz, eventsPlanner1–10 HzTrajectory10–50 HzController50–250 HzRate loop / mixer250–1000 HzRates are typical orders of magnitude, not requirements. Estimation feeds every layer.
The stack. Each arrow is a contract: quantity, frame, rate, latency, limits.
Animation of the step response of a position loop as the delay between the planner and the controller grows from zero to half a second. With no delay the response is well damped; with a delay of about a tenth of a second it overshoots and rings; with a delay of a quarter of a second it oscillates for a long time; beyond about a third of a second the oscillation grows without bound. A marker shows the phase margin shrinking as the delay increases.
A delay τ\tau adds phase lag ω τ\omega \,\tau at every frequency, eating the phase margin of the outer loop; when the margin reaches zero the loop is unstable. The interface between planner and controller must therefore bound latency, not just rate. Double integrator with PD feedback (ωc≈2.2 rad/s)(\omega _{c}\approx 2.2\,\mathrm{rad}/\mathrm{s}); delay swept from 0 to 0.5 s; computed. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

Think of a chain of people passing instructions down a line, each faster than the last. If someone mishears, or can’t do what is asked, the chain must tell the upstream person, otherwise the upstream keeps issuing impossible orders. In control terms the lower layer must report saturation upward, and the upper layer must back off (anti-windup, reference limiting).

The second idea is priority under saturation. When the motors cannot provide the commanded thrust and torques together, something has to give. Standard practice is to keep attitude (especially roll and pitch) at the expense of yaw and then of altitude, because losing attitude loses the vehicle while losing a little yaw or height does not. The mixer is where this priority is implemented.

Mathematical formulation

Bandwidth separation can be expressed as a ratio of closed-loop bandwidths. For an outer loop with bandwidth ωo\omega _{o} and inner loop ωi\omega _{i}, the phase lag of the inner loop at ωo\omega _{o} is about arctan⁡(ωo/ωi)\arctan (\omega _{o}/\omega _{i}) for a first-order inner loop:

Phase lag of the inner loop at the outer bandwidth
φlag(ωo)≈arctan⁡ ⁣(ωoωi)\varphi_{\text{lag}}(\omega_o) \approx \arctan\!\left(\frac{\omega_o}{\omega_i}\right)
Examples
ωi/ωo=3→18.4∘,5→11.3∘,10→5.7∘\omega_i/\omega_o = 3 \to 18.4^{\circ}, \qquad 5 \to 11.3^{\circ}, \qquad 10 \to 5.7^{\circ}

The phase margin of the outer loop is reduced by this amount, which is why ratios of 3–10 are the working range. Reference limiting for an outer loop whose command passes through a saturated inner loop is a rate limiter: pass rcmdr_{\text{cmd}} through

Rate-limited reference (no windup source)
rk+1=rk+clip⁡ ⁣(rgoal−rk, −Δmax⁡, +Δmax⁡),Δmax⁡=amax⁡ Tr_{k+1} = r_k + \operatorname{clip}\!\left(r_{\text{goal}} - r_k,\ -\Delta_{\max},\ +\Delta_{\max}\right), \qquad \Delta_{\max} = a_{\max}\,T

Mixer priority with desaturation: given thrust TT and torques τ\tau , motor commands u=M−1[T, τ]⊤u=M^{-1}[T,\,\tau ]^{\top}. If any uiu_{i} exceeds its bounds, reduce the yaw torque component first, then the collective thrust, and keep the roll and pitch torques. A simple method scales the yaw term by the largest factor in [0, 1] that keeps all motors in range.

ωo\omega _{o}, ωi\omega _{i}
outer and inner closed-loop bandwidths (rad/s).
Δmax⁡\Delta _{\max}
maximum reference change per step.
MM
mixer matrix from motor commands to thrust and torques.

Architecture and data flow

Estimator (state, covariance, health) → every layer. Mission manager → goal; planner → path; trajectory generator → pp, vv, a, yaw references; position controller → thrust vector and attitude reference; attitude controller → body-rate reference; rate controller → torque and thrust; mixer → motor commands; motors → vehicle. Upward signals: saturation flags, controller-tracking error, estimator health and battery state, so the mission layer can slow down, hold or abort. Every inter-layer message carries a timestamp, so latency between layers can be measured.

Real-world UAV applications

  • Integrating a companion-computer planner with an autopilot via offboard setpoints.
  • Designing safe mode transitions between manual, position, mission and offboard modes.
  • Diagnosing oscillation as a bandwidth-separation violation.
  • Defining interface control documents between the planner, controller and estimator teams.

Implementation example

This runs as shown. A two-loop system: an inner first-order loop with bandwidth ωi\omega _{i} and an outer PP loop with bandwidth ωo\omega _{o}. The closed loop is yy″ + ωi y′+ωiωo y=ωiωo r\omega _{i}\,y'+\omega _{i}\omega _{o}\,y=\omega _{i}\omega _{o}\,r, with damping ratio ζ\zeta = ½ωi/ωo\sqrt{\omega _{i}/\omega _{o}}: overshoot is about 30 % at a ratio of 0.5, 16 % at 1, 4 % at 2 and none from 4 upward. The test sweeps the ratio, confirms the overshoot falls as the inner loop speeds up, and checks the phase-lag formula value.

import numpy as np

def step_overshoot(wi, wo, dt=1e-3, T=20.0):
    y = 0.0; u_in = 0.0; peak = 0.0       # outer P loop gain wo on error; inner first-order loop: u_in -> y with time constant 1/wi
    # y' = wi (u_in - y) ; u_in = wo (r - y)   =>  y'' + wi y' + wi wo y = wi wo r  (second-order system)
    v = 0.0
    for k in range(int(T / dt)):
        u_in = wo * (1.0 - y)
        # integrate as a first-order inner loop on the integrator plant: p' = v, v' = wi (u_in - v)
        v += wi * (u_in - v) * dt; y += v * dt; peak = max(peak, y)
    return peak - 1.0
for ratio in (0.5, 1, 2, 3, 5):
    wo = 2.0; wi = ratio * wo; print(f"inner/outer = {ratio:3.1f}: overshoot {100 * step_overshoot(wi, wo):5.1f} %   phase lag {np.degrees(np.arctan(1 / ratio)):5.1f} deg")
os = [step_overshoot(r * 2.0, 2.0) for r in (0.5, 1, 2, 3, 5)]
assert os[0] > os[1] > os[2] > os[3] - 1e-9 and os[0] > 0.25 and os[1] > 0.1 and os[3] < 0.01        # damping ratio sqrt(wi/wo)/2: overshoot vanishes for wi/wo >= 4 in this model
assert abs(np.degrees(np.arctan(1 / 3)) - 18.4) < 0.1
Overshoot of the outer loop as the inner-to-outer bandwidth ratio varies, for a first-order inner loop on an integrator plant.

Common engineering mistakes

Tuning the outer loop first

Tune from the inside out: rate, attitude, velocity, position.

Same rate for everything

Running the planner at the controller rate wastes compute; running the controller at the planner rate loses stability.

Silent saturation

The outer loop never learns the actuator limit and winds up.

Step setpoints at mode change

Blend or rate-limit the setpoint at hand-over.

No timestamps between layers

Latency is invisible until it causes a crash.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Slow oscillation of positionLarge limit cycle around hoverOuter-loop bandwidth too close to inner-loop bandwidth
Jump on mode changeSudden attitude change after the switchSetpoint discontinuity at hand-over
Altitude loss during aggressive movesHeight sag while tiltingThrust saturation without priority logic
Delayed reactionVehicle responds late to commandsAccumulated latency between layers

Debugging approach

  1. Plot commanded against measured value for every loop to see which one lags.
  2. Check the ratio of loop bandwidths from step-response rise times.
  3. Log the saturation flags and mixer output.
  4. Trace one setpoint through all layers with timestamps to find the delay.

Practical exercises

  1. Measure the rise time of each loop of a simulated vehicle and compute the bandwidth ratios.
  2. Add actuator saturation to the example and implement rate-limited references.
  3. Write the interface contract (quantity, frame, rate, latency, limits) for the planner → controller boundary.
  4. Design a mode transition from hover to offboard that avoids a setpoint jump.

Interview questions

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

Question 1

What is bandwidth separation and why do you need it?

Model answer

Each loop must be several times slower than the one beneath it so that the lower loop acts as an almost ideal actuator. Otherwise its phase lag eats the outer loop’s phase margin and causes oscillation.

Question 2

How should a mixer prioritise under saturation?

Model answer

Preserve roll and pitch authority first, then collective thrust, and give up yaw first, because losing attitude loses the vehicle.

Question 3

What goes into an interface contract between two layers?

Model answer

The quantity and frame, the rate and latency, and the limits the lower layer can deliver, plus how saturation is reported upward.

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-T16: Disturbance rejection and wind compensation

Model wind as a disturbance and reject it with integral action or a disturbance observer, and quantify the residual tracking error.