Doubts regarding Dynamic Harmonic Notch Filtering

Hello,
So I’m just done setting up my craft, which is a 12S system, 30inch Prop size, with AUW around 17kg.
I have flown in Stabilize mode and did the Alt-hold tuning.
I was advised the next step is to setup the dynamic harmonic notch filter, and seeing the docs for it, I have a few doubts:

  1. I have the option of throttle-based or the in-flight FFT. Which should I go for? I’m using Cube Orange Plus and it has exactly 2MB of flash as I saw. So is there any performance risk if using In-flight FFT?
  2. How many Notch Filters is recommended to setup:
    As I understand, INS_HNTCH_HMNCS sets the number of harmonics, and INS_HNTC2_ENABLE will enable another notch.
    I am unsure on how many harmonics to use and whether to use the second notch.
    My main concern is I do not want flight performance compromised by the computations, as my end goal is to achieve 20m/s speed Auto Flights.

Also, if it helps, this is a log file without any dynamic notch filtering setup, but INS_LOG_BAT_MASK set to 1. It would be great if someone could advice me on how to setup too, as the docs seem a little complicated to me.
https://drive.google.com/file/d/1EmwwU7DMGAXj0uFXsl5kOXRR8RLZojhs/view?usp=sharing

The Cube Orange has plenty of processing power and memory to run the live FFT, however I usually recommend the throttle-based harmonic notch filter for copters with large props, as I’ve struggled to get the FFT and HNOTCH to target the correct/low base frequency. It works OK with smaller props and higher frequencies.

In you case you would set these, although some here are related to general tuning based on your log

ATC_THR_MIX_MAN,0.5
GPS_GNSS_MODE,65
INS_ACCEL_FILTER,10  // the new normal
INS_HNTCH_ENABLE,1  // set this then refresh params to see the rest
INS_HNTCH_BW,20
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_FREQ,37
INS_HNTCH_HMNCS,3
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.16
PSC_ACCZ_I,0.4
PSC_ACCZ_P,0.2

image

image

The vibrations for your non-damped IMU are getting a bit high, but your damped-IMUs are not affected much at all. I would still try to improve the vibration situation in case the flight controller ever needs to use that IMU.

1 Like

Hey, thank you so much for your recommendations. I am currently on field testing this stuff out.
I have a few doubts:

  1. How do we tell which frequency spike is the center freq? I initially concluded that 73Hz was the center frequency.
  2. How do we tell how many harmonics to set the notch to filter out? I see three spikes in my logs but the default and your recommendation was just 1st and 2nd.
  3. INS_HNTCH_REF as I understood should be set the same as MOT_THST_HOVER. Wouldn’t this be 0.2 in my case? Your recommendation says 0.16.
  4. Will the GPS_GNSS_MODE change if I had to fly, in say, the opposite side of the world?
  5. The docs mention about double/triple notch and even says its suitable for large copters, but your suggestions leave them untouched.

Any suggestions on how to improve? And would it be a recommendations if I would want to attempt 20m/s auto flights in future?

Regardless of these doubts, I went ahead and put all your recommendations as it is on my UAV, and conducted a test flight. The only difference is that I enabled triple notch through INS_HNTCH_OPTS.

I’m just a beginner so I’m not fully sure, but I think its much better now. I would love your input on how the performance of the Dynamic filtering is now.

Here’s the log:
https://drive.google.com/file/d/1KoXCu8XztAY5YKngVhn5D7T11c1RNTdf/view?usp=sharing

The first large peak is rarely the base frequency. In my updated spreadsheet I did some rough calcs to get the frequency based on prop size. It’s not definitive but a guide, since many unknowns will contribute to that frequency. Generally it is RPM/60 but often we dont know what the RPM really is unless you have ESC telemetry data.
Spreadsheet linked below - this was the basis for the MissionPlanner Initial Parameters

We can easily adjust this after subsequent flights, there wont be much detriment how it is now. There looks to be three harmonics on the FFT graph, so you could select that option too.

The real formula is
INS_HNTCH_REF = hover_thrust * (min_freq / hover_freq)^2
but this is near enough for now
INS_HNTCH_REF = hover_thrust * 0.6 or 0.7
I didnt want to go too low because you have a high MOT_SPIN_MIN - sounds

No, ok to leave it like it is and that will be fine. If you fly in UK or western europe (EU?) you might want to select Galileo instead of GLONASS provided your GNSS unit is capable if using it.

You only need to set these if required, and they can introduce lag in the attitude control system if you get it wrong

It’s a good idea to improve vibrations regardless of the intended purpose or speed. As your speed increases you will have more vibrations, so it will be critical to get it sorted now at low speeds, and in order to get the best possible tune.

In that new log if you check attitude versus desired attitude (pitch and roll) and compare it to the previous log, you will see all the “noise” has been removed.
And motor outputs are also improved.

You can see on the FFT graphs (Gyro0 is pre-filter and Gyro3 is post-filter) that practically all the noise is squashed. There’s no need to change any of the HNOTCH settings after all !

Attitude control is quite good considering you have default PIDs - you could try Autotune, probably on one axis at a time.

Your calculations seem to be spot on! I checked with the motors RPM data for the hover throttle and it does come around 36Hz.

Thank you so much for clearing the doubts. Makes total sense now.

Lastly, Could I get your help to confirm from this flight log that the Dynamic Notch filtering worked well?

If yes, I should be able to proceed with auto-tune right?

Yes, already did another reply

Oh, my bad. I missed it while typing my reply :sweat_smile:

Your inputs ended up being a godsend to me.
I appreciate all the time and effort you put into this! Thank you.
Have a great day

Cheers,
Nihal.