The answersDownload the PDF
Worksheet

U1.6 Measuring your robot

The robot as a system · University · about 30 min

BugBotLab
NameClassDate

What this lesson is about

A step response: top speed, time constant and dead band, measured rather than assumed.

Questions 6 marks in all

  1. [1 mark]A first order system follows v(t) = v_max * (1 - exp(-t / tau)). This prints the fraction of the final value reached after 1, 2 and 3 time constants. What does it print?

    import math
    for n in (1, 2, 3):
        print(n, round(1 - math.exp(-n), 3))
  2. [1 mark]A step response settles at 20 cm/s with a time constant of 0.25 s. What is the speed at t = 0.25 s, in cm/s to one decimal place?

  3. [1 mark]Step response readings are taken every 0.1 s from the moment of the step. This estimates v_max from the last five readings and tau from the first reading at or above 63.2 percent of it. What does it print?

    speeds = [0.0, 6.8, 11.5, 14.5, 16.6, 18.0, 18.9, 19.3, 19.7, 19.9, 20.1, 19.9, 20.0, 20.1, 19.9]
    dt = 0.1
    v_max = sum(speeds[-5:]) / 5
    target = 0.632 * v_max
    for i, v in enumerate(speeds):
        if v >= target:
            break
    print("v_max:", round(v_max, 1))
    print("tau:", round(i * dt, 1))
  4. [1 mark]The time constant is 0.25 s. How long after the step, in seconds, should you wait before readings measure the settled level rather than the rise?

  5. [1 mark]The dead band is 15. A controller's output spends most of its time around 10. What does the robot do?

    1. ANothing, which looks exactly like a bug in the controller's arithmetic
    2. BMoves at 10 percent of its top speed
    3. CMoves slowly, but only after the lag
    4. DMoves for half a second and then the deadman stops it
  6. [1 mark]Which of these are part of measuring a step response honestly?

    Tick every answer that is true.

    1. ARepeat the run and report the spread
    2. BIgnore readings taken during the first 3 tau when finding the level
    3. CRecord the battery level at the time
    4. DTake the single last reading as v_max, since it is the most settled
    5. EUse the catalogue value when your runs disagree

The task: the step response

Run a step to full forward power, plot the speed as speed, and print two lines: v_max: and tau:.

from bugbot import *
connect()

speeds = []
forward(100)

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

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

Challenges

  1. Do the same for rotation, using imu()[1] as the measurement. Is tau the same?
  2. Step down as well as up: full speed, then zero. Does it slow with the same time constant?
  3. Step to 50 percent instead of 100. Is tau a property of the machine or of the size of the step?