Badminton Robot ·

Analysing the court data, part 1

Analysing the data we captured in the court, answering important questions that will inform future decisions about the vision system.

What I’m trying to achieve

A few days ago, Steven and I went to an empty badminton court to gather data for our detection and prediction algorithm. Today, my goal is to answer:

  1. Do I need to hand label things again?
  2. What was the purpose of getting all those shots of the floor without anything in them?
  3. How accurate was our plane, which we created from all the badminton birdies on the court (namely, how do we quantify how good that approach was)?
  4. What is the value of gravity our recordings give us?
  5. How can I use the ~124 GB of footage we have from when we did a simple sweep over the different camera settings to see if we truly picked the right ones (9 dB gain, 100 fps, 4 ms exposure)?
  6. How good is our current detection method in the court setting?
  7. How good is our current tracking method in the court setting?

The results of this will be to create a plot (or set of plots) showing how accurate our predictions are as a function of time, in two dimensions: WHEN the birdie will reach the floor, and WHERE the birdie will reach the floor.

Driving questions

  1. How do I present the data from these recordings in a useful way?

Context

Sitting on the bench behind the stereo rig, with the laptop on a box under the camera bar.
Figure 1. Me sitting and taking photos while Steven starts trajectories.

The cameras were calibrated at the court.

The ChArUco board held up in the badminton court, seen by the left and right cameras.
Figure 2. One pair of frames from our stereo calibration for this run, left camera and right camera.

But we still need a way to transform our camera coordinates into the court coordinates. Instead of getting a ChArUco marker, we will use the court lines, whose sizes are standard, and set the origin (0, 0, 0) at this corner:

robot me net Z X Y 13.40 m 6.70 m 3.05 m (0, 0, 0) 6.10 m
Figure 3. The origin (0, 0, 0) at this corner of the court.

We placed several birdies on the floor (cork facing upwards) in known spots.

robot me net Z X Y 13.40 m 6.70 m 3.05 m (0, 0, 0) N1 N2 (out of view) N3 F1 F3 F4 6.10 m
Figure 4. The known spots where we placed birdies on the floor.

We then measured the coordinates in the camera frame, which gave us enough information to perform a homogeneous transformation to the court frame.

[xyz1]court=[0.001−1.0000.0082.1910.9650.0030.2610.524−0.2610.0080.965−1.3930001][xyz1]camera\begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}_{\text{court}} = \begin{bmatrix} 0.001 & -1.000 & 0.008 & 2.191 \\ 0.965 & 0.003 & 0.261 & 0.524 \\ -0.261 & 0.008 & 0.965 & -1.393 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}_{\text{camera}}

Question 1

Do I need to hand label things again?

First, I need to label when a hit started in our data, and where the birdie hit the ground. I am just trimming our data to the useful bits.

cd ~/Projects/baddy-bot/vision/analysis
~/.venvs/cpsc330/bin/python landing_label.py ~/Projects/baddy-bot/recordings/court_2026-11-21 --shot shot_01
The landing labeller on shot 1: both cameras upright, zoomed in on the cork where the birdie hit the ground.
Figure 5. Labelling when the hit started and where the birdie hit the ground, in both cameras.

With labelling done (took 68 minutes by the way), it is time to address question 2.

Question 2

What was the purpose of getting all those shots of the floor without anything in them?

We got a few shots of empty floors. We did this so we could figure out where our birdies were when we went to place them on the court:

The empty court floor in front of the far wall, seen from the left camera.
Figure 6. The empty floor, from the left camera.
The same view of the court floor with birdies standing on it, cork facing upwards.
Figure 7. The same floor with the birdies placed.
Black image with small white spots where the birdies stand, each circled and named N1, N3, F1, F3 and F4.
Figure 8. Subtracting the empty floor from the frame with birdies leaves only where the birdies are.

Question 3

How accurate was our plane, which we created from all the badminton birdies on the court (namely, how do we quantify how good that approach was)?

