Harmonic notch support (ESC, Throttle, FFT)

Thankyou for this thread
I have just finished converting a DJI S900 to Cube Orange ardupilot, and am using FFT for filtering due to 2 distinctive peaks. There is definately some filtering occuring but I think I should expect more, and feel I have probably missed something in the parameters. I would really appreciate if someone was able to help identify my miss. Pre top, Post bottom

And link to BIN

This is a really interesting log - thanks for sharing! I don’t think you are doing anything particularly wrong here, but clearly the FFT is struggling to pick up a distinct signal. I would suggest a couple of changes:
Change

FFT_MINHZ = 50

Since that encompasses your frequency range better. Also since you are on a cube orange try increasing FFT_WINDOW_SIZE to 128 or even 256. Sometimes that means the engine is able to pick out the frequency much better

1 Like

@andyp1per i read on the wiki that PM.Load and PM.NLon should be at 60% and low 10’ respectively.
My orange cube without fft enabled has an average load of 354 and an average nlon of 0,01.
So i guess nlon is fine but why do i have so high load? Is 354 intended as 35,4%?

thanks

Load is in % so yes you must be seeing 35.4% which sounds about right. This only represents load on the main thread.

Ok thanks, enabled mode 4 as per wiki, will test saturday.

Did my test only today because of bad weather. Just did a couple of 30 seconds overs after setting up in-flight FFT.
Had a lot of lane switching in flight 0—>1---->0, never seen it before, could it be related to the FFT enabled? It is a cube orange.

Need to see a log - it’s possible

Log:

https://mshelisrl-my.sharepoint.com/:u:/g/personal/davide_monti_mshelisrl_onmicrosoft_com/EcHE002OdKdGo7CISVSZT3wBAhN4MoQeErlpuw8GNUpxTg?e=hS0scU

It is a brief test hover in alt hold, with notch filter driven by FFT.

Yeah, it’s not tracking well. There is another long thread on FFT tracking - the conclusion on these bigger copters is that a longer FFT length will track much better. On a CubeOrange you can go up to FFT_WINDOW_SIZE = 256. The first harmonic is at 95Hz or so and the engine is bouncing between 1st and second harmonics. The other thing you can do is set INS_HNTCH_OPTS=2 - this will give a separate notch per FFT tracked peak which works a bit better when the tracking is not great. Last, but not least, the engine tries to minimize the bouncing by making a guess as to which peak is dominant over time, but this relies on having a consistent number of peaks (3). Since you have the maxhz set to 200 you will be missing the third harmonic at 285Hz and I suspect this may be confusing the algorithm (yes it should cope, its on my to do list), so you could try setting FFT_MAXHZ = 300 to make sure you pick up all three peaks.

I really need to do the equivalent of LOG_REPLAY so that I can replay IMU data and tune the algorithm to cope better with these situations …

Andy thank you.
Ekf lane switching can be due to these problems you are telling me?
The copter is a 20 inch prop, 10 kg, so not small but not huge.
So what can i try?
Windows = 256
ins opts = 2
fft max = 300
Something else?

Lane switching makes me a bit nervous. Is it possible that the copter was flying a bit worse because of the filter acting weird?

p.s. tonight will carefully read the other thread on fft.

The lane switch is because your positional down innovations are high. I can’t quite figure out what is causing that. It’s possible that additional noise introduced by poor notch tracking is introducing this. Were you flying with the throttle based notch before?

Yes try those three settings together.

I was flying without notch before.
Can you elaborate a bit more on positional down or let me know where i can read about it please?

Is it IPD Innovation in position (Down component) in EKF3?

Yes. So in AltHold it might be because the baro and GPS velocity disagree

GPS is in RTK fixed while barometer i am using internal, maybe should set gps as primary source, anyway never did it before i enabled notch, maybe just a coincidence.

Wich one is the correct long thread for the fft?

Looks similar to yours from an FFT perspective although clearly less well tuned and physically set up

Thanks Andy, i have read it. Main difference is that mine flies pretty well without notch and is decently tuned. Mine has probably more than 1000 hours flight time (it doesn’t show on param because we recently switched to cube orange.
Another thing we changed is the cover of the drone, it is much smaller now and maybe the fan creates some funny air flows inside the frame and the internal barometer we use isn’t happy.

@andyp1per looking at the barometer in the logs there is definitely something wrong and lane switching happens at the exact moment the baro has a glitch.
I don’t know if the FFT enabling can have anything to do with the barometer stop working.

Just checked the last log before the one with FFT enabled and barometer was working correctly. Probably has nothing to do with it but i tought it was better mention it to you in case it rings a bell :slight_smile:

Should not be connected in any way

So i guess i have a problem with my barometer :slight_smile:

@andyp1per how did you find out from the log that the lane switching was due to the innovation in position?