mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Second dterm pt1 (#5458)
* Second PT1 on DTerm This PR replaces the default biquad filter with a second PT1 set to 200Hz. Basically allows the user to enable a second, set point configurable, PT1 type first order low-pass filter on DTerm. This is useful because most noise in most logs arises from D, not P. The default is set to on, at twice the normal Dterm setpoint. This provides greater Dterm cut than a single PT1, and twice the steepness of cut above the second setpoint. Modelling shows significant reductions in higher frequency Dterm noise with only minor additional delay. The improvement in noise performance will be less than for biquad, but the delay is considerably less. If with the default settings the overall noise improves a lot, it may be possible bring D both filtering set points to higher numbers (e.g. 140/280), or alternatively remove other filters such as the notch filters, while maintaining an adequate level of control over noise. * Update names, old defaults, fix whitespace Defaults restored to biquad with second PT1 off. ‘lpf’ retained as abbreviation for values, otherwise generally remove ‘Filter’ where redundant, replace ‘FilterLpf’ with ‘Lowpass’, etc, thanks Fujin and DieHertz * Remove underscore in lowpass_2, add hz to setpoint for lowpass Thanks DieHertz * completed replacing lpf with lowpass, added _hz to all lowpass set points in profile Thanks DieHertz * fix whitespace fixed whitespace in settings.c * whitespace attempt #57 * change lpf to lowpass where appropriate elsewhere Note did not change OSD abbreviations, they are still LPF, and did not change gyro_lpf anywhere. * second attempt at a simple PT1 implementation Basically copied from the DtermNotch implementation * Second PT1 on DTerm This PR replaces the default biquad filter with a second PT1 set to 200Hz. Basically allows the user to enable a second, set point configurable, PT1 type first order low-pass filter on DTerm. This is useful because most noise in most logs arises from D, not P. The default is set to on, at twice the normal Dterm setpoint. This provides greater Dterm cut than a single PT1, and twice the steepness of cut above the second setpoint. Modelling shows significant reductions in higher frequency Dterm noise with only minor additional delay. The improvement in noise performance will be less than for biquad, but the delay is considerably less. If with the default settings the overall noise improves a lot, it may be possible bring D both filtering set points to higher numbers (e.g. 140/280), or alternatively remove other filters such as the notch filters, while maintaining an adequate level of control over noise. * Rebase * Remove underscore in lowpass_2, add hz to setpoint for lowpass Thanks DieHertz * completed replacing lpf with lowpass, added _hz to all lowpass set points in profile Thanks DieHertz * fix whitespace fixed whitespace in settings.c * whitespace attempt #57 * change lpf to lowpass where appropriate elsewhere Note did not change OSD abbreviations, they are still LPF, and did not change gyro_lpf anywhere. * second attempt at a simple PT1 implementation Basically copied from the DtermNotch implementation * Whitespace fix - thanks, Ledvinap * Fix PG issue by moving added dterm_lowpass2_hz to bottom of struct * Got rid of redundant indirection * Fixed indentantion shifts
This commit is contained in:
parent
d2bc4e5af5
commit
ab231b7c84
6 changed files with 70 additions and 62 deletions
|
@ -1186,8 +1186,8 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
|
|||
|
||||
case MSP_FILTER_CONFIG :
|
||||
sbufWriteU8(dst, gyroConfig()->gyro_soft_lpf_hz);
|
||||
sbufWriteU16(dst, currentPidProfile->dterm_lpf_hz);
|
||||
sbufWriteU16(dst, currentPidProfile->yaw_lpf_hz);
|
||||
sbufWriteU16(dst, currentPidProfile->dterm_lowpass_hz);
|
||||
sbufWriteU16(dst, currentPidProfile->yaw_lowpass_hz);
|
||||
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_hz_1);
|
||||
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_cutoff_1);
|
||||
sbufWriteU16(dst, currentPidProfile->dterm_notch_hz);
|
||||
|
@ -1658,8 +1658,8 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
|
||||
case MSP_SET_FILTER_CONFIG:
|
||||
gyroConfigMutable()->gyro_soft_lpf_hz = sbufReadU8(src);
|
||||
currentPidProfile->dterm_lpf_hz = sbufReadU16(src);
|
||||
currentPidProfile->yaw_lpf_hz = sbufReadU16(src);
|
||||
currentPidProfile->dterm_lowpass_hz = sbufReadU16(src);
|
||||
currentPidProfile->yaw_lowpass_hz = sbufReadU16(src);
|
||||
if (sbufBytesRemaining(src) >= 8) {
|
||||
gyroConfigMutable()->gyro_soft_notch_hz_1 = sbufReadU16(src);
|
||||
gyroConfigMutable()->gyro_soft_notch_cutoff_1 = sbufReadU16(src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue