Step 5
Frames & homogeneous transforms
A sensor reports the ball in its own frame. Pack its pose into a 4×4 matrix and bring the ball into the world.
Frames
Every position is measured from some frame: an origin and three axes. So far everything has been in the world frame, fixed to the robot's base. This step's detector is a sensor on a stand at the corner of the table, with a built-in ball finder. It reports each ball in its own frame: points out of its lens, to the right and down in its image (the usual camera convention). None of those axes lines up with the world's. It draws its frame at the start of every run.
Poses as 4×4 matrices
A frame's pose is a rotation (its axes, as columns, in world coordinates) and a translation (where its origin is). A homogeneous transform packs both into one 4×4 matrix:
To move a point, append a 1 and multiply:
which is the same as : rotate, then shift, as in step 3, in a single multiplication.
Reading the subscripts
takes points written in frame and gives them in frame . Chains work when the inner subscripts match and cancel: . detector.pose is .
Going back
The inverse goes the other way: . A rotation's inverse is its transpose (rows and columns swapped), so
It undoes the shift, then the rotation: .
Seeing with a Camera, step 3 turns camera rays into world rays with the same and .
Your task
- Implement
make_T(R, t),transform(T, p)andinvert(T). - Read the red ball from
detector.detect()and convert it to world coordinates withdetector.pose. - Draw the world frame and an arrow from the detector to the ball, then put the ball in the cup with the starter's
pick_and_drop(p).
world.balls() is switched off: the detector is your only way to see the balls. Its stand shifts a little on every run, and the balls move too.