Notch filter testing

I’ve just pushed in some documentation for the code which is already in
master:

http://ardupilot.org/copter/docs/common-imu-batchsampling.html#common-imu-batchsampling

1 Like

@peterbarker Does the batch sampling only apply to IMU log messages? The work that I’m doing with frequency domain characterization requires the inputs (control positions) and outputs (aircraft states) to be sampled at the same frequency. So this captures the outputs but I would need the RATE and ATT messages to be sampled at that frequency was well.

I did not want to post this one here to not hijack the thread, but it is somewhat related:

https://discuss.ardupilot.org/t/why-does-notch-filter-have-no-effect/26917

Hello,

After reading this thread, I wanted to dig a little in the code to see where and how the notch filter is applied to the IMU data. After searching in the library AP_InertialSensor, I realized that the notch filter is only applied on the primary gyro. Is there a particular reason it’ s not applied on accelerometer data (or maybe I missed something) ?

Regards

This is because it is only used in the rate loops. The only loop that uses the accelerometer is the Alt Hold controller. I would like to organise these loops differently so that the notch is associated with the PID rather than the sensor but this is a lot of work and we have a way to go before we can do this.

Hi all,
I also tried the notch filter after enabling the IMU batch sampler. I was flying at hovering and at 10-12 m/s so that I can stress the copter to have a representative sample. Here the power spectrum of my copter without filter.

P10.pdf (435.8 KB)

As you may notice the value are very low but there are two peaks at 120 Hz and 230 Hz. The first peak is the most important and I designed a notch filter with bw = 10 Hz, freq = 120 Hz and attenuation of 15 dB (default value). Here how the power spectrum after applying the filter looks like

P15.pdf (434.2 KB)

There is not much difference between unfiltered and filtered data although the filter is quite aggressive. The difference is not remarkable such as that one posted by @hsteinhaus. I admit that my copter already flies smoothly and stably but I was just curious about the feature of the notch filter.

Am I missing something or the filter is just useless for my vibration levels?

Possible things to look into for AC developers?

  • Add more frequencies since I have 2 peaks that are far apart from each other
  • Increase maximum centre of frequency (current is 200 Hz)
  • Increase max attenuation level (current 30 dB)

The batch sampler is taken before the notch filter so it does not show up. We are looking at changing this.

1 Like

Thank you @Leonardthall I am looking forward to testing the next firmware versions!:slight_smile: