On a windy day, a drone hangs still in the air. It looks as if nothing is happening, but inside the aircraft the arithmetic never stops. When it tips a little, it notices, changes the thrust of its motors and rights itself, again and again.

That job belongs to the flight controller and the inertial sensors. This article uses public sources to explain what a flight controller does, what inertial sensors measure, and how a loop of measuring and correcting keeps the aircraft steady. It reflects the state of things as of October 2026.

What a flight controller does

The user guide for PX4, a public open-source flight software, calls the "brain" of a drone its autopilot. At a minimum, an autopilot has two parts. One is the hardware, called the flight controller (FC). The other is the flight software that runs on a real-time operating system on that hardware.

The core job of the flight software is stability and safety. It usually also helps a human pilot fly, and it can handle routine tasks on its own, like takeoff, landing and following a planned mission.

The flight controller is wired in two directions. On one side are sensors that tell it the current state of the aircraft. On the other are the motors that steady and move it. An electronic speed controller (ESC) in front of each motor turns the flight controller's signal into the right amount of power for that motor.

There are many states to track. They include position and altitude, heading, speed, attitude, rates of rotation about the different axes, and battery level. This article starts with attitude and rotation, the states closest to the job of keeping the aircraft upright.

Three axes of rotation: roll, pitch and yaw

Talking about attitude needs axes. NASA's beginner's guide to aeronautics explains that every aircraft in flight rotates about its center of gravity, the average location of its mass. Draw three axes through that point, each at right angles to the other two, and any rotation can be split into three parts.

A three-panel diagram. The left panel shows a generic four-rotor drone from the front, tilted to one side, for roll (one side up, the other down). The middle panel shows it from the side with the nose tipped down, for pitch (nose up or down). The right panel shows it from above with a two-way arrow, for yaw (nose turns left or right). An orange dot in each panel marks the center of gravity. A note says it is not a real aircraft and has no dimensions
Roll, pitch and yaw. All three axes of rotation pass through the center of gravity and are at right angles to each other (diagram)(Diagram)

Yaw is the nose swinging from side to side. Pitch is the nose moving up or down. Roll is the wing tips moving up and down. The diagram carries these airplane definitions over to a generic drone shape without wings.

The idea of handling all three axes is old. The Wright brothers' glider of 1902 was the first aircraft to show it could be actively controlled on every one of the three axes.

Gyroscopes and accelerometers inside the IMU

Inertial sensors measure how far the aircraft tilts and how fast it turns. There are two kinds. A gyroscope measures change in angle, and an accelerometer measures change in velocity.

A unit that holds three gyroscopes and three accelerometers, all at right angles to each other, is called an inertial measurement unit (IMU). With one sensor per axis, it can measure rotation and velocity change in all three directions separately.

The accelerometer is simpler than it sounds. Åström and Murray cover it in Feedback Systems, a control engineering textbook. Early accelerometers, they explain, were a mass hung on a spring plus a sensor that measured how far the spring bent. Picture a spring scale with a weight on it. In practice, the accuracy depends heavily on how well the spring and the sensor are calibrated, which makes it far more demanding than a kitchen scale.

Gyroscopes come in more than one type. NASA's report on small spacecraft technology says today's small spacecraft mostly carry one of two types: fiber optic gyros (FOGs) or microelectromechanical systems (MEMS) gyros. FOGs usually perform better but cost more in mass and money, while MEMS gyros are smaller, can perform well enough and are more sensitive to radiation. That comparison is about spacecraft, so it cannot be carried straight over to drones.

Inertial sensors also have a weakness they cannot avoid. An offset called bias appears when they switch on, and the bias drifts over time. Because of both, the bias has to be estimated on board, all the time.

Sense, compare, correct: the feedback loop

Once the sensors report a tilt, the next step is to fix it. The idea used here is feedback. A controller senses what a system is doing, compares it with what it should be doing, works out a correction, and drives the actuators to make the change.

Block diagram of a feedback loop. The desired attitude on the left enters a comparison circle; the difference (error) goes to the flight controller, whose command goes to the ESCs and motors, which move the drone body. A wind gust pushes on the body from above, and the sensors (IMU) measure the motion and send the measured attitude back to the comparison circle. A line below says the loop runs again and again and each new error starts a new correction
Sense, compare, correct. The flight controller runs this loop over and over (diagram)(Diagram)

Åström and Murray treat this cycle of sensing, computing and actuating as the central idea of control. A home thermostat does the same thing. It measures the room temperature, compares it with the set temperature, and uses the difference to switch the heating on and off. A drone works with attitude instead of temperature, and with motor thrust instead of heating.

