The answersDownload the PDF
Worksheet

U6.4 Q and R

State estimation · University · about 30 min

BugBotLab
NameClassDate

What this lesson is about

The two numbers you actually choose, what they mean, and how to measure them.

Questions 7 marks in all

  1. [1 mark]Standing still, a depth sensor's readings have a standard deviation of 3 cm. What R should the filter use?

  2. [1 mark]The robot can slip about 0.3 cm in one tick without the model knowing. Using the lesson's rough rule, what is Q?

  3. [1 mark]Q is doubled and R is doubled. What happens to the Kalman gain?

    1. ANothing, because only the ratio Q/R matters
    2. BIt doubles
    3. CIt halves
    4. DIt rises, because Q grew
  4. [1 mark]Q is set far too small. How does the filter fail?

    1. AIt trusts its model, drifts away from the truth, and reports a small variance the whole time
    2. BIts output is as noisy as the raw sensor
    3. CIt oscillates around the truth
    4. DIt stops predicting and only uses measurements
  5. [1 mark]The normalised innovation squared for four fixes, with p + R = 25 each time. What does it print?

    innovations = [3.0, -6.0, 4.0, -2.0]
    S = 25.0
    nis = [v ** 2 / S for v in innovations]
    print(nis)
    print(round(sum(nis) / len(nis), 2))
  6. [1 mark]A filter's running average of the normalised innovation squared is about 4. What does it mean?

    1. AThe filter claims less uncertainty than it really has, which is the dangerous direction
    2. BThe filter claims more uncertainty than it has and could be tuned tighter
    3. CThe filter is well tuned
    4. DThe measurements are four times more accurate than R says
  7. [1 mark]Why is Q = 0 always wrong on a real machine?

    1. AThe variance shrinks towards zero, so the filter eventually stops listening to measurements
    2. BIt makes the gain equal to 1
    3. CIt divides by zero in the gain
    4. DIt makes R meaningless

The task: tune Q and R

Standing still, measure R and print it as measured r:. Then run the filter at two or three values of Q and print what each does.

from bugbot import *
connect()

readings = []

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

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

Challenges

  1. Compute the normalised innovation squared for your filter and check it is near 1.
  2. Set Q = 0 and drive the robot. Watch the estimate stop listening.
  3. Make R depend on range: double it beyond 100 cm. Does the estimate improve?