Tuning the Harmonic Notch

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.

Throttle-based will work on all models and should work fine. My FFT-based option will also work on older models but is not in master yet.

It’s not working because for throttle-based you need to set INS_HNTCH_REF to your hover thrust, or configure it to scale from the minimum desired frequency. The details are on the wiki.

can you explain how is that supposed to be done?

i do not see anything explained in the wiki
http://ardupilot.org/copter/docs/parameters.html
it says same as MP help page, not much of the useful information there:

A reference value of zero disables dynamic updates on the Harmonic Notch Filter and a positive value enables dynamic updates on the Harmonic Notch Filter. For throttle-based scaling, this parameter is the reference value associated with the specified frequency to facilitate frequency scaling of the Harmonic Notch Filter. For RPM and ESC telemetry based tracking, this parameter is set to 1 to enable the Harmonic Notch Filter using the RPM sensor or ESC telemetry set to measure rotor speed. The sensor data is converted to Hz automatically for use in the Harmonic Notch Filter. This reference value may also be used to scale the sensor data, if required. For example, rpm sensor data is required to measure heli motor RPM. Therefore the reference value can be used to scale the RPM sensor to the rotor RPM.

http://ardupilot.org/copter/docs/common-imu-notch-filtering.html

interesting - google is not finding that page for me, at all.

It only got published a couple of days ago - maybe it hasn’t been re-indexed

ok, i am reading it now. it is still as clear as mud. it begins great explaining what buttons to press and what window to open. gives a sample of noise - good. then it gets confusing. ‘open it in the regular way in mission planner and graph the throttle value. From this identify an average hover throttle value’.
that is not very clear - better have a screenshot and a sample. as i have learning set to 2 - i can get it right away - my hover value is 0.393618, i have it in the settings.
then

  • Set INS_HNTCH_REF = hover_thrust to set the harmonic notch reference value
  • Set INS_HNTCH_FREQ = hover_freq to set the harmonic notch reference frequency
  • Set INS_HNTCH_BW = hover_freq / 2 to set the harmonic notch bandwidth

what are 2 last params supposed to be set to? it would be helpful, may be, to do a compelte reference sample using the screenshot in there, to identify what each actual value is and where exactly is supposed to come from.

say, here is the data from my fpv tilt - what should be used from it:

Pull requests on the wiki gratefully accepted :slight_smile:

You want to set INS_HNTCH_FREQ to one of the two peaks. My guess is that the motor peak is actually the second one so about 180Hz? Then set INS_HNTCH_BW to 90Hz (half of the frequency). Does that sound right based on your motor size?

If it does sound right then do the FFT again after you have configured the harmonic notch to see if you need a static notch on the lower peak.

so, i did set _ref to the hover value, flew it, battery out of juice now, i will do it later. i saw CTUN->N to get some fluctuations, mildly, from 80 to 88 and so on, but not too much. FFT of that log does not look very different from the first one.