FFT based harmonic notch filter for dynamic tuning

Dear Friends,
Am using quadcopter with pixhawk V5+, and working on dynamic FFT tuning. I have provided the parameter settings detail below. I made the test fligth with same settings, has a stable flight and the corresponding flight log is attached for your kind reference.

Please clarify the following quries on FFT dynamic tuning,

  1. For FFT turnig Alt hold or Loiter mode, which mode is preferable.
  2. How to check frequency and bandwidth through log.
  3. Wheter frequecy and bandwidth changes automatically on flight, if FFT dynamic is enabled.
  4. For sampling 1 IMU or 2 IMU is preferable.
  5. For Harmonnic notch fillter settings: what is the role of attenuation value and please specify how to find the attenuation value.
  6. As seen from literature, the reference frequency value selection is that half the value of bandwidth, its true.
  7. Plase guide me to chose the sutable frequency and bandwidth value throught fligth log.
  8. Please check the correctnes of below mensioned the settings for dynamic FFT and throttle based notch fillter.
    Dynamic FFT Tribble Notch Filter
    Ins_log_bat_mask= 3
    Ins_log_bat_opt= 4
    Ins_hntch_bw= 40
    Ins_hntch_enable =1
    Ins_hntch_fm_rat=1
    Ins_hntch_freq=80
    Ins_hntch_hmncs=3
    Ins_hntch_mode=4
    Ins_hntch_opts=16
    Ins_hntch_ref=1
    2.Throttle based
    Ins_log_bat_mask= 3
    Ins_log_bat_opt= 4
    Ins_hntch_bw= 40
    Ins_hntch_enable =1
    Ins_hntch_fm_rat=1
    Ins_hntch_freq=80
    Ins_hntch_hmncs=3
    Ins_hntch_mode=1
    Ins_hntch_opts=0
    Ins_hntch_ref=1

log file

With Thanks & Regards
Dr.V. Kirubakaran

  • For FFT turnig Alt hold or Loiter mode, which mode is preferable.

For tuning it’s good to have both in the same log because Loiter uses the position controller so we can see if any issues are coming from that, compared to AltHold

  • How to check frequency and bandwidth through log.

There is ample documentation. There is the FFT analysis graphs in MissionPlanner and a couple of other methods. If you are using in-flight FFT some parameters are modified and data logged with what the FFT found.

  • Wheter frequecy and bandwidth changes automatically on flight, if FFT dynamic is enabled.

Yes it should if all configured correctly

  • For sampling 1 IMU or 2 IMU is preferable.

Usually just 1 IMU needs to be sampled, usually your best quality/fastest IMU. This is typically your first IMU.

  • For Harmonnic notch fillter settings: what is the role of attenuation value and please specify how to find the attenuation value.

Use google to look up notch filter and attenuation. There is usually no need to change attenuation.

  • As seen from literature, the reference frequency value selection is that half the value of bandwidth, its true.

No. The bandwidth value is half of the notch frequency value, as a general rule or starting point. It doesnt always have to be half.

  • Plase guide me to chose the sutable frequency and bandwidth value throught fligth log.
  • Please check the correctnes of below mensioned the settings for dynamic FFT and throttle based notch fillter.

Data from the log:
image

The problem with your in-flight FFT is that it has found and focused on the harmonic at around 88Hz instead of the base frequency of 44Hz, due to:
FFT_MINHZ,80
which is a default value, and it came up with:

FFT_BW_HOVER,72.82701
FFT_FREQ_HOVER,88.81602

which does produce a result, but not the best result.

For in-flight FFT based notch filter I would set these

FFT_ENABLE,1
FFT_MINHZ,30
INS_HNTCH_BW,17
INS_HNTCH_FM_RAT,1
INS_HNTCH_FREQ,35
INS_HNTCH_HMNCS,3
INS_HNTCH_MODE,4
INS_HNTCH_OPTS,0
INS_HNTCH_REF,1

For dynamic inputs to the notch filter, like RPM or FFT, the bandwidth and frequency scale UP with the input → so they must start a bit lower than the frequency you need to target.
You would still need to analyse a test flight to make sure the FFT and notch filter is working as intended.

For throttle based notch filter I would set

FFT_ENABLE,0
INS_HNTCH_BW,20
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_FREQ,42
INS_HNTCH_HMNCS,3
INS_HNTCH_MODE,1
INS_HNTCH_OPTS,0
INS_HNTCH_REF,0.17

And you will end up with this result:

Unless you have constantly changing payloads, I would just use the throttle-based notch filter. It has minimum overheads, in case you ever need to use more CPU power for LUA scripts or something else.

For other general improvements you can set:

ATC_THR_MIX_MAN,0.5
BATT_FS_LOW_ACT,3
INS_ACCEL_FILTER,10
PSC_ACCZ_I,0.4
PSC_ACCZ_P,0.2

and run Autotune once you’ve settled on a notch filter configuration.

Dear Xfacta Shawn Friend,
Thank you for your detailed guidance friend!
As per your guidance, I have followed the parameter and corresponding log file attached for your kind reference. Had a very good difference on flight stability after changing the suggested parameters, Please share your feedback by reviewing log file.

log file

Need your kind suggestion:
The above FFT based harmonic notch filter for dynamic tuning was used on 5kg drone, can I use same parameter setting for 100 kg model.

Which notch filter best option do you prefer for heavy lifting drone of 100 kg takeoff weight.

  1. In-flight FFT based notch filter
  2. Throttle based notch filter
    Which one is best?

Once again thank you for your support and guidance.

Have a great day,

With Thanks and Regards
DR.V. Kirubakaran