What Does a Flight Controller Do in Each Control Loop?
- Basic
- Article
- Ages 14+
- 6 min read

A flight controller repeats a chain of work that turns sensor data and control requests into motor commands. An illustrative loop starts with sensor samples, updates an estimated state, compares that state with a target, computes a correction and allocates commands to actuators. The next loop reads new data to see what the previous correction changed.
Contents
- Sensor measurements
- Flight controller
- Controlled motor
A control loop runs from sensors to motors
Imagine a simulated drone asked to hold still at a point. The flight controller does not see a “point” as a person does; software receives messages with timestamps, units and coordinate frames. The sequence below is a conceptual model, not a claim that every firmware runs these steps in precisely this order or at one fixed rate.
| Stage | Input | What happens | Output |
|---|---|---|---|
| Sampling | Accelerometer, gyroscope, altitude or positioning sensors | Drivers read devices and turn their data into software messages | Samples with units and timestamps |
| State estimation | Samples and previous results | An estimator combines measurements to infer current attitude, velocity or position | Estimated state and its quality/freshness |
| Comparison | State and target | A controller calculates the error: where and in which direction the current state differs | A correction request such as tilt or thrust |
| Allocation | Correction request and airframe configuration | Control allocation divides the overall request among individual motors | Commands to ESCs or servos |
| Feedback | New state and actuator information | The next loop recalculates error after the drone responds | Another correction or a fault report |
For example, simulated wind pushes the drone away from its hold point. Motion sensors register acceleration; the estimator updates velocity and position. The controller sees that estimated position no longer matches the target and requests a corrective attitude and force. Allocation turns that request into relative commands for the motors. If the new state shows the drone closer to its target, the next loop reduces the correction. If error grows or sensors become unreliable, the system needs to limit or reject control rather than pretend the point is still being held.
Why estimate state instead of using one sensor?
A gyroscope measures rotation rate; by itself it does not give a map position. An accelerometer responds to acceleration and gravity, but its reading alone is not a complete state. An estimator combines measurements with a motion model to produce a consistent state. That result remains an estimate: delay, vibration, bias or lost positioning can make it wrong.
In PX4, the flight stack on the flight controller includes drivers, communication modules, controllers and estimators. PX4 controller diagrams describe a cascaded structure: when a mode needs position holding, an outer loop creates motion requests; attitude and angular-rate loops help carry them out; control allocation maps force and torque to outputs. This describes PX4, not a mandatory design for every controller.
Use a log to trace the loop
In a simulator exercise, select a short interval around a change in the position target. Plot the target position, estimated position, estimated velocity and motor outputs against the same time axis. Error is the directed difference between the target and estimated state; a mode-change event alone cannot explain it.
Ask in sequence: did the target arrive at the expected time? Did the state update after sensor samples? Did error shrink after a correction? Did an output saturate or data disappear? A log contains only signals that were enabled and may have missing samples. It shows timing relationships, but cannot establish a cause by itself without inputs, estimator state and matching configuration.
What changes between systems?
PX4 distinguishes manual modes, which provide different levels of autopilot support while a pilot flies, from autonomous modes that can be fully controlled by autopilot. Topic names, sensors, fusion algorithms, loop structure and the location of allocation depend on firmware, airframe and configuration. A companion computer may send a high-level task, but the flight controller still has to accept it and pass it through a suitable control interface. This diagram helps explain the data flow; configuration and logs from the exact version identify the real signals.
Summary
Each loop samples data, estimates state, computes error, creates a correction, distributes it to motors and uses new feedback to update the decision. To understand a log, follow the target, state and outputs on the same timeline.
Terms in this article
English and Vietnamese terms, with the meanings used here. Hover, tap or Tab to a term with a dotted underline for an explanation as you read.
- estimatorbộ ước lượng
- Software that combines sensor measurements to infer the drone's current state; its result is an estimate, not a direct measurement.
- errorsai lệch
- The directed difference between a target value and the estimated current state.
- control allocationphân bổ điều khiển
- The step that maps an overall force or torque request to outputs for individual actuators.
This article is not marked as viewed
Spotted something wrong or unsafe?
Tell the administrator by email. The message already has the article title and address.
You may also like
BasicHow Do Manual, Altitude and Position Hold Differ?
Compare Stabilized, Altitude and Position by what each holds, what happens when sticks are released and positioning needs.
Robotics4 min read
StarterWhich Wireless Links Do Drones Use for Commands and Data?
Compare telemetry radios, Wi-Fi and cellular service, then trace command and status paths between a ground station and a drone.
Internet of Things (IoT)7 min read
StarterWhat Steps Turn a Spoken Command into Drone Movement?
Trace speech through recognition, intent parsing, validation, setpoint generation, flight-mode conditions and feedback in a simulated design.
Artificial intelligence5 min read
StarterWhat Can a Drone Do with Computer Vision?
Compare detection, tracking, segmentation and motion estimation in a drone vision system, including their outputs and the companion computer.
Artificial intelligence5 min read
Sources
These sources are written for older readers. If they feel hard, read them with an adult.
- PX4 System Architecture(opens in a new tab)
PX4Tier C: other sourcesRead on October 30, 2026
- Flight Modes (Multicopter)(opens in a new tab)
PX4Tier C: other sourcesRead on October 30, 2026
- Controller Diagrams(opens in a new tab)
PX4Tier C: other sourcesRead on October 30, 2026
