State estimation · University · about 25 min
A signal that drifts and a signal that is noisy, and why either alone is worse than both.
[1 mark]A complementary filter uses a = 0.98 and dt = 0.1 s. What is its time constant in seconds?
[1 mark]Blending 359 degrees with 1 degree, first naively and then with the wrap. What does it print?
mine, fused = 359.0, 1.0
print((mine + fused) / 2)
f = fused
while f - mine > 180:
f -= 360
while mine - f > 180:
f += 360
print(f, ((mine + f) / 2) % 360)[1 mark]Two ticks of the complementary filter. What does it print?
A, DT = 0.98, 0.1
mine = 90.0
for rate, fused in ((10.0, 95.0), (10.0, 96.0)):
mine = A * (mine + rate * DT) + (1 - A) * fused
print(round(mine, 3))[1 mark]The filter is run with a = 0.7. What goes wrong?
[1 mark]Which statements about the two heading sources are correct?
Tick every answer that is true.
[1 mark]In frequency terms, what does the complementary filter do to each source?
Turn the robot about, running a complementary filter on the heading, plotting gyro, fused and mine, and print my heading: at the end. heading() is the truth and is not allowed, so plot the three headings themselves. They will lie almost on top of each other, which is expected: they differ by a few degrees on a chart that runs to 360.
from bugbot import * connect() DT = 0.1 A = 0.98 mine = imu()[0]
Plan your program here, then type it in and press Run.
a = 0.7 and a = 0.999 and describe both failures.heading() afterwards. Which is better, yours or imu()[0] alone?