Necessary steps for harmonic notch setup?

Yes, if FFT_SAMPLE_MODE = 0. You can also sample at divisors of the loop rate by setting it to 1+

so if I set FFT_SAMPLE_MODE to 2, it will be INS_GYRO_RATE/2?

No it will be SCHED_LOOP_RATE/2

What’s the difference between FTN.DnF and FTN.PkAvg ? My understanding is that CTUN.N, which is the harmonic notch current center frequency for the gyro in Hz, got moved to FTN.DnF at some point. If INS_HNTCH_MODE = 4 (dynamic FFT), FTN.DnF AND FTN.PkAvg should be very nearly the same, right? Otherwise FTN.DnF is static?

Yes. Although DnF will always reflect the harmonic notch frequency - it means you can compare the peformance of the FFT with throttle based for instance

Hello @andyp1per ,
I saw some other posts about fft, like this My quad with cube orange wobbling in position hold - #28 by andyp1per, that you say there is a enormous peak somewhere and that the fft is not picking it up. How do I check that?

Also, I saw this other post with this image:


and you said the second peak was probably the motor peak, could explain why?

You do an FFT using the batch sampler. Measuring Vibration with IMU Batch Sampler — Copter documentation

Is there a way to log to both the pre filter data and the after filter data from the same flight? The way I have been doing is to do a flight without the harmonic notch enabled, log, do another with the notch enabled and log, and then compare

Sorry, no. I agree it would be useful but it’s likely the datarate would be too high

Why does setting up the fft and dynamic harmonic notch with the state of hover is so important and not other state? Like if I did the test flight in another mode instead of alt hold and kept increasing and decreasing the altitude, would this data be useful or not?

If you are doing throttle based notch then the RPM scaling is calculated from hover - that’s why you need to know the RPM at hover thrust

So if I am using fft, I just set up FFT and fly or does still needs a test flight?

If you have a tune that works without the notch then you can just fly. Just be careful if you are switching from throttle to FFT.

while using FFT, if I make a change to INS_HNTCH_FREQ, is it ignored or does it have an effect?

for the drone, the rotational frequency from the motors are supposed to be a mid throttle approximately 60 Hz, but the PkAvg is closer to 120 Hz, the first harmonic. Did I screw up some parameter?

Whatever driver you choose, INS_HNTCH_FREQ is always the lowest frequency to which the notch will go. Other than that it will affect the Q value of the notch if you don’t change BW at the same time.

For bigger drones this is quite common with the FFT because the first harmonic is often more energetic. The algorithm makes some attempt to figure out whether the highest peak is actually a harmonic, but it’s not perfect. You can play with FFT_HMNC_FIT to try and improve this. You can also set FFT_HMNC_PEAK to 2 to try and pick up the first harmonic - but you should check that it is being detected first.

so in this case I should try FFT_HMNC_FIT close to 50% to see if FFT realizes the central frequency is actually 60 Hz instead of the first harmonic?Sorry I am getting a little confused with this parameter

No, I think you should leave it as it is. The default is 10%, basically it says if there is a peak that is within 10% of being a multiple of the main peak then consider it a harmonic. If the lower peak is being tracked in FTN2[1] (say) then you can play with the other parameter. If its not being tracked then it won’t help.