Dynamic Notch Filter Update
commit36d71d07e7c0a4f1e768be29bb6cc9757a4626d8
authorctzsnooze <chris.thompson@sydney.edu.au>
Sat, 21 Jul 2018 12:53:07 +0000 (21 22:53 +1000)
committerctzsnooze <chris.thompson@sydney.edu.au>
Sat, 21 Jul 2018 12:53:07 +0000 (21 22:53 +1000)
treef7682460e47e39168e0c81a137f5d3b6c2809060
parentf2468fb894129eefad9ae9c53e4bbb67b15015ed
Dynamic Notch Filter Update

Improves performance of the dynamic notch filter, increasing peak accuracy over a wider band of frequencies, and generally using a narrower, higher notch.
Details:
- FFT now operates on gyro data *after* gyro notches and lowpasses
- FFT bandpass Q changed from 0.707 to 0.05, to 'open up' the FFT to a greater range of incoming frequencies
- FFT centre output now ranges from about 130 to 666Hz.
- ignore the lowest couple of FFT bins going into centre frequency calculation
- analyse FFT bins from low to high, keep ignoring bins until a bin is found that exceeds its previous bin by a factor of 2; then start examining bins from the bin before that (stops the FFT from being biased low, or going to the lowest value if there is no notch at all).
- if no bin exceeds previous by more than 2 times, ie no obvious peak, smoothly go to maximum allowed notch frequency to avoid delay (might be better to bypass filter altogether?)
- dominant bin emphasised by cubing bin height before calculating mean
- maximum cutoff frequency is half the highest allowable centre frequency
- default notch width is +/-25% of centre, narrower than before most of the time
- code tidied up
- thanks to rav, Flint, UAV Tech, icr4sh, diehertz and everyone else who helped with this.
src/main/sensors/gyro.c
src/main/sensors/gyro_filter_impl.h
src/main/sensors/gyroanalyse.c
src/main/sensors/gyroanalyse.h