How to Write your own Flight Controller Software — Part 3
The PID Loop
In Part 1 of our series we spoke about the flight controller PID Loop. It is worth revisting that now (see Figure 1). In previous parts we have spoken about how we decode the remote control input, r(t), and how we generate our PWM control for the ESC, u(t).
In Part 3, we will look at the roll, pitch and yaw inputs from the IMU and combining that with r(t) to get our error signal , e(t), which is fed into our PID loop. We will output the desired setpoint and PID loop output to the Reefwing Configurator to assist with tuning.
The Flight Controller loop design will determine how well our drone flies and how aggressively the control inputs are converted to motor outputs. By tweaking the parameters of our PID loop we will be able to produce a flight model which is slow and stately or fast and agile. Which is appropriate depends on the purpose of the drone mission. If you are doing cinematography you dont want a lot of abrupt changes but if you are flying acrobatics you do.