To quantify how good this approach is, I have to explain that our camera readings perform worse at larger distances. Part of this is calibration, the other part is math:

Z=f BdZ = \frac{f\,B}{d} ∣∂Z∂d∣=f Bd2=Z2f B⟹ΔZ≈Z2f B Δd\left|\frac{\partial Z}{\partial d}\right| = \frac{f\,B}{d^{2}} = \frac{Z^{2}}{f\,B} \quad\Longrightarrow\quad \Delta Z \approx \frac{Z^{2}}{f\,B}\,\Delta d
  • ZZ: depth from the cameras
  • ff: focal length, 1908 px
  • BB: baseline, 0.617 m
  • dd: disparity, how far the birdie shifts between the two cameras’ images, in pixels
  • Δd\Delta d: the disparity error, and ΔZ\Delta Z the depth error it causes
ΔZ≈(14 m)2(1908 px)(0.617 m) (1 px)≈17 cm\Delta Z \approx \frac{(14\ \text{m})^{2}}{(1908\ \text{px})(0.617\ \text{m})}\,(1\ \text{px}) \approx 17\ \text{cm}
from above, to scale except the pixel, which is drawn 10 times wider looking down the cameras' up axis, which tilts 15° with the rig N1N3F1F3F4 left right B 0 m 5 m 10 m 15 m depth error, true to scale (f = 1908 px) 0 cm 20 cm 40 cm 60 cm 0 m5 m10 m15 m depth from the cameras our rig (0.617 m), 1 px the sliders below N1, N3 F1 F4 F3
baseline ours 1 m
disparity error 1 px 2 px
Figure 9. How the baseline turns one pixel of disparity error into depth error.

Having a pixel error this large implies a 17 cm error at 14 m away!

In this stage, we are not addressing how to minimise this error. We are simply looking to use the court lines, and the camera coordinates, to create a plane which represents the floor.

The court floor seen from the left camera with the court lines from the fitted floor frame drawn on top in magenta; they sit close to the painted lines near the camera and drift off them further away.
Figure 10. The court lines from our floor frame (magenta), drawn over the left camera's view of the floor (brightened).

To do this, we create a matrix which transforms the distance between where we know the birdies are in the court frame:

Birdiex (m)y (m)z (m)
N10.460.0354.72
N32.460.0354.72
F10.000.0358.68
F30.000.03513.40
F43.050.03513.40

and the set of camera coordinate positions of those birdies:

Birdiex, up (m)y, right (m)z, out of the lens (m)
N1-2.0791.7185.761
N3-2.049-0.3105.724
F1-3.1492.2939.727
F3-4.3952.40314.348
F4-4.257-0.72913.839

Since each camera reading is going to have varying error (depending on depth, mainly), the error will NOT be uniform.

BirdieDepth from the cameras (m)Placed at x, z (m)T puts it at x, z (m)Error in x (cm)Error in y (cm)Error in z (cm)Error magnitude (cm)
N15.760.46, 4.720.52, 4.72+5.8-0.6+0.45.9
N35.722.46, 4.722.55, 4.67+8.6+0.7-5.510.3
F19.730.00, 8.68-0.03, 8.84-2.5-0.1+15.615.8
F314.350.00, 13.40-0.10, 13.62-9.9+0.5+22.324.4
F413.843.05, 13.403.03, 13.07-2.0-0.5-32.933.0

Here is a render I asked Claude to make to help us visualise what this error looks like more intuitively.

where the birdie actually is where our cameras think it is after the transformation rings every 10 cm
drag to orbit, right drag or Alt + drag to pan, scroll to zoom
Figure 11. Where each birdie actually is, and where our cameras think it is after the transformation.

What I have learned from this is that I ought to place more birdies closer to the camera, where the readings of the camera are more trustworthy, such that the transformation of these birdies in the camera coordinates ends up on the real plane (the actual floor) more precisely.

And that leads us to question 4.

Next

  1. Present to the team.
  2. Address questions 4-7.