Improving Crazyflie 2.0 flight performance

While it is a central part of a quadcopter the core of the Crazyflie 2.0 had not moved since we released it. We deemed it to be good enough, it was flying and going fast after all.

Recently TheSeanKelly from the community did not hear it that way and started investigating the flight performance starting by the attitude control PID. The results so far are impressive!

Sean tuned the rate loop a lot, this is the loop responsible to control the angular rate of the Crazyflie in roll and pitch. Doing that and the attitude loop could be tweaked which we did a bit, the one responsible to control the absolute orientation of the copter. And the results is that two major issues with the flight performance seems to be greatly improved:

  • The take-off behavior: Crazyflie is currently not taking-off straight by itself. With the new settings this is fixed and at any thrust Crazyflie just goes straight up.
  • Attitude control: We had a lot of overshot in the attitude control. Basically it means that if you go forward 10 degrees and request 0 degree (level) the Crazyflie will overshoot with a negative angle causing it to stop. With the new tighter control if you ask +10degrees pitch the crazyflie accelerates and if you ask 0 it just stop accelerating. It will then continue at nearly constant speed. This is the “correct” behavior. This also means that the Crazyflie now reacts much more precisely and quickly to joystick controls.

We have tried to make a short video to show the new performance. Though the attitude control is really hard to show. We installed a test pilot on our Crazyflie that shows how much the new parameters helps in overall stability (I have tried to steer with old parameters as hard as I was steering with the new one). We also show more stability in pretty windy condition.

These new parameter have been pushed protected by an experimental flag. After more testing the official firmware will have much better flight performance out of the box :-).

8 comments on “Improving Crazyflie 2.0 flight performance

    • No, this is only configuring new PID parameters, there has been no change in the code so it is still a 500Hz rate loop with a 250Hz attitude loop. So there might still be some room for improvement ;-).

      • 250Hz is already great!
        Reading often about the Raceflight project on RCGroups, aimed at F4 boards like Crazyflie, which eventually aims at 32kHz Gyro interrupt/FC loop/ESC command ( later protocol called multishot). Is probably overkill, 8kHz looks more than sufficient, and yet, suppressing aliasing proves really useful.

    • Cool! On an unrelated note- (my apologies for posting on this unrelated post- unfortunately, it is the most recent post I’ve seen in months on the forum/wiki/faq/site, so I’m guessing that this will be the only place I’ll potentially rcv a response)- Im trying to connect a single LED to the CF 2.0 copter. Do I connect the LED postivie lead to VCC and the neg LED lead to GND?

      • Hi p s, We post every week (literally every Monday since 2012), and the forum is quite active. Anyway if you want to have an LED lit all the time when the Crazyflie is switched ON what you are describing, with a resistor to limit the current, will work. You can also connect the LED to one of the GPIO and make a deck driver. Do not hesitate to post on the forum :-).

  • Wow! This is an impressive improvement. I see that, in addition to an “experimental” flag, this is also confined to the Crazyflie 2 by defined(PLATFORM_CF2). Is the tuning not applicable to the CF1? Could it be made to work with CF1 as well?

    • If has not been tested on CF1. If you want to test, just remove the CF2 flag test, but be careful those settings are quite agressive. I guess the better way to go would be to test first with parameter to find if there is better PID settings possible for CF1.

  • PID tuning feels more like magic, not science. It’s also quite subjective — some people might want slower response in exchange for rock solid stability, whereas others want more responsiveness. With that in mind, I’m certain there are better coefficients for the crazyflie just waiting to be found.

Leave a Reply to arnaud Cancel reply

Your email address will not be published. Required fields are marked *