Feedback brings both benefits and difficulties. It can make an unstable system stable, and it can reduce the effect of outside disturbances such as wind. But feedback can also create instability of its own, such as oscillation or runaway behavior. It also brings sensor noise into the system, so the signals have to be filtered with care.

There is one more catch: feedback is reactive. An error has to appear before the correction starts. So even a drone hit by a gust tips a little first and only then starts to recover.

This idea reached airplanes more than a century ago. The Wright brothers' airplane was not stable by itself, so the pilot had to make corrections all the time. To sense which way was up, Sperry used a pendulum steadied by a gyroscope. He then built a feedback device that pulled the stick to bring the plane up when it pointed down, and the other way around.

The same textbook describes the Sperry autopilot as the earliest use of feedback in aircraft engineering. The device earned Sperry a prize at a 1914 contest in Paris for the safest airplane. A 1912 Curtiss fitted with the autopilot held its roll, pitch and yaw steady and kept flying level while a mechanic walked out on the wing.

Sensors that correct each other

Inertial sensors are not enough on their own. Gyro bias makes the heading slowly drift. That is why PX4 requires, at a minimum, a gyroscope, an accelerometer, a magnetometer (compass) and a barometer. To use all of its automatic modes, it also needs a source of global position such as a global navigation satellite system (GNSS).

Block diagram of sensor fusion. On the left are five boxes: gyroscope (angular change; bias makes the heading drift), accelerometer (velocity change), magnetometer (helps hold the heading), barometer (height; drifts with air pressure and temperature) and satellite navigation (global position; needed for automatic modes). All feed a state estimator in the middle (for example a Kalman filter, which also estimates sensor bias), which sends attitude, heading, height and position to the controller
Each sensor has a weak point, so their readings go into one estimator where they check each other's drift. Drawn from public open-source autopilot documents (diagram)(Diagram)

A state estimator combines all these readings into one picture. PX4's navigation filter uses a method called the extended Kalman filter (EKF) to process sensor measurements and estimate the aircraft's state. Its estimates include not only attitude and position but also the biases of the gyroscopes and accelerometers.

The sensors cover for each other. The magnetometer can hold in check the slow heading drift that gyro bias creates. While the aircraft is accelerating, position or velocity from satellite navigation also reveals the true heading. When that happens often enough, the magnetometer is not strictly needed.

A barometer drifts on its own too. Even at a constant height, its reading wanders as the surrounding air pressure or the sensor temperature changes. When satellite navigation height is available, PX4 uses it to estimate the barometer's bias.

Spacecraft are set up in a similar way. NASA's report explains that inertial sensors are often used to carry the vehicle's state forward between updates from non-inertial sensors. How inertial errors build up, and where satellite signals fall short, is covered in Inertial and satellite navigation: knowing where you are.

Flight modes and failsafes

How much the flight controller takes on is chosen with a flight mode. The PX4 guide defines modes as operating states that give different types and levels of automation and autopilot help. In manual modes, a person flies with the sticks of a controller and the autopilot assists. In autonomous modes, the autopilot does everything with no pilot input, for tasks such as takeoff, returning home and landing.

Manual modes differ a lot from one another. Some allow acrobatic tricks. Others cannot be flipped and hold their position and course against the wind.

The multicopter mode table of ArduPilot, another public open-source flight software, shows the steps clearly. Stabilize mode levels the roll and pitch by itself, and Alt Hold adds holding altitude. Loiter holds altitude and position and uses GPS for its movements. RTL returns above the takeoff point and can also land.

Each mode also needs different sensors. Stabilize and Alt Hold work without position information, but Loiter and RTL need a valid position before takeoff. The sensor set described above becomes the condition for each mode.

Failsafes are for when something goes wrong. PX4 has failsafes that trigger in cases such as a low battery, a lost remote control signal or a lost data link. Another is leaving a geofence, a virtual cylinder that the flight is kept inside. When a failsafe triggers, the aircraft lands, holds its position or returns to a set point.

What happens when the control link drops is covered under the term lost link in Drone autonomy: navigation is not the same as communication.

Where this meets lasers

The sense-compare-correct loop is not only for drones. A fast steering mirror (FSM), which holds a laser beam on one spot, also works through a loop that feeds back sensor readings. The difference is that a drone controls the attitude of the whole aircraft, while a fast steering mirror controls the direction of light.

What is inside that mirror and where it is used are covered in Fast steering mirrors: small, quick mirrors that cancel shake.

What to read next