simple flight controller code for stm32f411 blackpill. uses freertos to run multiple tasks.
- read mpu6050 sensor data via i2c
- kalman filter to fuse accel and gyro (get pitch and roll)
- pid controller to compute motor values
- uses mutex so tasks don't overwrite orientation data
- Core/Src/main.c: starts freertos tasks (imu_task 200hz, control_task 100hz)
- Core/Src/imu_driver.c: i2c reads for mpu6050
- Core/Src/kalman_filter.c: maths for angle estimation
- Core/Src/pid_controller.c: pid loops with anti-windup clamping
to compile for stm32 (requires arm-none-eabi-gcc):
makeit compiles all object files and creates flight_computer.bin which is ready to flash to the microcontroller.
also has a simple pc simulator to check the pid/kalman maths:
make sim
./flight_sim