CrackRobotics

Step 1

Noise and averaging

Every reading of the ball is a little wrong. Measure how wrong, then average the error away.

Sensors lie a little

Until now world.balls() told you exactly where every ball was. Real sensors (cameras, depth sensors, motion capture) don't. In this step every reading comes back with Gaussian noise added to each coordinate:

z=xtrue+v,v∼N(0,σ2),σ=1.5 cmz = x_{\text{true}} + v, \qquad v \sim \mathcal{N}(0, \sigma^2), \quad \sigma = 1.5\ \text{cm}

That's about the size of the grasp tolerance. The gripper only attaches when the ball is within about 1.6 cm of the fingertips' centre, so a program that trusts a single reading misses about one run in three.

Averaging

Each reading is wrong by a different random amount. Take NN independent readings and average them:

x^=1N∑i=1Nzi,σx^=σN\hat{x} = \frac{1}{N}\sum_{i=1}^{N} z_i, \qquad \sigma_{\hat{x}} = \frac{\sigma}{\sqrt{N}}

The errors partly cancel, and the spread of the average shrinks like 1/N1/\sqrt N:

Readings NN1425100
Error σ15 mm7.5 mm3 mm1.5 mm

Four times the readings halves the error. Diminishing returns, but for a ball that sits still, reading is cheap.

See it

viz.chart(name, kind="scatter") makes a scatter plot, and viz.plot(series, y, x=..., chart=name) adds a point to it. Plot each reading's (x,y)(x, y), then your mean. The cloud should be roughly circular, about 3 cm across, with the mean near its centre. Open the Plots tab after the run.

Your task

  1. Implement estimate(samples): it gets an N×3N \times 3 array of readings and returns your best guess of the true position (a 3-vector). The grader tests it on 60 fixed readings.
  2. Average at least 30 readings of the red ball and use the estimate to put it in the cup.

The layout and the noise change on every run, so press Run a few times.

Goals

  • Program runs without errors
  • estimate(samples) lands within 5 mm of the truth on 60 fixed noisy readings
  • The red ball is resting in the cup
Loading physics…
Loading 3D view…
0.0 / 0.0 s

Python is loading. It takes a few seconds the first time.