What are PID Controller 0, 1, 2, 3, 4 and 5 in CleanFlight?
I have been hearing people discussing “PID controller 1” or “PID controller 2” a lot recently, after they flashed CleanFlight on their Naze32 or CC3D, so what are these all about? Well, this is actually the new feature added in the flight controller firmware. This post is part of the CleanFlight Setup guide.
Cleanflight now has six optional built-in PID Controllers which are numbered 0, 1, 2, 3, 4 and 5. Each of them has different flight characteristics, and requires different PID gain settings to achieve best performance.
- PID Controller 0 – Multiwii
- PID Controller 1 – Rewrite
- PID Controller 2 –
- PID Controller 3 – MultiWii23
- PID Controller 4 – MultiWiiHybrid
- PID Controller 5 – Harakiri
At the moment you can select which PID controller to use, by setting the “set pid_controller = X” parameter in CLI Commands. But please make sure you understand the differences between these PID controllers before changing it.
What Difference do these Flight Controllers Make?
Just some brief description of each PID Controller in Cleanflight.
PID Controller 0 – Multiwii
This is the default PID Controller (PD) in Cleanflight. As you might know, cleanflight is a fork of baseflight, and baseflight is a fork of Multiwii. The PID Controller 0 is originated from older version of Multiwii (Multiwii 2.2 – MW2.2 and older).
This default PID controller 0 has some strange behaviour where changing PIDs affects rates. For example the strange effect with this PD is, as you increase P on roll or pitch axis, the rotation speed of those axis also decreases, and you need to increase the pitch or roll rate to compensate.
PID Controller 1 – Rewrite
As the name implies, this is a rewritten PD algorithm from 0. It originates from Multiwii 2.3 (MW2.3) and Cleanflight documentation suggests that it should perform better. PID tuning is easier and the tolerance range is wider.
In PID Controller 1, PID is no longer connected with rates, so changing P will not affect rotation speed, e.g. increasing P gains does not make rates sluggish. It gives you much better yaw response.
What I heard the most from those who use PID Controller=1 is, “the control response seems more direct, feels more locked in”, and “no need for TPA anymore”. This is recommended PID Controller for everyone who fly acro mode (rate mode, or manual mode). Note that it also changes how PID works in self-level modes (angle and horizon modes), if you do fly in these modes, try it out before deciding. For all flight modes in Multiwii.
PID Controller 2 – LuxFloat
Multiwii was written for 8 bit processors, now the newer flight controllers such as Naze32 and CC3D are using 32-bit processors, which are faster and more accurate. To take advantage of that, this PD is written for 32 bit floating point algorithms, and not derived from Multiww. Although it’s called “baseflight”, but it was never used in Multiwii nor baseflight. (It was called “baseflight”, name changed to “LuxFloat” since 29th of Jan 2015)
It’s also independent of looptime. I believe this PD is still experimental, and being worked on for better reliability, and integration into the firmware. At the moment it is not supported in Autotune.
PID Controller 3, 4 and 5
Further reading: If you are building a 250 size mini quad, you might find this 250 size quadcopter parts list useful.