Project: write the data sheet

Characterise the robot you were given and print the figures the rest of the course will use.

U1.7The robot as a systemUniversity45 min

Do this lesson in the simulator

A component you buy comes with a data sheet: the numbers somebody measured so that you do not have to. Your robot came without one. Write it.

What the data sheet holds

Figure How it is measured Roughly
v_max step to full forward, average the settled speed from flow() 20 cm/s
w_max step to full rotation, average the settled rate from imu() 120 deg/s
dead band walk the command up until the robot first moves about 15
drift how far odometry() is from position() after the run a few cm

Every one of them belongs to your robot. Each BugBot is built with its own gain on each axis, its own gyro bias and its own flow scale, fixed for the run. That is the point of measuring rather than looking up.

How to write the program

The four measurements are four short experiments in a row, and the discipline is the same each time:

  1. Stop, and let the robot settle.
  2. Apply the input.
  3. Wait past the transient, about 3 tau.
  4. Take several readings and average them.
  5. Stop, and let it settle again before the next one.

Skipping step 5 is the usual mistake. A measurement taken while the robot is still coasting from the previous experiment is a measurement of the previous experiment.

from bugbot import *
connect()

def settled(read, power_fn, hold=1.0, n=10):
    """Apply an input, wait past the transient, then average n readings."""
    power_fn()
    wait(hold)
    vals = []
    for i in range(n):
        vals.append(read())
        wait(0.1)
    stop()
    wait(0.5)
    return sum(vals) / len(vals)

v_max = settled(lambda: flow()[1], lambda: forward(100))
w_max = settled(lambda: imu()[1], lambda: drive(0, 0, 100))
print("v_max:", round(v_max, 1))
print("w_max:", round(abs(w_max), 1))

Run this in the simulator

Task: the data sheet

Measure all four and print them, one per line, exactly like this:

v_max: 19.2
w_max: 113.5
dead band: 15
drift: 3.8

The whole run has ninety seconds, which is plenty for four experiments and nowhere near enough to be careless.

from bugbot import *
connect()

# measure, do not assume

Challenges

  1. Add the sideways top speed, and say why it is not the same as the forward one.
  2. Repeat the whole data sheet three times and report each figure as a mean and a spread.
  3. Run the data sheet at set_noise(3). Which figure survives the noise best, and which is worst? That ranking tells you which measurements to trust on a real robot.

What comes next

Module U2 takes the same drive and asks a different question: given a velocity you want in the world, what command gets it? That is kinematics, and it is where the frames and the matrices come in.