Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Second PT1 on DTerm #5427
This PR allows the user to enable a second, independently configurable set point, PT1 type first order low-pass filter on DTerm.
This is very useful as a means of controlling because most noise in most logs arises from D, not P.
User sets dterm_lowpass_2 in CLI to the desired cut point. Double or triple the lower, standard Dterm lowpass is a good starting point. Default is 200.
The default is set to on, at twice the normal Dterm setpoint, and the default Dterm filter type is changed from biquad to PT1.
This provides greater Dterm cut than a single PT1, with twice the steepness of cut above the second setpoint. Modelling and logging shows significant reductions in higher frequency Dterm noise with only minor additional delay. Having a configurable setpoint allows the user to tune the least filtering that provides adequate noise reduction.
The biquad will provide very effective filtering but greater delay.
The following images show logs of four flights, the first panel shows that P noise is about the same on each, the second shows D noise with, from left to right, a single D PT1 at 100, and then the effect of adding a second D PT1 in series at 300, 400 and 500Hz. The second PT1 provides configurable and significant reductions in D noise from around to above its setpoint.
A spreadsheet that allows visualisation of the effect on random noise and other inputs is here https://www.dropbox.com/s/36c8ec55c3hmqoa/DualDFilters1.xlsx?dl=0
@Ledivinap yes that's a good thing about second order filters. I plan to compare a single biquad to dual separated PT1's, hopefully to establish cutoffs that actually give filtering equivalence in logs, and then to see if anyone can tell the difference in flight. Theoretically will be less delay from separated PT1's, but also less filtering. At least this build allows a bit more fine tuning of how we filter D.
Thanks for all your feedback Fujin and DieHertz! Definitely more readable.
Just noticed the static state, was it added by your changes or present before?
Sorry I closed it because I stuffed up the merge... I have now fixed that with a new pull here:
I couldn't get the slack email reply and its 1am now. Sorry of making a mess. But the new pull should be OK I fixed the one line that needed changing.