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 –
BaseflightLuxFloat - 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 is PID for quadcopters?
What Difference do these Flight Controllers Make?
Just some brief description of each PID Controller in Cleanflight.
Table of Contents
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
Check out part 2 for the rest of the PD’s. For more detail, check out the official documentation.
Further reading: If you are building a 250 size mini quad, you might find this 250 size quadcopter parts list useful.
40 comments
Thanks for the information, but what is not clear to me is when using a FC controller with a 32 bit processor (I am using a Flip32) should one use profile 2 and then in the PID tab of CleanFlight 1.12.1select Luxfloat or if one uses the the default profile and again select Luxfloat will that achieve the same result?
Hi Oscar, I’m having trouble w/my “Diatone ET 180”. At maiden flight, hoovering was impossible. It would shack and vibrate violently and the motors and motor screws would heat up badly. I was told the “loop time” was off and that it had to be set higher. That didn’t help much. Then was advised the PIDs had to be set lower. With no specific #s given and kept notes of what I changed, I then started messing with the PID settings then w/the “LEVEL” settings. Now I find myself lost at what to troubleshoot next. All this seemed to help a little but still can’t get the thing dialed in good enough to feel solid or anything close to solid. Can you help with some settings and or advise. What am I doing wrong? Thanks for your time … My setup, EMAX skyline32 – EMAX Nano 12A (Oneshot 125 support) ESCs {though the ESCs have not been flashed} – DYS BX1306,3100kv – Mad Dog 1000 mAh 35c battery – running Cleanflight w/multi rewrite.
what props are you using? what are your PID?
also check motor screws are not touching the winding inside the motor.
Hi Oscar, The props are ‘Bull nose’ 4045 and the PIDs are P I D
Roll 1.3 0.015 15
Pitch 1.3 0.015 16
Yaw 8.5 0.022 0
LEVEL 8.0 0.010 100
And my loop time (I believe) is 217 Hz. And the motor screws are not touching the coils. But I will note that since I changed the loop to 217 Hz, the motors don’t get as hot. And it hoovers a bit smoother. But when it hits the ground, it loses control.
Hi Oscar
Having trouble changing pid controller number. I have clean flight 10. When i put in the pid change and save, the cli just sits there on rebooting. When I put in exit nothing happens. the write line just goes back to curser. Have I actually saved the change? If I go to the pid tab I get waiting for data… and nothing else is seeming to happen. Please help as I am not the best progammer.
sounds like your board is faulty…
Hi Oscar
I dont know which version of CF you wrote this for. 1.9 as been around since May. Have you tried it and if so does the above guide still apply or do you have any updates ?
thanks
that was back in 1.7 i think when CF first released the different PID controllers…
the thing is these PID controllers are constantly being changed / improved, it’s not possible to write description or comparison. I didn’t know this at the beginning.
it’s best to refer to official documentation.
I just started experimenting with the different pid controllers on my new to me 122mm atom quadcopter. I get some weird forward pitch in controller 0 that seems damn near impossible to correct. I tried calibrating the accelerometer. Increasing the level P helped, but i still needed -50 trim to get it flyable. I did notice that it was snappier than controller 1 with the same rate values and i guess it’s because the low p values actually increase rate. I don’t get this weird pitch forward in controller 1 and i can lower the level p value. controller 3 also has this weird pitch forward.
Thanks for this info, it was very helpful. I’ve been flying the Naze32 boards for a while now but haven’t tried tried changing the PID controller till now. I’m really liking LuxFloat so far, but I do have some oscillation to work out.
Oscar!
You’re the man. Thanks for another great, well-written piece.
Nate,
Thanks Nate :) gald I can help!
Hi Oscar,
first of all I would like to thank you for the explanation of all your blogs – very impressive!
I started with pid 3 controller = Multiwii 2.3 since that is the one I know from my first builds.
On my small zmr 250 it is not bad with default pids.
Now I tried pid controller 1, but it is very shacky and I think the pid values are too high.
Are there any default pid values to use with the different controllers available?
(At the moment I have no bluetooth to tune…)
Thx in advance,
kopinke
unfortunately i can suggest any PID values for you. I found some PID controller behave very differently even to different props, on the same quad. I am afraid you will have to tune it yourself.
Hi Oscar, great job with your blog, lots of useful stuff for a tourist like me.
Got the same wobbling issues with cleanflight PID modes 1 and 5. Why can’t you (and others) propose settings on mode 1 and 5 since mode 0 works pretty well like this with most of the quads without having to change anything?
Thanks anyways,
Just wanted you and everyone to know that PID controller 1 does use tpa and tpa break point values. If you want me to upload video proof I will. PID controller 1 go with default tpa then on break point choose 1500. That is the break point at mid throttle of 1000-2000. If you want break point to be before or after that adjust accordingly.
maybe you should talk to the person who update the cleanflight documentation :)
Hi.Oscar… I.just.tried.pid.controller 1.and…crash. What a crazy settings? It went upside down without control. Then I tried decrease pid and it shaked a lot…wobble until it crashed again withou control. How can I start using this mode? Do I have to put all to zero and then start?
scaling of rate is a bit higher in PID Contrller 1 than 0, and they needs to be tuned down by almost half. But you might be right, start low and work your way up might be safer.
Tried PID 1 last night and quickly discovered that Horizon mode and Stability mode don’t work. Horizon mode is basically the same as Rate mode and when I tried to switch to stability mode in flight all heck broke lose. Just somersaulted to the ground. I’m not sure it that’s a bug or a “feature” but those modes are not anything list they were on Baseflight (and presumably PID 0).
Hi Oscar, is there a way to decrease the roll and pitch angle?
sorry what do you mean Graham?
do you mean how fast it spins when doing flips?
First I should clarify I’m using an Afro Acro FC. I’m new to this board and when I input stick commands forward or sideways my quad really tilts it’s almost perpendicular on roll or pitch. So I was wondering if there was a way to make it more suitable to my skill by having a max angle set. I think you can set this for use with high speed passes(Set max angle)?- For my needs similiar to kk2 auto level where the agressive angle on roll and pitch is reduced.
I assume you are running Cleanflight, and flying in Horizon mode? Use Angle mode, and the max angle you can tilt is 45 degree.
also, you can give it some more RC expo, the default i think is 0.65, increase it until you find comfortable.
I just found this : I think you’re looking for angle mode under mode selection – it’ll limit your angle to IIRC 45 degrees. You may also want to bump up the expo and reduce the rc rate under the reciver tab – it’ll make it less jumpy.
the CLI command “set max_angle_inclination” will set your max possible angle in angle mode. Default is 500 (50 degrees) i believe.
I think its better to play with expo to tone down the sensitivity a bit.
Turning the RC rate below 0.70 ish is something I would not recommend because it inhibits you to make sharp recovery manoeuvres should you be about to crash. Expo and small stick movements is key. 25-40 expo is normal i guess.
Just make sure your quad is balanced and the accelerometer is calibrated well.
– Kind of moot now my quad just did a pirouette on lift off . Now it won’t arm, the receiver tab shows roll jumping all over .
Hello Oscar,
Thanks for another awesome write-up! I’ve read several on your blog, but this is my first time responding.
As for some users reporting that there’s “no need for TPA anymore” with PID controller 1, I found tonight that with CleanFlight 1.7 on my Naze32 Acro, TPA has ZERO effect when using PID controller 1. To my dismay, this was discovered only at the end of a few hours re-tuning for the new PID controller. I’m running a very light rig on 4S, so I really depend on at least a bit of TPA to have it both locked in at hover, and have no oscillations at full throttle. I’ve switched back to PID controller 0 for now until this is resolved.
Hi Oscar,
Thanks for your reviews and articles.
Is the PID controller value set for every profile or can it be different?
Cheers from France ;)
Hi Bol2riz,
sorry ignore my last comment, it’s a “per profile” setting.
you can actually test it by setting it in profile 1 and switch to profile 2 and dump CLI settings to confirm.
thanks
Oscar
Thanks a lot mate.
nice write up, ive been looking for decent explanation, i thought pid controllers refer to profile, so today i was trying this pid controller = 1, same PID as before, man it was so touchy, luckily i was flying los at that time, i had to dial down my rc rates back to stock setting and both pich/roll, yaw rate to 0, after doing some minor tuning on rates,my quad feels more “locked in” and like you mentioned “direct response” from rc inputs, had trouble getting use to this new locked in sensation.
Glad to hear some positive feedback on the new PID controller! Yes, it feels different and takes time to get used to :)
really hope they can improve PD2 as well, and it should be the next level :D
Yeah, i was really excited with these changes, now need to understand how the “D” will effect the quad in pid controller 1 and see if it handles windy day. =) cant wait to see pd2 with new 32 bit algorithm
Hi Oscar, it is probably tough to implement. However, I’m almost positive I can that in Open Pilot. Although that’s PID banks. I’m might be wrong though as I haven’t tuned in OP in a few months, but I’ll double check.
I still find the difference between profiles 1, 2, 3 and controller profiles 0, 2, 3 AND rate profile 0, 2 , 3 hard to remember. I mean, I know what they mean now, but I think they could be differentiated better.
For example, read this in the Cleanflight docs and tell me it’s not confusing: https://github.com/cleanflight/cleanflight/blob/master/docs/Profiles.md
It’s like, seriously. The page is called “Profiles.” But WHAT profiles? And then you have two types of profiles on the same doc. And on top of that there is ZERO talk about profiles 1,2,3… only 0,1,2 and the configuration profiles exist and are 1,2,3. Ugh.
I know, I should be sending this to Hydra, not to you. Haha. Just chatting. Thanks for the awesome work man.
Hi Danny, you are absolutely right, Cleanflight is still in its early days (although I know Hydra started this project early 2014, but it really just took off late last year), I am sure documents will be better written, and software will be much more user-friendly :D All we can do is to give him feedback, and wait …
Thank you for the kind words Danny!
Is this the same as the 3 modes you pick with the tx sticks before you arm? I am thinking it is different but have not read into it much. Am getting ready to migrate over to cleanflight like your writeups they are very informative
Thanks for the great commend.
No, this is not the profiles. They are different PID algorithms, and they are numbered 0, 1 and 2.
You can choose which PID controller algorithm to use in CLI.
How much my Cleanflight installation has Profile 1, Profile 2, and Profile 3? (Not 0,1 and 2). Was the software recently updated to replace the numbering?
No, this is not the profiles. It’s the different PID algorithms, and they are numbered 0, 1 and 2.
You choose which PID controller algorithm to use in CLI.
Thanks for that Oscar. A friend just pointed that out to me a few minutes ago. Doh! I’ve fixed it up now.
But now that I understand profiles too… Is there a way to assigned Aux 2 to switch between the profiles? I don’t see an option for that in the modes tab.
I don’t think that is possible yet Danny. Imagine changing profile using aux, basically means you can changing all of the PID and rates settings during a flight, which is quite tough to implement I guess. :)
at the moment I think you can only use stick to change profiles while disarmed.