So now the KK2.1 knows the positions of the motors, but we still need to give it more information before our SK450 Dead Cat quadcopter will fly correctly. In this step we will adjust the settings for the PID loop. Like I did in the last step, I just want to take a moment to explain what the PID loop does and what we are trying to accomplish by adjusting its settings. Note though that the PID controller is probably the most conceptually complex part of the quadcopter, so don’t worry if the following information is a bit confusing.
A PID loop is a very common control mechanism (probably one of the most common) that is widely used in numerous control systems, including, of course, our KK2.1 flight control board. The role of a PID loop is to detect and attempt to correct errors between a measured process variable and the desired value of that variable. In the case of our quadcopter, when we are flying, we give the quadcopter certain control inputs and we want the quadcopter to obey our input as closely as possible. Lets use an example to make the role of the PID controller more clear: let’s say we want the quadcopter to stop flying level and instead pitch forward by five degrees in order to move forward. When we first tilt our elevator (pitch) stick forward, there is an error between our control input and the quadcopter’s actual position. The quadcopter would be level when we want it to be pitched forward by five degrees. This is where the PID loop goes to work. It notices, by examining data from the flight controller’s sensors, that the quadcopter’s real orientation does not match the one we commanded the quadcopter to take. So, the PID loop adjusts the lift produced by each of the four rotors in such a way that the real orientation of the quadcopter matches the five degree forward pitch we wanted.
The trick to this process is to make sure that the PID loop does not accidentally overshoot the desired orientation by being overly aggressive when controlling the motors. When the PID loop is too aggressive, the quadcopter will be twitchy and unstable in the air as the PID loop frantically corrects errors and keeps overshooting the desired values. However, we also don’t want the PID loop to be too gentle, which would cause sluggish performance. So we have to strike a balance so that the quadcopter responds quickly to our input without developing instability with rapid, aggressive lift adjustments. In this step, we will adjust settings for the PID loop in order to achieve this balance.
Hopefully that explanation made at least some sense to you so that now you are ready to start tuning the KK2.1 PID loop. The PID loop settings are located in the PI Roll and Pitch menu on the KK2.1. Input the values below. Note that the values for Roll (Aileron) and Pitch (Elevator) are coupled so when you change the values in one of these menus, the values in the other menu change as well.
Roll (Aileron)/Pitch (Elevator) PI Settings
Yaw (Rudder) PI Settings
- P Gain: 50
- P Limit: 100
- I Gain: 25
- I Limit: 20
- P Gain: 55
- P Limit: 20
- I Gain: 60
- I Limit: 10