Skip to content

Filtering the D term

Plasmatree edited this page Jun 6, 2018 · 4 revisions

There is a current trend to add more filtering to the D-term. Here is why I think it is a bad idea to filter the D-term at all:

The P,I and D-terms of a PID controller have a very certain relation regarding phase, which is fundamental to how it works. Any filter will add a phase shift (delay) to the signal, which is often different for different frequencies. Adding this phase shift to the most time critical term changes the behaviour of the controller. Comparison of D-term LPF on or off In the example above, you see the separate terms of a PID controller that is hit by a 30hz sine wave. A 100hz pt1 lowpass filter on the D-term slightly lowers the amplitude (~0.95x) and adds ~16.7° (1.5ms@30hz) phase shift (compare M. Spatz filter sheet 😉). As you can see the D-component is shifted closer to the P-term and the resulting sum is bigger than before even though D is attenuated. With a phase shift of 90° they will be on top of each other (Here: At 300hz it already has 71.6°).

I suspect that this might support feedback/resonance points (poles?) and cause instability. I imagine filtering the d-term is like putting bigger tires (for more top speed) on your sports car. But only at one side.

  • I propose to use 2xpt1 (pt1+stage2) at ~100hz.
  • If you see motor noise >400hz (where it cannot be reached by the dyn. notch), set a static notch on gyro to get rid of it (on my 3” (1407/3600kv) I’m using 500hz with 350hz cut-off)
  • Tune your PIDs to give nice step responses (especially P and D, I is uncritical). In my case I ended up with +30-50% on D-terms. As you’ve found a combination of P and D that produces a clean step, you can move them together by the same fraction (e.g. p50/d30-->p55/d33).
  • Try different cut-off points for the filters (move both to 110hz, 120hz…, or lower? Maybe cleanliness of signal is more important than delay…). Always check your motor temps. You might need to fine tune your P and D again as you decide on a significantly different cut-off.

I’m still not done testing myself, have limited resources and time. Take it as work in progress and as suggestion. So far, this method worked great for me (even with beat-up props I get less noise than ever) and wanted to share.

If you've got a good reason why filters on the D-term are a good idea, please don't hesitate to tell me! Opinions of different pilots with different setups will help a lot. :)

Clone this wiki locally