Flight Controller PID Tuning#

What you will need

  • A fully operational DD21

What you will get

  • A DD21 that flies stably and responsively in manual mode

For a consumer level drone, when you launch it for the first time (e.g. with virtual joysticks on phones, or with remote controls), you would expect it to take off and fly more or less stably, instead of shaking and going out of control. This is indeed what a Duckiedrone is capable of doing, too. In this section, we will have a look at the parameters on the flight controller that make it happen. And you will be able to play with them!

Expectation with good parameter settings#

The Flight Controller (FC) runs high-frequency control loops to stabilize the drone. It utilizes the sensors (e.g. IMU & Gyro) to estimate the state of the drone. In the Angle Mode that we configure the FC to, the following is expected:

  • On the roll / pitch axis:

    • when commands are issued, the FC tries to make the drone reach the commanded roll/pitch as soon as possible, and minimize the fluctuation and stay at the designated angle.

    • When no commands are given, the drone would try to return to a neutral roll and pitch.

  • On the yaw axis:

    • When commands are issued, the FC tries to keep the yaw rate to the command.

    • When no commands given, the drone should not rotate along the vertical axis.

PID terms in drones and tuning#

Primarily, a proportional–integral–derivative controller (PID controller) is used on the FC to achieve these. Here are some materials helping explain the influence of P, I and D terms, in the context of drones, and how should they be tuned based on the behaviors of the drone.

Setting your PID values#

How to update in CleanFlight#

../_images/FC_PID_starter.png

Fig. 121 GUI tab in CleanFlight to set the PID values (with recommended starter values)#

As shown in Fig. 121, here is how to set the PID values:

  1. Connect the FC to the workstation.

  2. Go to the “PID Tuning” tab.

  3. Change the values and click “Save” on the bottom right of the tab

Your tuning loop#

Note

In your own PID tuning process, you should only change the P, I and D on ROLL, PITCH and P and I on YAW. Only change the other values if you are sure what they mean and what you are doing.

After apply the recommended starter values, with the knowledge from the previous subsection, you can keep trying the following for improving the basic manual performance of your Duckiedrone:

  • Flying the drone manually and look out for erroneous behaviors

  • Connect the FC to Betaflight, and adapt the PID values