Tuning the Harmonic Notch

@Alberto_Ds can we continue the discuss here as it relates to notch tuning?

MOT_HOVER_LEARN = 2 and reading off the value of MOT_THST_HOVER will give you a value for INS_HNTCH_REF but it will not give you the hover frequency, you need an FFT for that (or something that can tell you the frequency directly). One option might be to record the noise of you hovering and use an iphone app to tell you the dominant frequency. This works pretty well for props if you flip them with your nail, but not sure how well it would work for a copter in the air. You could try :slight_smile:

I have put a build for the omnibus f4 pro with my changes in https://www.dropbox.com/s/jwmu0i4avflz1po/arducopter.apj?dl=0

@andyp1per I tested your last version of branch small-copter-4.0 and now it writes the right values for learned values of FFT_FREQ_HOVER and FFT_THR_REF other then makes my copter really stable :slight_smile:

Nice! Really super happy.

Holybro just sent me 2 Durandals, I’m going to start testing FFT on those :smiley:

I’m already flying a H7 - the Orange Cube. Did the notch tuning and I’m running at default loop rates. When you get the Durandals, maybe you can teach me how to best put the 400 MHz at work.

After tuning, it flies like a hot knife through butter, with a small exception: when I stop a fast descent in Stab it does what’s best described as a pair of in-place toilet bowls, but I bet that’s caused by the BlHeli_32 management of sudden acceleration from low throttle.

Yes sure! :slight_smile:

your version of arducopter fw is already on my quad, but I have to solve the problem of hovering frequency. A friend of mine could give me this, could it be a solution to have a log?

You don’t need to solve the problem of hovering frequency if you have my fw.
Set

