feat(ui): registration wizard — fit the cut to the sticker from three jogged points - #54
Merged
Merged
Conversation
… jogged points The 1.1.0 approach (touch-mark each point, read the miss, shift work zero) could only correct a translation, and only by moving the origin. A sticker mounted a few degrees off — which is how stickers get mounted by hand — could not be cut at all. Replace it with a wizard that adjusts the artwork instead. Importing an SVG with calibration points opens the wizard: mount the sticker; then, per point in file order, jog the pen tip onto the printed crosshair (arrow keys or on-screen arrows, step size, pen up/down to sight the tip) and Set records the live work position; finally fitRegistration finds the rigid transform (rotation + translation, scale fixed at 1:1) that maps the file's points onto the measurements — the 2-D Kabsch solution written in the placePolylines convention so the result is a Placement — and Apply sets it on the artwork. Rotation, offset, per-point residual and the implied print scale are shown; RMS over 0.3 mm or scale off by more than 1% is flagged. Scale is deliberately not solved for: the sticker is printed 1:1 and the cut must match its real size, not stretch to a mis-jogged point. The warning is on the RMS, not on any one residual: least squares shares a single point's error across all points, so the mis-set point is not reliably the one with the largest residual (a unit test pins that down). Removed: Run calibration, Apply correction, the shiftWorkZero command and generateCalibrationGcode. The streamProgram busy guard from 1.1.0 stays. Verified in Chromium with a seeded session: the Registration panel lists the points at page 15,15 / 195,15 / 15,282; Register… opens the wizard; the mount step and the point step render with Set disabled and the reason while disconnected. fitRegistration round-trips known placements (translation, ±rotation incl. ≈180°), reports a 2% print scale without applying it, and handles 2/1/0 points. OpenSpec change svg-calibration-points revised; the hardware group (7) stays unchecked until a real sticker is cut. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
BernardJen
force-pushed
the
change/svg-calibration-points
branch
from
September 8, 2026 15:04
f5cae72 to
552b92a
Compare
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.
Why
1.1.0's registration (touch-mark each point, read the miss, shift work zero) could only correct a translation, and only by moving the origin. A sticker mounted a few degrees off — the normal case by hand — could not be cut. The operator asked for a wizard that measures where the sticker really is and moves the cut to it. OpenSpec change
svg-calibration-points, revised.What
src/ui/RegistrationWizard.tsx), opened automatically after importing an SVG with ≥2 calibration points and via Register…: mount → per point jog onto the crosshair (arrow keys / arrows, step, pen up/down) and Set → result → Apply.fitRegistration(src/plot/register.ts): 2-D rigid least squares (rotation + translation, scale fixed at 1:1) in theplacePolylinesconvention, so the result is aPlacement. Reports per-point residuals, RMS and the implied print scale; the wizard flags RMS > 0.3 mm or scale off > 1%.shiftWorkZero(controller, protocol, gateway, client) andgenerateCalibrationGcode. ThestreamProgrambusy guard stays.src/ui/styles.ts. README section rewritten, changelog, v1.2.0.Design notes
Verification
mise run cigreen, 97 tests, coverage 55% statements.fitRegistrationround-trips known placements (translation, ±rotation incl. ≈180°), flags a 1.5 mm mis-set point via RMS, reports a 2% print scale without applying it, handles 2/1/0 points.🤖 Generated with Claude Code