Everyone is chasing a stable, locked in feeling with their multirotor.
If you just want the answers, jump to the end. For everyone else, let’s start out with some theory.
Without control loop feedback, a multirotor is a naturally unstable system. To keep our multirotors from crashing immediately, most flight controllers typically use a proportional, integral, derivative (PID) controller to stabilise the vehicle they’re attached to. There is a lot of theory available for PID controllers, with whole textbooks dedicated to controller theory and control loop feedback. The PID controller is one of the simplest control loop feedback mechanisms available.
The PID controller is the part that is responsible for determining the amount of work required to change the multirotor’s state. It does this by tracking the difference between the desired vehicle state (pilot command) and the measured vehicle state (attitude estimation). The difference between the two is known as the error. By tracking the error value on each axis, the PID controller can work to bring the error down to zero. The behaviour of the PID controller is manipulated with a set of of variable gains.
P is the proportional gain. This gain deals with the amount of corrective action for the present error. At minimum, a controller can get by with just P. If P is too low the vehicle will feel sluggish, if it is too high it will oscillate.
I is the integral gain. This gain deals with the amount of corrective action for the past error. Integral gain will improve the steady state error. What this means is that the vehicle will feel more locked in to your desired position. In attitude mode, integral gain will help keep the vehicle level. However, vibrations on the vehicle will make the controller correct with an offset (it won’t sit level – assuming you have performed levelling procedures).
D is the derivative gain. This gain deals with the amount of corrective action for future error. Derivative gain will improve the response to your control input and reduce the amount of ringing the vehicle experiences whenever you apply a change in control input. Derivative correction is very sensitive to vibrations.
Let’s take this information and start tuning.
The controller gains you end up with are unique to your vehicle. However, any PID controller on a flight controller will follow the same basic principles. When tuning your multirotor, it is always a great idea to start with the default gains of your flight controller. These are usually selected by the developers to be somewhere close to what a typical multirotor requires. If you have the gains of someone with a similar setup and flying style, they can also be a handy point of reference to start from.
When tuning the PID controller, you should always try to work on one axis at a time, cycling through adjustments in roll, pitch and yaw. If your vehicle is symmetric, you will likely be able to adjust roll and pitch gains at the same time, using the same values.
Most flight controllers use an inner rate loop (rate mode) for all of their higher levels of stability control (attitude/angle mode, altitude mode, position mode etc). If you can fly rate mode, start off here and follow the steps before working on the other modes. Each mode follows the same principles. You will see similar behaviour exhibited in all states that the controller is trying to control.
While at a hover…
Slowly increase the P gain until the vehicle begins to oscillate on the axis you are working on. These oscillations will be fast. Now back it off a little so it doesn’t oscillate (80% of the value it oscillated at is usually a good starting point). As you increase P, things will feel more responsive. As you decrease P, things will feel sluggish.
Next we can work on the I gain. Increase I on the axis until the vehicle begins to oscillate, these oscillations will be slower than before. Now back off I so that it doesn’t oscillate. As you increase I the vehicle may feel a little sluggish again.
Lastly you can add the D gain. When tuning derivative, you want to look at what happens when you make a change of your control sticks and then let go. Does it look like it is ringing a little? Add derivative slowly until it doesn’t ring, being careful to make sure you don’t move too far and introduce oscillations. When you add derivative you may find that you will have to back of your P gain a little. It is a little bit of a fine balancing act.
Perform this procedure on roll, pitch and yaw. Take note, that most multirotors will only require derivative in the roll and pitch pitch axis because they are naturally damped by limitations in the amount of torque that can yaw the vehicle.
Once you get the multirotor in a stable hover, you can move on to dynamic flight. As you start to fly a little more aggressively you will find that small variations in the PID controller will introduce or remove oscillations.