We all know that too much D term can cause oscillations in a quadcopter sometimes even make motors overheat. In this article we will try to explain why in the simplest way possible.
Understanding Set-Point, Measurement and Error
If you’ve read my article about PID tuning, you should know the way PID controller works is by adjusting the speed of the motors to move the quadcopter to the desired rotation speed (i.e. how many degrees the quad is spinning per second).
In technical terms, we call this desired rotation speed “Set-point”. The actual rotation speed of the quad measured by the gyro sensor, is called “Measurement“.
An “Error” is simply the difference between set-point and measurement. The job of a PID controller is to minimize the error, and when the error is at 0, the measurement equals to the set-point, which means the quad is spinning at the exact speed we want it to.
What happens in real life?
When we move our sticks, it changes the set-point and cause the error to grow…
For example, if I move the roll stick, I am telling the quad to spin around the roll axis, this will change the set-point, and error begin to rise. The flight controller will then look at the gyro, which is reporting what the copter is actually doing, and you get what the error is.
The flight controller commands the quad to spin the motors faster or slower, until the quad reaches the desired rotational speed, and the error goes back down to zero.
However, it takes time for the motors to slow down and therefore there is a overshoot and that’s why we see the error is growing to the opposite direction this time. The quad has to spin up motors on the other side to slow down, and the error finally goes back to zero again.
What is D term & Derivative of Error
The role of D term is to minimize “Derivative of Error“.
The derivative of error is basically the rate in how fast error is changing. It might sound a bit confusing and hard to understand, but it’s not. For example the derivative of speed is acceleration. Kind of makes sense now?
The derivative of error peaks when the error is increasing the fastest, and it goes back down to zero when the value of error is not changing anymore even when it’s at its maximum in amplitude.
So D term looks at the derivative of error, the red line, and say, “I want to keep it as close to zero as possible”. How is it doing it then? Well, simple, by changing your motors’ speed!
Unlike P term, which is exactly proportional to the error, and it changes exactly as fast as the error is changing. D term is calculated based on how quickly error is changing, regardless how big or small error is. So even when the error is small but if it’s changing fast the D term will be large. If error is huge, but if it’s not changing, D term will still be zero.
The relationship between D term, oscillations and overheat
Every time the red line (derivative of error) is not zero, D term changes your motor speed to try to minimize it.
As you can see, we only moved our stick once, but D term can potentially change our motor speed 6 times!! (As numbered in the following diagram)
Higher D gain will basically push the motors harder, and when they are unable to handle the rapid change of RPM, it will cause them to stutter, making your quad to oscillate, and eventually leads to overheat. The oscillation will go back into the gyro and can make the problem worse.
This is not the most scientific explanation, it’s over-simplified and didn’t cover all the academic aspect of the subject. But I hope this was useful and gave you a basic understanding on why too much D gain is not a good thing.