$ show espressif/esp-drone
This repository contains the ESP-Drone firmware, an open-source flight control system for quadcopters based on Espressif ESP32/ESP32-S2/ESP32-S3 microcontrollers. It is a port of the Bitcraze Crazyflie firmware (GPLv3) and is primarily designed for STEAM education. The system provides a complete drone control stack including sensor drivers (IMU, barometer, magnetometer, ToF range finders, optical flow), state estimation (complementary filter, extended Kalman filter), attitude/position controllers (PID, Mellinger, INDI), and communication via Wi-Fi (UDP, ESP-NOW) and CRTP protocol. It supports modular expansion 'decks' for additional hardware like flow sensors, thermal cameras, and localization systems (Lighthouse V1/V2, UWB TDoA). The firmware runs on FreeRTOS and uses ESP-IDF v5.0 as its development framework.
The LLM identified 5 files worth highlighting for reuse:
A self-contained 3D math library providing vector operations (add, subtract, cross product, normalize), 3x3 matrix operations, quaternion arithmetic, and ray-polytope intersection. It is MIT-licensed, has no dependencies on other internal modules, and can be extracted for use in any embedded project requiring 3D geometry computations.
Implements second-order low-pass, Butterworth, and IIR biquad filters with configurable cutoff frequencies. The filter state is encapsulated in a struct, and the code is dependency-free, making it highly reusable for sensor signal processing in embedded systems.
Provides a generic PID controller implementation with support for integral windup prevention, derivative filter, and configurable gains. The PidObject struct encapsulates all state, and the code is decoupled from the rest of the flight stack, allowing reuse in any control application.
An I2C device abstraction layer that provides register-level read/write operations (byte, word, bit) with mutex protection for multi-threaded environments. It is used by all I2C sensor drivers in the project and can be ported to any RTOS with minor adjustments.
A lightweight rate supervisor that monitors task execution rates and detects stalls or missed updates. It uses simple counters and thresholds, with no internal dependencies, making it a reusable watchdog pattern for real-time embedded systems.