Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Telemetry based rpm notch filter #7271
Here comes my little xmas gift
Based on #7264 this feature provides a configurable motor harmonics filter using live rpm telemetry via dshot. Both gyro and the dterm have one filter bank of notch filters which filter up to the first three harmonics of each motor's frequency.
Since dshot rpm telemetry gives us real-time information on current rpm for each motor these notch filters can be extremely narrow, causing minimal latency for flight relevant gyro signals. Per default a Q of 5 is used which means the 3db bandwidth of - say - a 300hz filter would be [292.5,307.5].
The filter bank is extremely effective at eliminating motor noise. On a semi-clean quad it's possible to fly without any other gyro filters and without the dynamic notch, adding only a 150hz biquad lpf on D. Here's what that looks like:
The resulting latency reductions are very significant, strongly improving flight performance.
The defaults implement filters in the first 3 harmonics on gyro and the first harmonic on D. That makes for a total of 16 filters per axis. Some care has been taken to implement the necessary but expensive filter updates as cheaply as possible, by cloning filter settings between axis and staggering filter updates over multiple loops.
The filter bank uses the following settings:
These are self-explanatory. Q is configured 100x, so default is 5. Setting harmonics to 0 switches the filter bank off.
When the frequency for some filters goes below the minimum frequency only one harmonic is allowed to linger there. Any other harmonics get parked at 1000hz.