I'm programming a flight controller on an Arduino. I've researched how other people have written theirs but without notes it's often so obfuscated that I've decided it will be easier and better to write my own.
This is my pseudocode thus far, will this work?
all of this will happen inside the constant Arduino loop
- Read RX signal
- Calculate desired pitch, roll, and yaw angles from RX input
- Signal ESCs using PWM in order to match desired pitch, roll, and yaw from RX input
- Gather IMU values (using Kalman filter to reduce noise)
- Compare filtered IMU values vs. RX input to find errors in desired outcome vs. actual outcome
- Use PID algo to settle errors between IMU vs. RX
- Rinse and repeat
Suggestions are greatly appreciated