Tuning the Harmonic Notch

If I want to test this on the bench (1 motor connected) Enable FFT and set RPM_TYPE to 4? The motor is spinning w/o a prop so the vibe levels are very low perhaps it won’t catch it? The RPM data in the log has a couple spikes.I have ESC telemetry on this bench rig so I wanted to check it.

You will also need to set INS_HNTCH_MODE to 4. Yes on the bench the vibe spike could easily be too low for the FFT to catch it. You can tune this with FFT_SNR_REF but I have to say that the default was found through blood, sweat and tears so if you change it don’t fly with it!

Yea, I had set that. No flying, this is on my Gold Standard, World Class, Cutting Edge Bench Test Rig :grinning: This is what happens when one has too much time on his hands and a drawer full of parts.


Dave that’s a pretty sweet looking test jig you have there :+1:

Does the notch filter support UAVCAN ESC rpm reading as input?

No. Someone needs to generalize the ESC telemetry support - currently only BLHeli is supported.

Andy-Think I saw the answer to this somewhere but if using ESC telemetry RPM is it an average of the motors? I ask because on another thread the genltleman has an X8 with different size props top to bottom hence different motor RPM between the 2.

Yes an average of the motors that are currently returning valid RPM information

Thanks @dkemxr, that same question I was wondering about, could be possible to have 4 or less independent HNTCH filters based on the valid RPM information? Could this be better then 1 double HNTCH filter based on the average?

Yes this is what betaflight do - it would be better but costs CPU and at our loop rate might be problematic. So we should do this but there are a bunch of caveats.

1 Like

This reminds me how much I would like to fly and tune small copter with loop rate higher than 800, I remember this https://github.com/ArduPilot/ardupilot/pull/10325 and this discussion LOOP RATE higher than 800 and telemetry message issue
But apart from testing, I can only try to ping master @tridge here :slight_smile:

Back in the summer I started a branch to try and work through these issues but got derailed by other stuff and the fact that I don’t understand the code well enough. It’s very much on @tridge’s radar I believe but when is an entirely different matter :slight_smile:

Ok, I enabled FFT and the logs are making more sense now.

Here’s before filtering

Here it is after filtering

It’s certainly a big improvement compared to the unfiltered graphs.

Any suggestions for knocking that last peaks down? Increase the filter attenuation?

Pre filter log -https://drive.google.com/open?id=1owD0ZMXCYiaf9SFWRIS1KDbWupEx1Wvt
Post filter log - https://drive.google.com/open?id=1WG-TKFs_w_6uiYQAZJ4bxMBXFmxigLiU

I’m still on 4.0.4 and I’m not seeing a CTUN-N in the logs btw. I can put 4.0.3 on it and see if it works like it should.

The dynamic notch frequency log has moved in master. Here it is together with the in-flight FFT estimate:

The problem is immediately apparent - the notch is only targeting the second harmonic because you have INS_HNTCH_FREQ set to 80 so that is as low as it goes.

Ok, because you have ESC telemetry I believe you can go lower, but be careful - 40Hz is right into your control bandwidth and I have seen issues in test with the notch going into my control bandwidth (i.e an unflyable copter) I’d be interested to see what the FFT makes of it. So change:


and be really careful when you take off. It should be fine but this is uncharted territory for me. The low BW is so that you are only targetting a very narrow frequency range. If that seems fine and the graphs look good but are still not squashed try increasing it to 10.

Thinking more - if you copter flies without the notch then it is definitely safe to go down to whatever you have INS_GYRO_FILT set to, just beyond that that you should be careful. I have two copters that are tuned so that they will not fly without the notch and that’s where things get dicey.

Good luck!

1 Like

Sorry for a little OT here, but what are you using for your YAW filter settings on microcopters?
I’m struggling to get a good yaw tune. Sometimes yaw starts oscillating for no apparent reason… Raising or lowering the throttle makes it stop.
Autotune gives me horrible yaw results. (it’s always too low, and I get big slow oscillations and slow bounce back after turning) Then the best I’ve been getting it manually tuned is to where it’s usually OK. But randomly breaks into oscillations at times.
Autotune puts the filters very low. I had manually increased them in the past, but someone (Tridge or Leonard) said it was a bad idea to increase the yaw filters so much, when they were review my logs for something…

My settings are a few posts up

1 Like

OK thanks… That’s about what mine look like after AutoTune, but like I say… Big slow bounce back after any turn with those values. Putting them back up to about .250 feels solid, but I get the occasional seemingly random break into oscillations at times. Well, no need to take this thread OT. Thanks for the param list.

These are the settings on my QAV180, bigger copter but very crisp yaw QAV180-Tuned4.0-dev.param (18.6 KB) Make sure you set ACRO_YAW_P

1 Like

I got some interesting results from your suggestions.
This is BW=5

This is BW=10

When I checked where the notch filter is, it still isn’t going below 80hz

I set

I’m running the latest 4.0dev

BW10 https://drive.google.com/open?id=1U_PNBSwhcfVbyMD9t9ufni_VzwMX28py
BW 5 https://drive.google.com/open?id=1xPlSDHjNrC6LnPSPK5hsfffrI0nkC0K9