The answersDownload the PDF
Worksheet

U4.2 Averaging

Noise and filtering · University · about 25 min

BugBotLab
NameClassDate

What this lesson is about

The square root of n, why it stops paying, and what it costs in time.

Questions 6 marks in all

  1. [1 mark]A depth sensor has sigma = 4 cm. How many independent readings must be averaged to get an estimate with sigma = 1 cm?

  2. [1 mark]What does this print?

    SIGMA = 6.0
    for n in (1, 4, 16, 64):
        print(n, SIGMA / n ** 0.5, round(n * 0.1, 1))
  3. [1 mark]With the noise set to sigma = 8 cm and a new reading every 0.1 s, how many seconds of standing still does an estimate good to 1 cm take?

  4. [1 mark]Averaging 100 readings has already been done. What does going to 400 readings buy?

    1. AThe noise halves again, at four times the time
    2. BThe noise falls to a quarter
    3. CThe noise halves and the bias halves
    4. DNothing, because 100 readings is the limit
  5. [1 mark]Averaging 16 readings should divide the noise by 4. In which of these cases will it not?

    Tick every answer that is true.

    1. AThe 16 readings are taken in a tight loop faster than the sensor updates
    2. BA slow draught nudges every reading in the window the same way
    3. CThe 16 readings are taken 0.1 s apart with the robot still
    4. DThe sensor's sigma is 8 cm instead of 4 cm
  6. [1 mark]A robot drives at 20 cm/s while averaging 60 readings taken 0.1 s apart. How many centimetres does it travel during the average?

The task: average it down

The sensor has about 4 cm of noise on it. Standing still, produce an estimate of the gap to the wall good to about a centimetre, and print readings: (how many you took) and distance: (your answer). Good to a centimetre at one sigma still leaves a third of answers further out than that, so take enough readings that a centimetre is two sigma.

from bugbot import *
connect()

# how many readings put two sigma at 1 cm, with sigma = 4?

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

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

Challenges

  1. Work out the number of readings you need before you write the loop, then check it.
  2. Average 16 readings ten separate times and look at the spread of the ten answers. Is it sigma over 4?
  3. At set_noise(0, depth=8), how long would an estimate good to 1 cm take? Is that a practical robot?