Tuning the Harmonic Notch

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:

INS_HNTCH_FREQ = 38
FFT_MINHZ = 38
INS_HNTCH_BW = 5

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

Andy,
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
INS_HNTCH_FREQ = 38
FFT_MINHZ = 38

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

Maybe it has something to do with FFT_FREQ_HOVER = 80

Edit- I tried changing it to 40 and it didnā€™t seem to make any difference in the logs.

Hi Giorgio, pretty sure the weird output you see is because the log is corrupted. There are many data entries without a corresponding header (I have seen this when logging using FRAM) and I suspect this with a combination of too few samples is giving the analysis artifacts you are seeing.Blockquote

Whatā€™s the fastest Sd card you are using for Arducopter logs? Iā€™m pretty sure the above issue was because Iā€™m using an old 8 GB SD card and with the lowest speed class. Is it safe to buy a fast class 3 32Gb like a Samsung one?

About log, main loop and scheduling, yesterday I was watching this https://www.youtube.com/watch?v=2yMO9CPhNdU&t=628s
could we have already some small issue under 1k mainloop?

Fast 32Gb should be fine. I have seen issues with 64Gb on Durandal

If you are using ESC telemetry then INS_HNTCH_FREQ is the only thing that matters - that determines the lower bound of the notch center frequency.

Ok interesting - looking at your log your RPM is 5000 which is roughly the 90Hz you are seeing. Does that seem right physically? If it does the the large spike at 45Hz is some kind of half harmonic. If 5000 seems too high then I guess you have the number of poles set wrong for your motors.

5000rpm seems right physically. I double checked my poles setting, which is correct at 14. What would be the best way to take care of the spike at 45hz? Should I try the static notch?