In this episode I talk about:
- How Betaflight, Cleanflight and INAV filters gyroscope signals
- What is the difference between LPF and notch filter
- How to setup blackbox logs for precise gyro signal analysis
In this episode I talk about:
I’m not completely sure why, but I’ve been pushing this topic away for quite a long time now. But it’s finally time to present it in this blog too. So, here we go.
Something like 3 month ago I’ve started to record and publish a video series about basics of gyroscope data processing in modern flight controllers (Betaflight, INAV, Cleanflight). It started as a tutorial how to setup notch filters in INAV, but ended up as a much bigger thing. Series consist of 4 episodes where I use Blackbox logs to show gyroscope signal noise and how to fight with it. Over next few days I will be posting links to those videos here, but if you eager to see them sooner, just use this link.
In Episode 1 I talk about:
Ah yes, I’m running a YouTube channel too, feel free to subscribe 🙂
Last weekend I’ve experienced quite serious problem with Reptile X4R 220 racing quadcopter: on full throttle quad was loosing stability. At first, it was starting to drift yaw to the right. Then, if throttle was not lowered, roll and pitch was also becoming unstable and quad was doing crazy things in the air.
I do not have a video footage of those issues, but Blackbox footage looks like this:
Roll, Pitch and Yaw sticks are at zero, throttle is raised from aroung 45% up to 90%. When throttle reaches around 80%, gyro starts to record movement on all axises. At one point, yaw gets a kick and reaches more that 200dps. Finally, I lowered throttle and quadcopter stabilized (moment of stabilization is not visible, but trust me, it is there).
The reason for such a behavior became pretty visible as soon as I displayed motor output:
Flight controller requests much more power from Motor #1 than from other motors. Not only in this short scenario. Look at this graph:
FC requests more thrust from Motor #1 almost all the time. Why? Motor #1 provides less thrust than other motors. There are few possible reasons:
In my case, it was ESC calibration issue. While this might sound strange, ESCs loses calibration from time to time. Usually after a crash that resulted in detached battery.
Proper ESC calibration solved all the problems I was experiencing.
Cleanflight / Betaflight / INAV lowpass filter tuning can be a hard thing to do if you have not idea what is noise frequency you want to cancel. Sure, you can blind test or read tutorials. But what if I tell you, you can measure it quite precisely using only Blackbox logs? Or measure rotation speed of motors? That would be nice, isn’t it? The only requirement are few seconds of Blackbox log with visible gyro (it can be also motor output or Pterm or even ACC reading) noise.
“What goes up, must come down”. I had an opportunity to face this old truth 2 weeks ago, when my 600mm quadcopter felt from 30 meters straight into water.
It was supposed to be a simple flight:
Dozens of missions like this in last few months, so really, nothing special. Unfortunately, like I mentioned above, not everything went as planned. 2 minutes after take off, UAV lost stability and went down with screaming motors. Continue reading “Air Crash Investigation: gone in 6 seconds” »
After a short brake, let’s return to Blackbox series with new entry: “How much gyro noise is too much?”.
Almost all PID tuning tutorials states: reduce vibrations that affects gyroscope and accelerometer readouts. Yes, this true: any vibrations that appear during flight affects gyroscope and accelerometer readouts are bad and should be kept as low as possible. This can be done by balancing motors, propellers, using stiffer frame, adding dampeners, lowering LPF filters. But how much vibration induced gyro noise is too much? Let me answer with four Blackbox screenshots:
This is how it should looks like! Perfect trace. If it is archived without lowered LPF filters, then kudos for balancing everything!
Little noise appears, but amplitude is low, everything is under control.
Gyro noise is visible. It is not a problem yet. If it was a result of raised LPF cutoff frequency, extra noise might be worth lowered signal delay. I would start to think how to reduce it on a hardware level. Perhaps bearings are dying, or propellers should be rebalanced?
This is how unflyable gyro noise level looks like! If you see have problems with flight performance, you know what is causing it. This have to be fixed ASAP before everything else.
This is third part of Cleanflight PID tuning tutorial with Blackbox. Previously I’ve showed examples of:
This time it is time for something slightly different: not enough P gain. Usually this problem can be identified without any log analysis. Symptoms are quite visible: multirotor is sluggish during maneuvers, has a tendency to change attitude on its own, constant course corrections are required. In worse cases, it is unflyable. But how does it look like on Blackbox logs.
First of all, symptoms are not so clearly visible. There are no huge oscillations for example. Zoomed out log might event look good on a first glance. For example like this:
Welcome to second part of Blackbox PID tuning tutorial. Last time I have showed few examples how excess P gain might look like. Today I will write few words about next common PID tuning problem: too much D. Derivative (future) part of PID controller is very useful, since it allows to smoothen control loop output when it is reaching the target. So, at the end of move (roll, pitch, yaw, anything else) multicopter will start to “slow down” before target is reached. It’s just like accelerator pedal in a car. When you want to reach 50 you start to release it before you reach 50, and not in the exact moment you reached target speed. If you would, you would have to use brake to slow down to 50. Derivative part helps not to overshoot. Without it, movement would be shaky, not smooth.
Unfortunately, D is tricky. Like everything that tries to see the future, it is unreliable and can introduce noise. We do not like noise. Not enough D = shaky, mechanical, movement and overshooting. Too much D = extra noise, vibrations, damped response.
How excess D would look like in Blackbox logs? Like this:
Almost all quadcopter PID tuning tutorials can be summarized into one sentence: “Increase P until you see oscillations, then lower it”. Plus some thoughts about I and very vague advices about D and that is all. When I got into the hobby, I’ve read all of those tutorials. And I did know more about PID tuning than before that. I even had more questions than before. How to recognize high frequency oscillations, how to recognize low frequency oscillations. Lower P? OK, but how much? And D? How to tune this bloody D? As a result, every time I tried, I ended up with very snappy but shaky quadcopter that maybe responded very quickly to commands, but was very shaky and was making strange noises.
And then came Cleanflight and Blackbox. Live became simpler. What I’ve learned from Blackbox logs is that I wanted high P so much, I had too much of it in the end. Actual oscillations begins before we see or hear them and excess D introduces jello. Blackbox simplified things, but still, logs analysis is something like an art. You have to know what to look for. Continue reading “Detecting Cleanflight PID tuning issues with Blackbox: excess P gain” »