Commit 258aa6f
flight/pid: add D-term pre-differentiation LPF
Differentiation amplifies high-frequency noise by f_loop/f_cutoff
(~9x at 1kHz loop). Add an optional PT1 pre-filter applied before
differentiation to reduce this amplification to ~3.6x, at the cost
of only +0.6ms latency at the default 250Hz cutoff.
This is inspired by Betaflight's architecture where gyro data is
filtered before the derivative is computed.
New parameter: dterm_lpf2_hz (default 250, 0 = disabled)
- 5-inch builds: 250Hz recommended
- 7-inch builds: 200Hz recommended
Benefits:
- D gain headroom increases ~15-25%
- Improved propwash rejection
- Better altitude/position hold disturbance rejection
The added latency is negligible for the position/altitude loop
(bandwidth <5Hz). Backward compatible: set dterm_lpf2_hz=0 to
restore stock behavior.
Closes: #114631 parent 76809d7 commit 258aa6f
3 files changed
Lines changed: 31 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2034 | 2034 | | |
2035 | 2035 | | |
2036 | 2036 | | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
2037 | 2043 | | |
2038 | 2044 | | |
2039 | 2045 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
262 | 265 | | |
263 | 266 | | |
264 | 267 | | |
| 268 | + | |
265 | 269 | | |
266 | 270 | | |
267 | 271 | | |
| |||
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
334 | 346 | | |
335 | 347 | | |
336 | 348 | | |
| |||
771 | 783 | | |
772 | 784 | | |
773 | 785 | | |
774 | | - | |
775 | 786 | | |
776 | 787 | | |
777 | | - | |
778 | 788 | | |
779 | 789 | | |
780 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
781 | 801 | | |
782 | 802 | | |
783 | 803 | | |
784 | | - | |
785 | | - | |
| 804 | + | |
786 | 805 | | |
787 | 806 | | |
788 | 807 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
0 commit comments