feat: field map calibration stage 1 - #241
Merged
Merged
Conversation
Admin page at /admin/field-map-calibration walks through a 4-click corner calibration, derives a pure-TS homography, and renders a 1-metre grid, coordinate axes, and a fixed robot pose at (2, 2, 0 deg) as a visual sanity check. - homography.ts: 4-point DLT solver with Gaussian elimination (no deps); includes isCalibrationWellFormed to reject colinear/too-close/bowtie quads before feeding the solver. - fieldConstants.ts, FieldCalibration type, and rb.ts helpers (getFieldCalibration returns null on 404; saveFieldCalibration throws on non-OK). - FieldCalibrationOverlay renders the field image + normalized 0..1 SVG overlay; clicks land in normalized image coords directly. - Calibration page with state machine, Reset/Save/Verify buttons. Verify button prints round-trip deltas in mm so numerical issues surface before Stage 2 telemetry playback hits them. - Colour-blind-friendly palette (Paul Tol Bright), dual-encoded with shape and stroke width; dark-mode overrides. - Admin-menu entry and docs/field-map-calibration.md design doc.
The corner-click workflow was unclear — the first-corner instruction
only appeared once the user pressed Start, and driver-station-relative
language was missing.
- Persistent 4-row corner table above the overlay shows all four
corners with alliance badges, driver-station-relative headings, and
plain-language hints ("bottom-left of the field image"), visible
from the moment the page loads.
- Each row shows its status: a green check after it's been clicked,
an accent-highlighted arrow for the row you're expected to click
next, a dot otherwise.
- phaseHint now leads with the next corner's description in both
idle and picking phases, so the admin always knows what corner A is
before pressing Start.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin page at
/admin/field-map-calibrationwalks through a 4-click corner calibration, derives a pure-TS homography, and renders a 1-metre grid, coordinate axes, and a fixed robot pose at (2, 2, 0°) as a visual sanity check.What's included
app/common/field/homography.ts): 4-point DLT solver with Gaussian elimination (no external deps).isCalibrationWellFormedrejects colinear/too-close/bowtie click orders before they reach the solver.app/types/FieldCalibration.ts,app/common/field/fieldConstants.ts,app/common/storage/rb.ts):getFieldCalibrationreturnsnullon 404 (intentional divergence from the default idiom — first load legitimately has no record);saveFieldCalibrationfollows the standard throw-on-non-OK idiom.FieldCalibrationOverlay.tsx): field image + normalized 0..1 SVG overlay, pinned to the same rect viaaspect-ratio+ absolute positioning. Clicks produce normalized image coords directly.calibration-page.tsx): state machine (idle → picking-corner-0..3 → ready), Reset/Save/Verify buttons, admin-menu entry, route wiring. Verify button prints round-trip deltas in mm so numerical issues surface before Stage 2 telemetry playback hits them.global.css): Paul Tol "Bright" set, dual-encoded (shape + stroke width + letter labels), with dark-mode overrides.docs/field-map-calibration.md) covering conventions, flow, math, data model, API, palette rationale, and Stage 2 roadmap.docs/plans/2026-04-17-001-feat-field-map-calibration-stage-1-plan.md) included for traceability.Verification
npm run typecheck— cleannpm run build— clean/admin/field-map-calibrationreturns 200 and renders the page component with the expected CSS classes.Manual testing still needed (requires running RavenBrain + login)
Pairs with the RavenBrain PR on the same branch (REST API + V27 migration + 11 API tests, all green).