ArUco Markers & Board

Generate and print DICT_4X4_50 markers at 100% scale, place corner/square/token IDs, and understand covered-square detection and 3D parallax correction.

Every square, board corner, and X/O token carries a printed OpenCV DICT_4X4_50 ArUco marker. This allows one angled overhead camera to read the board state, measure exact square centers in the arm's frame, and detect off-board spare pieces with orientation.

Generating & Printing Markers

Generate the printable A4 PDFs and placement guide from the repository root:

Generate A4 PDFs & 300 DPI PNGs
python3 tools/make_markers.py markers

This produces markers/markers_guide.pdf (layout diagram) and markers/markers.pdf (printable cutouts).

Print at 100% / Actual Size

Disable "Fit to Page" when printing markers.pdf. Measure the 100 mm ruler at the bottom of the sheet after printing—if it is not exactly 100 mm, the markers will be scaled. Use matte paper, cut along the grey borders (preserving the white quiet zone), and glue them flat.

DICT_4X4_50 Marker Assignments

All IDs and dimensions are defined in ros2_ws/src/unbeatabot/config/markers.yaml:

Marker IDsRolePrinted SizePlacement
0, 1, 2, 3Board corners30 mmOutside the grid by squares 1, 3, 9, and 7 (corner_offset: 0.035 m)
10 – 18Squares 1 to 930 mmCentered inside each square; hidden when a piece covers the square
20 – 29X tokens15 mmOn the 21 mm center square of the foam plus, edges aligned with arms
30 – 39O tokens30 mmCentered on top of each 70 mm O disc (o_height ≈ 20.6 mm)

Physical Board & Spare Pieces Layout

  • Tape the board sheet flat within the arm's reach (square_size ≈ 11.15 cm; keep Square 7/9 clear of x > 0.45 m).
  • Stand 4–5 spare O tokens beside the board on the arm/O side (-y) within reach and inside the camera's field of view.
  • Keep unused spare markers out of the camera's view so no stray tokens are detected.

Board Reading & Covered (?) Semantics

Any 4 visible corner or square markers are enough to locate the board homography, so a player's hand momentarily crossing the grid does not lose tracking.

A token only counts as placed on a square once that square's own center marker (10–18) is hidden. If a square marker disappears without a clearly decoded token on top (for instance, a hand blocking it or a momentary missed X marker), read_board() marks that cell as covered (?) and MarkerWatcher waits until the move stays still and unambiguous.

3D Ray Parallax Correction & /spare_pieces

Token markers sit ~21–23 mm above the table on top of the foam pieces. Viewed from an angled tripod camera, a table-only homography projects the raised marker several centimetres farther from the camera than where the piece actually rests on the table.

Once calibrated, Calibration stores the 3D camera lens position (e.g., [0.73, -0.0651, 0.3119] in marker_calibration.yaml) and intersects the camera ray at the token's height:

  • to_arm(pixel, z) — maps a pixel at height z into the arm's base frame.
  • drop(pixel, height) — finds the pixel directly beneath a raised marker on the table.
  • to_pixel(x, y, z) — projects an arm-frame 3D point back into camera image coordinates.

marker_input publishes all off-board tokens on /spare_pieces as JSON objects {id, shape, x, y, z, angle}, allowing game_manager to pick the nearest reachable spare token with arm.pick_at instead of relying only on fixed tray coordinates. Synthetic tests achieve ~0.1 mm square center error and ~0.8 mm / 2.5° token pose accuracy.

Unbeatabot — an EECS 4421 project. Layout based on Animate UI. Source on GitHub.