Questions about setting up a notch filter

Hi I’m trying to set up a harmonic notch based on the throttle, to determine the reference frequency I use the tool ArduPilot Web Tools

  1. How to understand that the autopilot uses the INS_HNTCH settings. I set the settings as indicated in Measuring Vibration with IMU Batch Sampler — Copter documentation
    to record data before and after filtering. I understand correctly that on the graphs I can only see the result of INS_GYRO_FILTER=20 and INS_ACCEL _FILTER=10?
  2. How close can the frequency be in INS_HNTCH_FREQ with INS_GYRO_FILTER=20?
  3. How to understand that low-pass notch filters do not have a large phase delay and do not affect stability?

Tomorrow I will attach log files with test flights.

If you use the Initial Parameters section in MissionPlanner then the INS_GYRO_FILTER value would be less than you motor noise frequency (and this is normal) so then INS_HNTCH_FREQ will be determined by the FFT graphs from a test flight.
Set these as a starting point:

INS_HNTCH_ENABLE,1
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4

I can even estimate what frequency and bandwidth you will need based on your prop size, but a .bin log will be better.
Here is the “general” settings and rules you would use for throttle-based notch filter:

INS_HNTCH_MODE,1
INS_HNTCH_BW, peak_freq / 2
INS_HNTCH_FREQ, peak freq from FFT
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_HMNCS,3
INS_HNTCH_REF, hover_thrust x 0.6

The REF value has an actual formula to calculate it correctly, but in reality 60% or 70% of the hover thrust value is near enough and can easily be refined via the web tool.
Use the least number of harmonics and other options required to just do the job.

Get a log file and we can step through the process.

Hello!
The first BIN file (01) is a test takeoff with data recording from the IMU
Second BIN file (06) with a configured filter

hi…can you explain to me how do you determine the reference frequency I use the tool ArduPilot Web Tools???


Hello!
I used the tool
https://firmware.ardupilot.org/Tools/WebTools/FilterReview/
I chose the first burst of 50Hz as the reference frequency for setting up the harmonic filter

Hello!
I am using 6007-X Combo Pack Type 6S
ESC alpha 60A
Propeller MF2211
Copter weight with battery and payload 9 kg

There is an access restriction on the google drive files. Please remove the password so we can access the files.

I’m sorry, I didn’t notice that I restricted access. Files re-uploaded

You have a cube orange, and the primary IMU is #2, so you’ll need to set IMU_LOG_BATMASK to 2, or you can set 7 and get all three. (I’ve used 7 on the cube orange and there’s no issues)

The filtering you set looked good, I made a few tweaks and improved it. You can try these in the onine tool to see the difference:

INS_HNTCH_FREQ,46
INS_HNTCH_BW,23
INS_HNTCH_ATT,30
INS_HNTCH_REF,0.195
INS_HNTCH_FM_RAT,0.699999988079071
INS_HNTCH_HMNCS,7
INS_HNTCH_OPTS,8
INS_HNTCH_ENABLE,1
INS_HNTCH_MODE,1

I would suggest first you set the log bitmast as I described above, and also deal with the vibrations. There is significant y-axis vibration that should be addressed before you try to get too far with the tuning. Since it’s only Y, have look to something loose like landing gear or camera mount. Maybe there’s wires pulling on the flight controller in one direction.

To what value is it desirable to reduce the amplitude of the IMU spectrum?
In the online tool, I can adjust the filters so that the amplitude is reduced by another factor of two.
The Wiki does not indicate what amplitude is considered acceptable.
Based on what parameters in the log can you determine that the notch filter does not have a large phase delay and does not affect the stability of the copter?

Yes, phase delay is there and should be kept minimum at low frequencies. Just attenuate enough to remove the peak

How close can the frequency equal to the difference between (INS_HNTCH_FREQ - INS_HNTCH_BW) be to the value INS_GYRO_FILTER=20 when setting up a harmonic filter?
Is it possible to set INS_HNTCH_FREQ to a low frequency (eg 15Hz) but not use the first harmonic?
It seems that the operation of the first harmonic at a frequency of 30 Hz is different from the operation of the second harmonic at a frequency of 15 Hz.
If I use INS_HNTCH and INS_HNTC2 simultaneously, do I need the sum (INS_HNTCH_ATT+INS_HNTC2_ATT) not to exceed 40dB? The description of the INS_HNTCH_ATT parameter says that when exceeding 40dB there will be a dip and not a moderate attenuation?

How to understand that a harmonic filter has been applied? In MIssion Planner, I do not see the work of the tuned harmonic filter, I only see the work of the low-pass filter.

This is data from this test flight

I can track the operation of the configured filter only in an online tool.

Hello!
You have set the INS_HNTCH_OPTS=8 parameter.
I had it set to =0, so it turns out that the configured filter was not applied?

Today we went through all the blades and found that two propellers had an imbalance in the mass of the blades, the difference was 2.5 grams.
We sorted the blades by weight and after that the vibrations decreased 10 times in all axes.

Here is the test log file without using the harmonic filter.

Is it necessary to use a harmonic filter in this case?
Tomorrow we want to conduct test flights in the field.

That vibration really fixed things up. Great work!

Here’s what I came up with for a filter.

INS_HNTCH_FREQ,51
INS_HNTCH_BW,25
INS_HNTCH_ATT,40
INS_HNTCH_REF,.2
INS_HNTCH_FM_RAT,.8
INS_HNTCH_HMNCS,3
INS_HNTCH_OPTS,8
INS_HNTCH_ENABLE,1
INS_HNTCH_MODE,1

I set the INS_HNTCH_OPTS to 8 so the filter is applied to all IMUs. It is my understanding if you don’t do that the filter is only applied to the primary.

The one thing I did see is there seems to be a torque split between the CW and CCW motors.

Motors 3&4 are working harder than 1&2. This usually means there is a misalignment in the motor arms or a twist in the frame. This one isn’t the worst I’ve ever seen, and you could probably get away with it as is, but if you can get these equal then you’ll get a better tune.

Do you suggest leaving the harmonic filter tuned?

Do you mean INS_HNTCH_HMNCS,3? Yes. When I was playing with it I tried turning it off and there was a noticeable increase in the harmonics.

If you’re asking should you set the filter, also yes. The low vibrations really helped, but this will just polish everything.

Is there a description of how to correctly analyze filter frequency response graphs?

What does the first graph show? How wide can the gray areas be?
Does the second graph show the phase delay? What phase shift is acceptable and what width of the gray zone is acceptable? On what scale is it correct to analyze the second graph, un-wrapped or ±180?

I’m working from what I’ve learned the hard way, and from what I’ve read here. I look for as low value as I can get with the minimum amount of filtering.

Here’s a good resource from the developer of the webtool:

1 Like