Copter 4.4 Notch filter Tune for fast dynamic flight

Hi guys, I am trying to build a quadcopter for professional use and having some questions related to the filtering and tuning that I hope I can get a bit of advice on.

With current tune, it seems to fly really good with no wind, but is kind of concerning with moderate winds. I just think it can be improve more than right now.

Main questions I am having problems with are regarding filtering I think. Please let me know if you guys have any feedback on the following:

  1. Filter setup (any advice based on the below?)
    INS_HNTCH_REF was originally set to ref of 0.24, and this seem to work pretty well on the filter analyzer tool (see below)


    But in dynamic flight with this filter setting, the drone start really oscillating bad when it slows down after fast movement. I found out that the throttle is dropping pretty far below the 0.24 reference frequency, so I used this idea from the documentation:
    image
    Now I set filter INS_HNTCH_REF to 0.06 and adjust settings accordingly, and it seem to also track peaks reasonably well.

    But even with this setting on the filter, autotune isn’t producing very high gains (around 0.08 at most for Rate P/I on pitch/roll).

  2. Filter comparison question (is my thinking correct?)
    When I compare different harmonic notch filter settings, I am also looking at frequency response, specifically phase delay at some frequency of interest (e.g. at 10 Hz, I see -51deg phase). I believe that we want the least amount of phase delay in our frequencies of control, right? So comparing a filter with a really good attenuation of peaks, but really high phase delay probably means that control will be compromised, right? And it will have less stability margin. Is there any rule of thumb for analyzing this? I mean, if we have to push the harmonic notch frequency down really low, this will result in more lag/delay in the controller, correct? Would there be a recommended minimum notch filter frequency? I know I can build a notch filter that kill all peaks strongly, but I am worried it will cause slow/laggy response.

  3. Is there any reason not to use IMU3 on the Cube Orange? I see it usually has a lot lower noise floor on the FFT analysis.

  4. Going back to my question about lag and filtering. I always see this kind of delay on the rate control, and wonder if this is within a range of normal/good for a large quad, or if this is bad tracking.

Thank you for looking. Hope to learn more about all the filtering and improve the results.

I know my original post was long, but I have done a lot more reading. Specifically, I found this post. @xfacta I know you helped this guy a lot and I have a very similar build. Wondering if you have any advice. I think I am getting closer to the root cause of the solution based on many experiments.

I find that I can get the drone tuned pretty stiff and it feels good and responsive in the wind, but then with that tuning, I see problem with fast speed and slowing down. Specifically, there are a lot of oscillations on pitch axis when I slow down.

And I find that this only really happen when the throttle output drops below a certain value. So I have two competing theories and wondering what you think is the more probable (or maybe something else?):

  1. Since throttle is dropping so low during high speed braking, the notch frequency also drops low and increases the phase lag, resulting in oscillation and instability while it is in this mode of operation.
  2. It’s possible MOT_THST_EXPO not perfect and a little high. Maybe for this, motor outputs not scaling correctly at low range and causing instability.

I am using T-motor P80x, which have alpha ESC inside, but I previously do thrust stand experiment and think that it match about 0.82 the best. However, I can do some averaging on data and it look like maybe 0.7 also fit pretty good. I also see in the post linked above that he is using 0.7. Do you think a change from 0.82 to 0.7 could make a good improvement?

I also found a new filter setting that uses 72Hz frequency and has less lag:


Still need to test this though.

Thanks if you read this.

Have you got a .bin log we can look at?
Usually you only need to filter the first and maybe the second harmonic. Setting more harmonics than necessary introduces more overheads than necessary. Use the post filter graph lines to determine which harmonics really do need filtering, or can be ignored.
Use the “Linear” amplitude scale to make things easier.

Yeah here is last flight where oscillation is happening.

Thanks for other tips.

Z axis vibrations are getting a bit too high. It’s not causing a specific problem right now, but it will, and it makes tuning less precise.
Attitude control is reasonable.

For the attitude control I would lower the D terms a bit, alter the expo slightly and do these other general changes:

ARMING_CHECK,1
ATC_RAT_PIT_D,0.0043
ATC_RAT_RLL_D,0.0043
BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2
FENCE_ENABLE,1
INS_LOG_BAT_MASK,1
LOG_BITMASK,180222
MOT_THST_EXPO,0.77

And for the notch filter I would use these - for your size props the FREQ should be down around 30Hz somewhere.

INS_HNTCH_BW,15
INS_HNTCH_FREQ,35
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_HMNCS,3
INS_HNTCH_REF,0.19
INS_HNTCH_OPTS,0

The primary motor noise seems to be quite low, but the harmonic is very high, so if you can improve the physical Z axis vibrations it is likely that large 2nd harmonic will be significantly reduced.

I would hold off making more notch filter changes or tuning adjustments (other than what I’ve listed here already) until the Z axis vibrations are sorted out.
Then Autotune will probably do quite a good job.

Hi Shawn,

Really appreciate your tips here. I will try doing more experimenting with what you said and report back in this thread.

Just wanted to see if you might be able to provide your opinion on the root cause of the oscillation in the previous log. Do you think it may be related to MOT_THST_EXPO being too high, or possibly the notch frequency dropping low and having a lot of lag?

Could be too many harmonic notch filter options causing lag I think.

Also in the graph I posted it looks like the primary harmonic is not even needed, but I figured we’d leave it in place in case that frequency becomes more pronounce (and hopefully the 2nd harmonic reduces) when you do something to reduce the Z axis vibrations.
After another test flight we should know more.

Hi Shawn,

I try messing with some ideas to remove Z axis vibrations, but I don’t think it’s making a big difference. It now would take some time to rebuild with a different strategy for mounting flight controller as I using rigid carrier board and not a lot of room to mount differently. I might be able to figure out something for the future.

I went out and did a lot of experiments actually and would say that maybe the performance is improved. In the past, the limiting factor was rapid oscillations after slowing down from high speed runs. This time, I even got up between 24 and 27 m/s before seeing those oscillations, and this seems maybe even too fast for comfort. But based on re-evaluating my thrust curve and the settings from that other post I linked earlier, I decided use 0.7 for MOT_THST_EXPO. I tried some of the other filter and log settings you mentioned. With old PID tuning, it seems like maybe it performs better now with new filter and MOT_THST_EXPO setting.

However, another AutoTune did not improve the gains, and the AutoTune output was pretty scary (>30 degree overshoot one time). Also, I tried tuning the SMAX values based on what little I know about them from the documentation, and this also did not seem to improve. Finally, I tried setting ATC_THR_MIX_MAN to 0.5 and I have really scary experience with bad oscillation, so I change it back to 0.1.

I would say this log is the best performance of the day. Do you have any feedback about filter (or other) settings here? With the lower speed attitude logging, it’s hard to see the rapid oscillations. I have many other logs, even with the 70 Hz filter, but only sharing best log here for you to look at if you have time.

Thanks.

@xfacta I have one follow up question if you have time to take a look. I did one more test just to see the difference between ATC_THR_MIX_MAN at 0.5 vs 0.1. 0.5 results in a very scary overshoot and does not feel good. 0.1 feels much better all around. What do you think about tuning this 0.1 even lower, like 0.05? Have you ever heard of this being done? Do you advise against this?

Thanks.

0.5 is not very high. If you are getting scary overshoots then I would suspect that your tune is not that great.

Cue shameless plug:

2 Likes

I am facing the same delay like you mentioned on the 4. observation. How did you solve it?
Thanks.

Hi, I still have not managed to make too much progress on this since asking. Been too busy. How big of a drone are you flying?