Calibration Guide

Calibrate camera-to-arm transforms using the interactive browser Recalibrate wizard or the tools/check_markers.py CLI workflow.

Calibration maps camera pixels into the Kinova arm's base frame and solves the 3D camera lens position for raised token parallax correction. You only need to recalibrate when the camera, arm base, or board markers move.

When & How to Prepare

  • Empty board: Remove all X and O pieces from the 3x3 grid and hide any loose spare markers.
  • Stand 3–4 pieces beside the board: Place raised X and O tokens far apart (e.g., two on the arm side, two on the camera side) inside the camera's view.
  • Arm powered & homed: Verify ping 192.168.1.10, start kinova_gen3_node, and keep a hand on the e-stop.
  • Camera fixed: Do not bump the tripod or board sheet once calibration begins.

Interactive Browser Recalibrate Wizard

When connected to the real robot bridge (web_bridge) in /play, Step 2 (Calibration) displays the currently saved square size, tableZ, corners, and tray count. Click Recalibrate to step through every board and piece marker directly in the browser:

Start session (POST /api/calibration/start)

Initializes a calibration session from the current camera view (marker_input / saved view) and returns ordered steps: board markers (corners + squares) followed by spare piece-top markers.

Touch & Record each marker (POST /api/calibration/record)

Jog the gripper pointing straight down with the gamepad or Kinova Web App until the closed fingertips touch the center of the highlighted marker, then click Record. The bridge calls /get_tool and records the arm's [x, y, z] coordinates.

Skip unreachable markers (POST /api/calibration/skip)

Far corners may lie outside the arm's pointing-down envelope. Click Skip to advance to the next marker. At least 4 board markers (and ideally 2+ piece tops) are required before finishing.

Finish & Fit (POST /api/calibration/finish)

Runs Calibration.fit_points(..., level=0.01), updates config/marker_calibration.yaml and config/calibration.yaml, and returns fit diagnostics (square size, table z spread, worst board marker error, and solved camera position).

Keep board touches level within 10 mm

Calibration.fit_points(..., level=0.01) uses a 10 mm height tolerance to separate flat board touches from raised piece tops. Keep fingertips consistently at table height for board markers.

CLI Calibration (Single Host & Split Windows/WSL)

You can also run calibration from the terminal with tools/check_markers.py. First check that every corner (0–3) and square (10–18) reads at ≥ 90%:

Check camera marker visibility
python tools/check_markers.py camera

1. Save camera view on Windows

Windows PowerShell
python tools/check_markers.py calibrate --save-view C:\Users\<you>\view.yaml

2. Touch markers in WSL

WSL Ubuntu 24.04 (with kinova_gen3_node running)
export ROS_DOMAIN_ID=87 ROS_LOCALHOST_ONLY=1
python3 tools/check_markers.py calibrate --view /mnt/c/Users/<you>/view.yaml
Ubuntu / WSL with direct camera
python3 tools/check_markers.py calibrate --camera 0

Fit Checks & Saved YAML Files

Inspect the calibration report before accepting changes:

  • Square size: Should match your printed grid (~11.15 cm).
  • Table height spread: Touched board points should stay within 10 mm in z.
  • Square center offset: No square marker should be more than 10 mm off the center of its grid square (re-stick if higher).
  • Camera position & parallax drop: Piece-top error should fall from several centimetres without height correction to a few millimetres with it.

Both config/marker_calibration.yaml (homography planes, camera position, learned board, x_height, o_height) and config/calibration.yaml (square_size and corners 1, 3, 7, 9) are updated. Re-run colcon build --symlink-install in ros2_ws/ if nodes read from installed config.

Reach & Hover Verification

Verify reachability read-only first, then hover 10 cm above each marker with a hand on the e-stop:

Verify reach (no motion) and move (hover 10 cm)
# 1. Read-only IK reachability check against docs/reach_pointing_down.csv
python3 tools/check_markers.py reach --view /mnt/c/Users/<you>/view.yaml

# 2. Hover 0.10 m above each marker, prompting before each move (MOVES THE ARM)
python3 tools/check_markers.py move --view /mnt/c/Users/<you>/view.yaml --hover 0.10

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