Oscillate and flip over after switching FC

It should work on hex configs but you will generally only get RPM from 4 channels. What flight controller? I think we could expand to hex now that some of the other issues are resolved.

Cube Orange. Will the RPM-based notch filtering work if there is only input from 4 channels?

It should do - if there is no incoming data then the notches won’t move. It’s true that it used to be that we only create 4 notches so it wouldn’t matter. Now that we create notches for all motors we might have to think about how that works.

1 Like

Wait, are you saying there is a separate notch for each motor per harmonic? I thought it took the averaged frequency from all the motors as the center.

The default is the average and that should work fine. INS_HNTCH_OPTS=2 gives you a notch-per-motor

Hello @andyp1per. I am only getting 4 out of 6 motors to work with Dshot enabled. I have made a topic here. Can you please advise?

I’ve got my ESC issues resolved. They seem to be working and I get telemetry data from them. I have set up bdshot and its relevant masks. However, I am seeing no difference in the gyro data with and without the filters. I did several hover tests. First with harmonic notch turned off and then with these params enabled:

INS_HNTCH_ENABLE,1
INS_HNTCH_REF,1
INS_HNTCH_FREQ,40
INS_HNTCH_HMNCS,7
INS_HNTCH_MODE,2
INS_HNTCH_BW,20
INS_HNTC2_ENABLE,1
INS_HNTC2_REF,1
INS_HNTC2_FREQ,40
INS_HNTC2_HMNCS,7 
INS_HNTC2_MODE,2
INS_HNTC2_BW,20

Here is gyro noise from MP FFTs:


Before implementing filters

After implementing filters (actually looks a bit worse).

Also, FTN.NDn is showing 1 the whole time so I am not sure what to make of that. There should be 4 * 3 * 3 = 36 dynamic filters total if I understood this correctly. FTN.NF1 is 40 (default) so it seems like the filters are just not enabled.

Log files:
Before filters enabled
After filters enabled

You have INS_LOG_BAT_OPT set to 0 for both logs. How would you know if they are working well or not? And don’t bother looking at the Accel graph, the notch filter is only active on the Gyro.

In any case this is what you want to look at to configure the notch filter. You don’t need 2 notches filters. And you want INS_HNTCH_MODE 3 not 2 for ESC telemetry RPM reference.

FFT

1 Like

Okay, changed INS_LOG_BAT_OPT,1. I’ll give it a try now.

I was trying to implement this:

2 not 1 for post-filter analysis. Disable Notch 2 and configure Notch 1 based on the graph I attached. The center frequency is ~52Hz.

That’s a different parameter.

1 Like

Cheers, Dave. You’re right. I had a brain fart, thanks for pointing that out. I did INS_HNTC2_ENABLE,0 and implemented the changes you suggested. Here is what it looks like now:

image

Clearly the filtering is working now. However, I have some questions:

  1. What are those large downward spikes at 250, 500, and 750 Hz? They are only on GyroX.

  2. Why does this FFT look different from what mavfft_isb.py generates:
    image
    Is it something to do with how the Fourier transforms are averaged?

  3. Why is FTN.NDn showing 6 in the logs? 4 motor inputs, 3 axes, 3 harmonics → 36 notches. FTN.NF1 to FTN.NF6 are all centered around 50 Hz or so. I thought only 4 inputs from bdshot were supported even if this is a hex config.

Log file.

Some artifact of log scaling I suppose. This is what it really looks like (similar to your mavfft graph):
FFT

Working well I would say. You can disable FFT, FFT_ENABLE to 0 as you are not using it.

That I’m not sure of never having configure the notch filter on a Hexa.

1 Like

I am guessing averaging difference because during takeoff my drone tipped forward which caused RPM to fluctuate and the fundamental vibration mode jumped to ~60 Hz. See:

My guess is that mavfft_isb.py is only looking at the first few windows whereas MP averages all of them which is why the 60 Hz component gets lost in that graph. It will also explain the scaling difference.

This also does not explain why the 200 Hz component is removed. I had INS_HNTCH_HMNCS,7 so only 50, 100, and 150 Hz should be filtered out.

It averages all of them. It also windows them, which MP may not do. I don’t know what algorithm MP uses - it keeps changing

1 Like

Thanks. Can you please give your thoughts on this:

Do you have ESC telemetry set up? That could be where the additional notches are coming from. If you ask for notch-per-motor you will get notch-per-motor on 4.2

I have set it up like so:

With params:

INS_HNTCH_MODE,3
INS_HNTCH_OPTS,2
SERVO_DSHOT_RATE,3

This means it is using Dshot RPM to update the filters and not serial data, right? Because the latter is much slower and causes slewing effects. How do I confirm that?

Earlier in this topic you said bdshot RPM filters only work for 4 inputs. Has that changed in v4.2? So I now have 6 * 3 * 3 = 54 filters running?

SERVO_BLH_BDMASK controls whether you are getting rpm data via dshot or via the serial port. It looks like you are getting it via the serial port - hence the 6 notches

I’m sorry, Andy. I do not see that parameter.

image

How do I get it to use Dshot for setting the notches?

Sorry SERVO_BLH_BDMASK