Skip to the content
FixTheRobot Explore Robotics / UAV / Module 6 / M6-T6

UAV Systems Engineering · Module 6

M6-T6: Flight modes

A flight mode is a contract: what the pilot or software controls, and what the vehicle must know to honour it.

  • Lesson 6 of 16
  • UAV Software and Flight-Controller Integration
  • Implementation-specific
  • About 6 minutes to read

Modes decide who controls what. The practical question for autonomy is which mode needs which sensors and what happens when they are lost. A GNSS-denied system is largely a system for keeping position-class modes alive, or degrading gracefully out of them.

Learning objectives

After this lesson, you should be able to:

  • Describe the main multicopter modes and the control each hands to the pilot or software.
  • State the estimator outputs each mode requires.
  • Explain what happens when a requirement is lost in flight (mode fallback and failsafe).
  • Select the mode and failsafe configuration for an autonomous test.

Conceptual explanation

Implementation-specific Mode names, availability and fallback rules are PX4-specific and change between releases. Check the flight modes page for multicopters in the documentation of the version you use.

Representative multicopter modes in PX4:

undefined
ModeWhat the pilot or software controlsNeeds
Manual / StabilisedPilot commands attitude (and thrust)Attitude estimate
AltitudePilot commands horizontal attitude and climb rate; vehicle holds heightHeight estimate
PositionPilot commands horizontal velocity; vehicle holds position when sticks centredHorizontal position or velocity estimate
HoldVehicle holds its position automaticallyPosition estimate
MissionVehicle flies stored waypointsGlobal position, home, valid mission
ReturnVehicle returns to home or a rally point and landsGlobal position, home
LandDescends and landsPosition preferred, otherwise descent only
OffboardExternal software supplies setpointsSetpoint stream; the matching estimate for the control type

The commander monitors the estimator validity flags, the link status and the battery. If a mode’s requirement fails, it applies the configured failsafe action (for example hold, return, land or fall back to a lower mode such as altitude or stabilised), depending on parameters and on whether the pilot has control. Careful configuration of these actions is a safety task, not a convenience.

Flight mode requirementsEach mode requires certain estimator outputs to be valid: manual and stabilised need only attitude; altitude needs height; position, hold, mission, return and offboard need horizontal position or velocity. If a requirement is lost the commander falls back to a lower mode or a failsafe.StabilisedattitudeAltitude+ heightPosition / Hold+ horizontal positionMission / Return+ global position, homeOffboard+ setpoint streamMore capable modes need more valid estimates. Losing GNSS or vision removes modes.
Modes need progressively more estimator validity. Losing GNSS or vision removes position-class modes.
Animation of mode availability as sensor validity changes over a two-minute flight. Three flags, attitude, height and horizontal position, change over time: horizontal position is lost for twenty seconds when an aiding source drops out and height is briefly lost later. A ladder of modes, stabilised, altitude and position, highlights the best mode supported at each moment, with a short timeout before falling back and a longer one before climbing back up.
Each mode needs certain estimates to be valid (attitude for stabilised, height for altitude, horizontal position for position and mission). The commander offers the highest mode whose requirements hold, falls back after a loss timeout and returns after a regain timeout (hysteresis). A model of the logic, not PX4 code; timeouts 1 s and 3 s. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

Climb a ladder of trust: attitude from the IMU alone is the most robust; height needs a barometer or rangefinder; horizontal position needs GNSS, vision or flow. Each rung needs something external. In a GNSS-denied environment the position rung rests on your vision or lidar odometry, so “position mode works” means “my odometry is valid and fused”.

The failsafe is the safety net and must be tested, because the default may not be what you want. A vehicle flying a vision-aided mission that loses its vision should usually land or hold in altitude mode with pilot takeover, not “return home” using a position estimate it no longer has.

Mathematical formulation

A mode transition can be modelled as a guard on validity flags. Writing vattv_{\text{att}}, valtv_{\text{alt}}, vpos∈{0, 1}v_{\text{pos}}\in \{0,\,1\} for validity, the best available mode is the highest rung whose requirements hold. For hysteresis, a requirement lost for longer than a timeout TlossT_{\text{loss}} triggers fallback and is restored only after the estimate has been valid for TregainT_{\text{regain}}:

Mode availability and hysteresis
modemax⁡=max⁡{ m:req(m)⊆valid(t) }\text{mode}_{\max} = \max\{\, m : \text{req}(m) \subseteq \text{valid}(t) \,\}
Hysteresis
fall back if ¬valid for t>Tloss;re-enable if valid for t>Tregain\text{fall back if } \neg\text{valid for } t > T_{\text{loss}}; \quad \text{re-enable if valid for } t > T_{\text{regain}}

The failsafe time budget is the sum of detection, decision and action times; for example if position is lost, the vehicle drifts at the velocity error rate: with a velocity bias bb the drift after TtotalT_{\text{total}} is b Ttotalb\,T_{\text{total}} (a bias of 0.2 m/s over 3 s is 0.6 m).

