The answersDownload the PDF
Worksheet

U4.6 Choosing the filter

Noise and filtering · University · about 25 min

BugBotLab
NameClassDate

What this lesson is about

Matching the cut-off to the signal you care about, by measurement rather than by taste.

Questions 6 marks in all

  1. [1 mark]The lesson gives alpha ~ 2 / (window + 1). What alpha gives an effective window of 9 readings?

  2. [1 mark]This adds how far a robot at 20 cm/s travels during each filter's delay. What does it print?

    DT, SPEED = 0.1, 20
    for a in (0.05, 0.1, 0.3, 0.6):
        lag = (1 - a) / a * DT
        print(a, round(lag, 2), round(SPEED * lag, 1))
  3. [1 mark]A stationary test shows alpha = 0.05 leaves the smallest spread. Why might it still be the wrong choice?

    1. AStanding still hides the delay; while driving it reports a distance the robot passed a second or more ago
    2. BSmaller spread always means more bias
    3. Calpha = 0.05 amplifies noise when the robot moves
    4. DSpread measured standing still is always an underestimate by a factor of two
  4. [1 mark]The signal you care about and the noise are at the same frequency. What does the lesson say?

    1. ANo filter can separate them, so tuning will not help
    2. BUse a lower alpha
    3. CUse a median filter instead
    4. DUse a higher alpha
  5. [1 mark]Put the lesson's filter-choosing procedure in order.

    Number the lines 1 to 4 to put them in the right order.

    1. Turn that ratio into an effective window and an alpha
    2. Decide how much noise the controller's input can tolerate
    3. Check the resulting delay against the system's time constant
    4. Measure the noise sigma with the robot still
  6. [1 mark]The delay of the alpha you need is too large for the system's time constant. What does the lesson say the answer is?

    1. AA better sensor or a slower controller
    2. BA more sophisticated filter with the same alpha
    3. CA median filter in series
    4. DMeasuring sigma again

The task: tune the filter

Standing still, run at least three alphas at once, print the spread each one leaves, and print best alpha:.

from bugbot import *
connect()

ALPHAS = [0.05, 0.1, 0.3, 0.6]

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u4-6-choosing-the-filter/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Repeat the comparison while driving at the wall and say which alpha wins now.
  2. Add a column for how far the robot travelled during each filter's delay, at 20 cm/s.
  3. Filter the flow sensor instead and pick an alpha for use in odometry. Does the answer differ, and why?