Noise and filtering · University · about 30 min
Every filter delays. Measuring the delay, and what it does to a loop closed around it.
[1 mark]An exponential filter with alpha = 0.2 runs in a 0.1 s loop. About how many seconds does it delay the signal?
[1 mark]What does this print?
DT = 0.1
for a in (0.5, 0.25, 0.1):
steps = (1 - a) / a
print(a, round(steps, 2), round(steps * DT, 2))[1 mark]A controller holds a gap to the wall. Why should the filter go on the measurement rather than on the error?
[1 mark]In a PID controller, which term usually needs the filter?
[1 mark]The plant has a time constant of 0.25 s and the loop runs at 0.1 s. By the lesson's rule of thumb, which filter is acceptable in the loop?
[1 mark]A controller was twitchy, so its sensor filter was made heavier twice. It now oscillates slowly. What is the right fix?
Drive steadily at the wall, filter the distance, plot raw and filtered, and print lag:, the seconds by which the filtered signal trails the raw one.
from bugbot import * connect() ALPHA = 0.2 DT = 0.1 filtered = distance()
Plan your program here, then type it in and press Run.
lag * rate_of_change to the filtered value and see how much of the delay you can buy back.