req(m)
set of validity flags required by mode mm.
TlossT_{\text{loss}}, TregainT_{\text{regain}}
timeouts for losing and regaining a requirement.

Architecture and data flow

Estimator validity flags (vehicle_local_position flags and the estimator status flags) + link status + battery → commander → vehicle_status (nav_state, failsafe flags) and vehicle_control_mode → controllers and navigator select their setpoint source. A mode change command arrives from the RC, the ground station (a MAVLink command) or the companion (a VehicleCommand message over DDS). The same commander arbitrates all of them.

Real-world UAV applications

  • Selecting the correct mode and failsafe for vision-aided and GNSS-denied tests.
  • Designing a safe takeover procedure from autonomous to manual.
  • Choosing a return strategy that does not depend on a lost sensor.
  • Writing the mode-transition section of a test plan.

Implementation example

This runs as shown. A small mode-availability model with validity flags and timeouts, a stand-in for the commander’s logic (not PX4 code). It confirms the fallback order and the hysteresis on a scripted loss and recovery of vision.

import numpy as np
REQ = {'stabilised': {'att'}, 'altitude': {'att', 'alt'}, 'position': {'att', 'alt', 'pos'}}
ORDER = ['position', 'altitude', 'stabilised']

def simulate(valid_pos, T_loss=1.0, T_regain=2.0, dt=0.1):
    mode = 'position'; lost_t = 0.0; good_t = 0.0; modes = []
    for ok in valid_pos:
        if ok: good_t += dt; lost_t = 0.0
        else: lost_t += dt; good_t = 0.0
        if mode == 'position' and lost_t > T_loss: mode = 'altitude'          # position lost: fall back one rung
        if mode == 'altitude' and good_t > T_regain: mode = 'position'        # regained and stable for T_regain
        modes.append(mode)
    return modes
valid = np.array([1] * 30 + [0] * 20 + [1] * 40)                              # vision valid, lost for 2 s, restored
m = simulate(valid, dt=0.1)
t_fall = m.index('altitude') * 0.1; t_back = len(m) - 1 - m[::-1].index('altitude') + 1
print(f"fallback at t = {t_fall:.1f} s, back to position at t = {t_back * 0.1:.1f} s")
assert m[0] == 'position' and 'altitude' in m and m[-1] == 'position'
assert 3.9 < t_fall < 4.2 and 6.5 < t_back * 0.1 < 7.5
A mode-availability model with timeouts and hysteresis. Not PX4 code.

Configure and test the real behaviour in SITL by removing the aiding source and watching vehicle_status and the failsafe action.

Common engineering mistakes

Assuming the default failsafe suits the mission

Check and set the data-link-loss, estimator-loss and RC-loss actions explicitly.

Return home without a valid position

A return needs a global position estimate; choose land or hold when it is lost.

No pilot takeover plan

The ground pilot must know which mode to switch to and be able to fly it.

Testing only the nominal case

Every mode transition and failsafe needs a test, including recovery.

Confusing an offboard setpoint stream with a mode

Offboard needs both the mode and a live stream.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Unexpected mode switchVehicle changes behaviour in flightEstimator or link failsafe triggered fallback
Cannot enter position modeMode refusedPosition estimate not valid (no GNSS or vision fused)
Return flies the wrong wayHeads away from homeHome position or frame error; estimate drift
Pilot cannot take overSwitch has no effectRC link or switch mapping not configured

Debugging approach

  1. Plot nav_state, failsafe flags and estimator flags together over the flight.
  2. Read the commander messages in the log console for the reason of each change.
  3. Reproduce the loss in SITL by disabling the source.
  4. Check the parameters of each failsafe action against the test plan.

Practical exercises

  1. List, for your PX4 version, the failsafe parameters and their values for data-link loss, RC loss and estimator loss.
  2. Write a mode-transition table for a vision-aided mission with a GNSS-denied area.
  3. In SITL, disable the vision input mid-flight and record the fallback.
  4. Define the pilot takeover procedure for your test vehicle in two sentences.

Interview questions

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

Question 1

What does position mode require that altitude mode does not?

Model answer

A valid horizontal position or velocity estimate from an aiding source such as GNSS, vision or optical flow; altitude mode only needs height and attitude.

Question 2

What should happen when vision odometry is lost in a GNSS-denied flight?

Model answer

It depends on the plan, but typically a controlled fallback (hold in altitude or land, with pilot takeover) rather than a return that relies on the lost position estimate; it must be configured and tested.

Question 3

Why add hysteresis to mode fallback?

Model answer

To avoid chattering between modes when a source flickers: fall back after a loss timeout, and return only after the source has been stable for a regain timeout.

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

M6-T7: MAVLink protocol

Read a MAVLink frame, the heartbeat and common messages, and explain message IDs, rates, systems and components.