Drone software
Drone software is the flight code that runs on an uncrewed aircraft together with the ground software that commands it, and an uncrewed aircraft is a distributed system where one of the nodes falls out of the sky if it misses a deadline. That single fact organises everything: which code runs where, what may block, what is allowed to crash, and why the interesting part of the specification is not the mission but what happens when the link, the position fix or the battery goes. This page covers the stack, the failsafe ladder, autonomy as a set of specific decisions, and why simulation is the main test environment rather than a nice extra.
- Stack is ordered by
- Deadlines, not layers
- The link is
- An input, not a dependency
- The specification is
- The failsafe ladder
The stack is a hierarchy of deadlines
It is tempting to read the onboard software as layers of abstraction, the way a web application is read. It is more useful to read it as layers of how long each part may take. The flight controller runs a control loop at hundreds of hertz and has a hard deadline: miss it and the aircraft becomes unstable within a fraction of a second. Everything above it has progressively more slack, and the amount of slack decides what may live there.
Flight controller
Attitude and rate control on a real-time loop, reading the inertial sensors and driving the motors. Small, deterministic, no dynamic allocation, no network calls — and almost never where a new feature belongs.
Autopilot
Turns intent into setpoints: navigation, flight modes, mission sequencing, the state estimator that fuses inertial data with position sources. Slower loop, still safety-critical.
Companion computer
A normal computer running normal software: perception, planning, video, communications. It may be late and it may crash, and neither must reach the tiers below it.
The failsafe ladder is the specification
A mission plan describes what should happen. The failsafe configuration describes what will happen, and it is the part that decides whether a vehicle is flyable. Each entry answers one question — this condition has occurred, what now — and every answer is a trade with no free option.
| Condition | Reasonable behaviour | The trade it makes |
|---|---|---|
| The control link is lost | Continue the current mission for a set time, then return or land | Returning immediately wastes most flights, since links drop routinely. Never returning loses the aircraft. |
| The position fix is lost | Hold using inertial and visual estimation, then descend or return on a dead-reckoned course | Dead reckoning drifts. The longer you trust it, the further from where you think you are. |
| The battery is low | Return now, computed from distance home rather than from a fixed percentage | A fixed threshold is wrong at both ends: too early near home, far too late at range and into a headwind. |
| A geographic boundary is reached | Refuse to cross it, whatever the mission or the operator asks | This one must be enforced in the autopilot, not in the ground software, or it is advice rather than a boundary. |
| The companion computer stops responding | Fall back to the last valid autopilot mode and carry on without it | The aircraft loses its clever behaviour and keeps flying, which is the correct order of priorities. |
Two properties of that table are worth extracting. First, every behaviour has to be enforced at the lowest tier that can enforce it — a boundary implemented in the ground station is a suggestion, because the ground station is exactly what disappears. Second, the failsafes interact, and the interactions are where the surprises live: link lost plus low battery plus a headwind is a different situation from any of the three alone, and a configuration that handles each individually can still produce an aircraft that flies confidently away from home.
Autonomy is a set of specific decisions, not a level
Autonomy is usually discussed as a scale from remote control to full independence, which is a useful summary and a poor engineering tool. The question a design actually has to answer is narrower and repeats for every capability: which decisions does this vehicle make alone, on what evidence, within what limits, and which ones does it hold and ask for. Answering that list is the design; the level is a label you can apply afterwards.
Decide on board
- Anything with a deadline shorter than the round trip to a person — obstacle avoidance, stabilisation, landing abort.
- Anything that keeps the vehicle safe: boundaries, altitude limits, energy reserve, return decisions.
- Anything reversible and cheap to get wrong — a route adjustment, a camera pointing decision.
- Navigation that must continue when the link is down, which is most of the flight in practice.
Hold and ask
- Anything consequential and irreversible, where being wrong cannot be undone by trying again.
- Anything resting on a classification the vehicle cannot verify — identity, intent, whether a person is present.
- Anything outside the envelope the operator authorised, including a mission extension that looks harmless.
- Anything the vehicle has no way to report afterwards, because an unrecorded autonomous action cannot be reviewed.
The right-hand column has a design consequence people miss: holding a decision requires the vehicle to be able to wait safely. A system that must ask a person but cannot loiter, cannot store the request, and cannot behave sensibly if no answer comes has not implemented the requirement — it has written it down. Waiting is a capability with its own energy budget, its own timeout behaviour and its own failsafe.
Simulation is the test environment, not a convenience
Every failure case that matters here is one you cannot reasonably produce on a real aircraft: losing the position fix at two hundred metres, a motor stopping in a turn, the link going at the far end of the route, a battery reporting a wrong value. Flying those tests is expensive, dangerous and slow, and the ones you survive you cannot repeat identically. So the primary test environment is a simulator, and the maturity of the simulation setup is a good proxy for the maturity of the team.
- Software in the loop: the real autopilot firmware runs on a workstation against a simulated airframe and simulated sensors. Fast enough to run on every commit, which is what makes it a regression suite rather than an experiment.
- Hardware in the loop: the real flight controller board runs the real firmware, wired to a simulator instead of to motors. This is where timing problems and driver bugs appear, and they are invisible to the previous tier.
- Fault injection as first-class test cases: cut the link, freeze a sensor, drift the clock, drop the battery reading, stall a motor. Each is a scripted case in the suite, not a manual experiment somebody ran once.
- Replay from real flights: every flight produces a log, and the log is a test input. A bug seen once in the air becomes a case that runs forever, which is the same rule as any regression suite.
Anti-patterns worth naming
- Putting new logic in the flight controller because it is "closer to the hardware", which trades the one deterministic component for a feature.
- Giving the companion computer authority instead of a request channel, so a crash in perception becomes a crash of the aircraft.
- Enforcing a boundary in the ground station, which is the component guaranteed to be absent when it matters.
- Testing only the mission and never the failsafes, so the first real link loss is the first execution of that code path.
- Treating the flight log as an artefact for incident review only, rather than as the input to a permanent test case.
When to use it
Use it when
- When deciding what belongs on the flight controller, the autopilot and the companion computer — the deadline decides, not the language.
- When writing or reviewing a failsafe configuration, which is the part of the specification that decides flyability.
- When defining autonomy as a list of decisions the vehicle makes alone versus holds and asks about.
- When building the test environment: simulation first, hardware in the loop second, air last and rarely.
Avoid it when
- As a source of perception or model detail — that belongs to computer vision, which this page deliberately stops short of.
- As guidance on the shared operational picture, which is the C2 page — this one ends at the airframe and its link.
- As a reason to design for a strong link, since every behaviour that depends on one is untested until it is absent.
- For a system where a person is genuinely always present and responsive — the constraints here would be overhead.
Found this useful?
Share it with someone who is working on the same problem.