Skip to content
Tactiverge

School/○ Innovator/Week 32

How many runs is enough?

One run says the new filter halves the error. The next run says it makes things worse. How many runs before you believe either?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

Noisy sensors and random disturbances mean any single run can mislead. Repeating trials estimates how much results wobble, and the standard error tells you how many runs you need before a difference stands out from the wobble.

  • ◇ Report repeated trials as mean ± standard deviation with n.
  • ◇ Use the standard error to choose a number of trials.
  • ◇ Explain why seeds and randomised run order make trials fair and repeatable.

2.Predict

To halve the uncertainty (standard error) of a mean, how many more trials do you need?

Guess first. Being wrong here is how the surprise works.

3.Understand

Mean ± SD, with n

Report repeated trials as mean ± standard deviation (n = …). The sample SD, √(Σ(x − x̄)²/(n − 1)), describes how much single runs vary. Always state n and whether the ± is SD or SE.

Standard error and sample size

The standard error SE = SD/√n describes how uncertain the mean is. To reach a target SE, you need n ≥ (SD/target)². Run a few pilot trials to estimate the SD, then choose n so the SE is small compared with the difference you care about.

Seeds and run order

In simulation, a seed fixes the random noise and disturbances, so a run can be repeated exactly and both methods can face identical conditions. On hardware, randomise the run order so drifts (battery, temperature, wear) spread across conditions instead of favouring one.

Explain it another way

One coin toss tells you little about a coin; a hundred tell you a lot. Each extra toss helps a bit less than the last.

Worked example 1

Five docking errors: 12, 15, 11, 14, 13 mm. Report them.

Mean = 65/5 = 13 mm. Deviations −1, 2, −2, 1, 0; squares sum 10; SD = √(10/4) ≈ 1.58 mm. Report 13.0 ± 1.6 mm (mean ± SD, n = 5). SE = 1.58/√5 ≈ 0.71 mm.

Common mix-ups

  • More trials make the robot more consistent.
    ✓ More trials make your estimate of the mean more precise; the SD of single runs stays about the same.

4.Discover

Run the fusion lab several times with the same settings but different noise. Note the final error each time, then compute the mean and SD of five runs by hand. Change the noise level and repeat: how does the SD change?

Explorer 03 — Sensor fusion

Two imperfect sensors, one better estimate

A camera gives absolute position but loses sight of the target; odometry never drops out but drifts. Combining them gives an estimate better than either alone.

POSITION (cm)NO VIEWNO VIEWNO VIEW-40-200204002468101214161820TIME (s)
  • True position
  • Camera reading
  • Odometry dead-reckoning
  • Fused (Kalman)
  • ±2σ uncertainty
  • Camera dropout

Camera · absolute, drops out

3.0 cm
25 %

Long-run share of time with no view, in bursts of about 1.2 s (occlusions).

Odometry · relative, drifts

4.0 cm/s
1.5 cm/s

A constant error in measured speed: its position estimate drifts by bias × time.

Fusion method

The Kalman filter weights each sensor by its stated noise, tracks its own uncertainty, and estimates the odometry bias while the camera can see.

Show

Root-mean-square error vs truth · lower is better

  • Camera aloneholds last reading in dropouts7.9 cm
  • Odometry alonedead reckoning from start15.1 cm
  • Kalman filterfused estimate0.9 cm
  • Fused, in dropoutsonly samples with no camera1.1 cm

Camera coverage 60 %. Camera error only over frames it saw: 2.9 cm (≈ its σ).

State

Seed 7. The camera saw the target 60 % of the time in 4 dropouts. Error (RMSE): camera alone 7.9 cm holding its last reading, odometry alone 15.1 cm, kalman filter 0.9 cm (1.1 cm during dropouts). Fusion is 88 % better than the better single sensor. Estimated odometry bias 1.53 cm/s (true 1.50).

Seed 7. The camera saw the target 60 % of the time in 4 dropouts. Error (RMSE): camera alone 7.9 cm holding its last reading, odometry alone 15.1 cm, kalman filter 0.9 cm (1.1 cm during dropouts). Fusion is 88 % better than the better single sensor. Estimated odometry bias 1.53 cm/s (true 1.50).

How to read this

Time runs left to right over 20 seconds. The thin solid line is where the object really is. Crosses are camera readings; hatched columns are dropouts where the camera sees nothing. The dashed line is odometry integrated from the start: smooth, but it wanders away as its bias accumulates. The thick line is the fused estimate, with a shaded ±2σ band showing how uncertain the Kalman filter believes it is. The band widens during each dropout and snaps back when the camera returns.

This mirrors Tactiverge's research question: when vision drops out, can local sensing such as force and joint feedback carry the estimate until it returns?

Assumptions & limitations
  • One dimension, a smooth known trajectory and a single object: real tracking is 3-D, with orientation, multiple objects and data association.
  • Noise is white Gaussian with the σ you set, and the Kalman filter is told the true σ values. Real filters must be tuned against noise they can only estimate.
  • Odometry error is a constant bias plus white noise; real drift also comes from slip, scale-factor error and temperature.
  • Dropouts are random bursts, independent of where the object is. Real occlusions often happen exactly when the task gets hard, for example when a gripper covers the object.
  • The camera has no latency and runs at the same 20 Hz as odometry; real cameras are slower and delayed, which the filter would have to compensate for.
  • Figures are from one seeded run of 401 samples; change the seed to see how much the numbers vary by chance.
Can't use the interactive? Read a description instead

In the fusion lab, repeating a run with different noise gives slightly different final errors; their standard deviation grows with the noise setting.

5.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

Five trials of a robot's docking error gave 29, 35, 41, 41, 32 mm. What is the sample standard deviation (divide by n − 1), in mm?

mm

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A metric has a sample standard deviation of 1.2 across n = 36 independent trials. What is the standard error of the mean?

Practice 3 · a fresh version every time

Pilot runs suggest a trial-to-trial standard deviation of 4 cm. How many trials do you need so the standard error of the mean is at most 1.5 cm? (Give the smallest whole number.)

trials

Practice 4

Why run both controllers on the same list of seeds?

Practice 5

Which number tells a user how much a single run of the robot will vary?

7.Apply it

Run five pilot trials of any lab or Build metric, compute mean ± SD, and use it to choose n for an SE of one tenth of the mean. State whether that n is affordable.

8.Reflect

Concepts: Repeated trials and sample size · Measurement error and uncertainty