Deep RL-based attitude control for quadrotors deployed on bare-metal MCUs
This research project explores whether a compact learned controller can keep a quadrotor stable on a small microcontroller, as an alternative to a conventional PID controller. The controller is trained in simulation and then prepared to run directly on embedded flight hardware.
A larger “teacher” controller is trained in MuJoCo simulation with access to information that would not be available on a real aircraft, such as exact mass and wind conditions. Its behaviour is then distilled into a smaller student model that relies only on sensor inputs available during flight. This makes the learning process more capable while keeping the deployed model small enough for a microcontroller.
The student model is designed to respond to real flight disturbances. Motion-sensor readings can reveal sudden changes such as a payload drop before substantial altitude is lost. A short history of motor commands helps it account for delayed motor and aerodynamic responses, while accumulated error feedback helps correct persistent drift caused by longer-term changes in mass.
The student model is deployed with fastnn, a custom Rust neural-network runtime that can run without a standard operating system. Compressed weights and efficient processor instructions achieve 70–90 μs inference latency in approximately 7.5 KB of flash memory on a Cortex-M4F microcontroller. The result shows that neural flight controllers can fit within the same tight hardware constraints as conventional embedded control systems.