INS_HNTCH_MODE=4
INS_HNTCH_REF=hover thrust (this is probably not necessary, but can't remember)
FFT_ENABLE = 1
FFT_MINHZ = 100
FFT_MAXHZ = 350

And see how it goes. The rest of the defaults are probably good enough. If its working it will learn the hover frequency and throttle reference for you and set FFT_FREQ_HOVER and FFT_THR_REF. You could then use this to configure the throttle-based notch, but why bother if the FFT is working for you.
It will also learn FFT_BW_HOVER which you could use to set INS_HNTCH_BW

Sure. It’s going to be quite a while before I get either of these on something that actually flies, going to do a bunch of bench testing and comparisons.

Plus its wet and cold here, so have to exercise my fingers by typing rather than tickling a TX :slightly_smiling_face:

I started trying this out on one my Solos today using the throttle method. I did several flights worth of FFT analysis before tuning to make sure the results were consistent. It’s windy today. I also enabled all three IMUs in INS_LOG_BAT_MASK just for fun. The first two are vibration isolated and heated. The third is hard mounted. This is with a Cube Orange.

There is a very obvious and consistent peak at about 93hz on all three IMUs But then there’s this blob from about 160-200hz as well. Hover throttle is .22.

So it looks like INS_HNTCH_FREQ should be 93, the bandwidth should be 46, and the ref should be .22, right?

This is the FFT analysis before the harmonic notch filter:

This is the FFT analysis after the newly configured harmonic notch filter:

All that noise on the gyros is just gone! Now it’s dark and cold outside, and my back is about done playing with this for the day too (surgery two days ago). Does this look like results as expected and intended? What about that 0-25hz lower amplitude garbage?

For easier comparison, here is just the gyros, before on top and after on bottom.

Looks good! It’s worth looking at the harmonics as well and also thinking about how you were flying. If you were flying around throttling up and down then I would expect a smush like you see at 180 or so. If you were just hovering then a more well-defined peak is going to be visible. So it’s possible that the peak at 90 is actually frame resonance triggered by your motor rpm at 180. Similarly the smush you see at 360 is the harmonic of 180 and since there is no 3x90 harmonic that would also indicate that 180 is actually your motor frequency with 360 the first harmonic and 90 frame resonance. So you could set the static notch at 90 and the harmonic notch at 180. If you know your motor specs and your throttle ref you can probably make a decent guess as to your hover freq and go from there.
You didn’t say whether the graphs were pre-filter or post-filter. Obviously the LPF’s will take out a lot of the noise anyway, so the post-filter is always going to look better than the pre-filter even without the notch. That said your final result is pretty much what I would expect. It’s cool, huh? :slightly_smiling_face:

Today I dared to play with the harmonic notch filter, and in part I am happy, since after doing an autosynthesis, my drone flew much better than ever, with the exception of altitude retention, I have been unable to achieve good results. after all, but I suspect something bad is happening with my barometer in the PixRacer.

andyp1per
Please, take a look at the screenshots in my configuration, I think I have done everything right, otherwise I accept your suggestions to make everything go better.

Before configuring the harmonic notch filter:

After configuring the harmonic notch filter:

filter parameters:

Other result:

Log.:

Ah yes, that makes much more sense. It’s 170hz and half that for the bandwidth matches almost perfectly with that big blog of noise centered around 170. I’ve changed the harmonic notch to 170, 85hz bandwidth. And I added a static notch at 93hz with 20hz bandwidth. I’ll fly tomorrow once it warms up. I’ll do one logging pre-filter and one logging post filter. This was gentle hovering, not flying around.

It looks right. Those vibration peaks are enormous! Is this hard mounted? I suspect your AltHold issues are vibration related.

I will make some modifications to the frame, I think I have loose things.

Just… wow.

So I did this whole procedure on a completely stock solo. That’s an unheated pixhawk 2 cube that came with the Solo, normal Solo props, and the stock piece of junk GPS. It is currently 30 degrees and windy/gusty.

Without any of this filtering, the solo’s loiter/position hold was like a drunk that just left a bar and is waiting for a cab. It drifted randomly and was knocked around by the wind both laterally and and vertically. This is what most Solo users are used to without modifications. I flew around the farm a bit (again with no filtering, just plain normal flight) and it was about as usual and expected.

With the filtering configured as per Andy’s wiki directions, it’s like a completely different copter. When in loiter / position hold, it just parked itself in the sky and barely drifted at all. This made a huge difference in flight performance. I flew it around the farm and in the cold wind reaching ground speeds up to 30mph and frankly it was one of the nicest solo flights I can remember. It even sounds healthier, although I suppose I could be hearing what I want to hear there.

Here are the accel and gyro graphs. The first set is the pre-filter. The second set is the post-filtering. On this Solo, the motor noise was right smack at 200hz with the hover throttle at .26. There is an obvious harmonic at 400hz too. The frame resonance was at 98hz just like on my other one which I used the static notch on.

(note: my other Solo from earlier in this thread has the motor noise at 170hz, but that copter has different props and a CubeOrange, which I suspect accounts for that difference).

4 Likes

I definitely hear a difference… There was a cyclical (fading in and out) whining sound from mine which is gone w/ the harmonic notch.

That’s great! I still find it incredible how much accel noise is eliminated by gyro filtering. It just goes to show how many control problems are essentially a feedback effect.

What are you thoughts on the attenuation level? I have the dynamic and static both at their default of 15. But IDK if that is too much or too little or jus fine? My inclination right now is it apparently isn’t bad anyway.

The first time this happened to me I had to do a double-take. It really is night and day. Just wait until you try ESC telemetry …

I set the attenuation to 40. There is very little reason to set it to a lower value. It may even be worth changing in the defaults.

so, i got a question to you. it is definitely working fine for models with esc telemetry.
so, what is a proper way to make it work for older models?
the setting like that:
|INS_HNTCH_ATT|30
|INS_HNTCH_BW|50
|INS_HNTCH_ENABLE|1|
|INS_HNTCH_FREQ|80
|INS_HNTCH_HMNCS|3
|INS_HNTCH_MODE|1
|INS_HNTCH_REF|1

with mode set to 1 - is it expected to do anything useful? i updated my old fpv tilt model with 800kv motors today, set filter like that - it flew fine, but, difficult to tell what was to expect there. just to test it i did set all filters to same 80Hz as on small models - just to see what will happen and it seemed to be decently stable, but, i see no CTUN->N fluctuation at all, and i gave it a bit of a throttle kick.