Dynamic Harmonic Notch Filter - First Setup

Hi guys,

So i’m finishing upgrading some drones and i now have to start doing again all the configs pre flight.

My question is:

1 - Before start doing the autotune, i should do the Dynamic Notch Filter first. Right?

2 - What Dynamic Notch Filter should i use for a quadcopter (BlackCube - 16’’)?

2.1 - Throttle position based  - INS_HNTCH_MODE = 1?


2.2 - In-Flight FFT based - INS_HNTCH_MODE = 4?

I mush say that i did some autotune already (without any dynamic harmonic notch filter) and the drone flies extremely well (low vibe and very stable @ althold and loiter). Even with this nice autotune is it recommended to do the dynamic harmonic notch filter first and then autontune?

Thank you,

  1. Changing any filtering generally requires re-running the autotune: for instance, some of the filters might have filtered away the fast movements which the copter is still able to react for. This applies not only to notch modes, but to various filter frequencies, and ArduPilot has a lot of them.

  2. For a copter, the best thing is - generally - the telemetry-based harmonic notch INS_HNTCH_MODE = 3, the next best thing is the FFT-based notch. Both are subject to the available controller resources, the former also requires bidirectional DShot which also may or may not be available.

  3. However, for large copters the telemetry-based notch might be of smaller efficiency, since the frame resonances may have bigger impact, so the FFT-based one may be actually better. As always in aviation, there are compromises, which are best resolved experimentally.

Well, since i dont have any bidirectional DShot, my only options are In-Flight FFT based or Throttle position based. And reading your reply the best option is In-Flight FFT based!

Do i need to ‘reset’ the results from the previous autotune or can i turn on directly (with the previous autotune settings) the In-Flight FFT based, fly and then autotune again?

Thank you,

Reset is not needed. Start the tune from where you are. It has the chances to complete very quickly :slight_smile:

@MaxBuzz i did the all the steps (In-Flight FFT Based Harmonic Notch Setup — Copter documentation) and the result was this: https://drive.google.com/file/d/1Nrk5XcgjcWqbFTu0KCmoonLnZbdFwaxN/view?usp=sharing

log before the FFT and log after the FFT.

Is there any good change? Cant understand what values should i use in the logs to see the diferences between before and after the FFT.

Cant you help me out?

Thank you!

DShot is not a requirement. ESC telemetry is. So you can use one of:

  • DShot with separated serial telemetry
  • Bi-directional DShot (contains telemetry)
  • A CAN-based ESC with telemetry like KDECAN, PiccoloCan, ToshibaCAN, Myxa, etc
  • FETtec OneWire with telemery

You don’t have batch logging enabled in either of those logs so there is no way to know.

Joao e necessario ler e executar todos os passos descritos na documentacao:

A primeira coisa descrita no topo da pagina e como configurar os logs.

@dkemxr damn! Thx. I thought that for In-Flight FFT based wasnt necessary that parameters.

@amilcarlucas esqueci-me por completo de acionar esses parâmetros. De qualquer das maneiras, depois de INS_LOG_BAT_MASK = 1 e INS_LOG_BAT_OPT = 0, tenho que refazer outra vez o autotune?

Nope, apenas refazer dois voos curtos para vermos o antes e o depois do Notch filter.

@amilcarlucas então agora tenho que ‘retirar’ o notch filter voar 30s, e adicionar outra vez o notch filter e voar.


No, keep the filter active, do not change it, just change:

  • INS_LOG_BAT_OPT = 0 and fly for 40 seconds
  • INS_LOG_BAT_OPT = 2 and fly for 40 seconds

Ok, gonna try it!

Thank you

I see that you have INS_HNTCH_OPTS=0. This is suboptimal, much better is to set bit 1 (e.g. INS_HNTCH_OPTS=2. This will track three notches instead of hell knows what. I also see it suspicious that FFT_MIN is 80 and FFT_MAX is 200; for me, these limits are somewhat too tight from both sides. For me, the interval [50; 400] looks much better.

From the VIBE logs I see that the vibrations in the “after” flight are slightly greater than in the “before” flight. This may mean nothing (e.g. “after” could have just been more aggressive), but this may also indicate that filtering does not work the way you want.

Based on the PID-related values I can also suggest that filtering made it slightly worse: ATC_ACCEL_{P,R}_MAX got decreased by some 10%, which is an indication for decreased control authority.

I suggest applying settings from the first paragraph, then re-running autotune, and then let’s see what happens.

@MaxBuzz the INS_HNTCH_OPTS is set to 1, in the ‘after’ flight. Wierd.

Regarding the rest of your post, gonna do the : ‘INS_LOG_BAT_OPT= 0 and fly for 40 seconds* **INS_LOG_BAT_OPT` = 2 and fly for 40 seconds’ - that Amilcar said first, then do a few ‘auto missions’ see how the drone flies.

INS_HNTCH_OPS bit 0 is “double notch”. This may be good, or may be bad. For me, it was typically bad, since the exact noise frequencies were not suppressed quite well.

So i did the two flights with INS_LOG_BAT_OPT= 0 and INS_LOG_BAT_OPT = 2’: https://drive.google.com/file/d/1GAnLn6yFzxUpyQ5jkNxtC8vev_OAig0Y/view?usp=sharing

Did it helped the notch filter?

Another thing that is bugging me is that after the autotune everything works ok and the flights (althold and loiter) are very smooth and twitch free*. But as soon do a few restarts the copter fligths (althold and loiter) arent that smooth and it twitch a little (alot more in loiter and hovering - wierd very wierd).**
Should i reduce the P values in the tuning tab?

Thank you guys for the tips and help!

*And yes the PID are saved after autotune.
**I’m having the same problem with two different builds (only difference is the GPS. One is a Here3 another is HERE+. The rest is everything the same). Could this be a bug of version 4.1.5??

Why don’t you see for yourself? Setup>Advanced>FFT>IMU Batch Sample. Then compare the Gyro graphs pre and post filter.

I did, and I guess the results are good. Right?

Yes, the filter as configured looks effective.