Skip to content

fix(bed): locate a toolhead camera against the reference before judging plate state - #758

Open
alex-mextner wants to merge 2 commits into
mainfrom
fix/bed-plate-false-missing
Open

alex-mextner wants to merge 2 commits into
mainfrom
fix/bed-plate-false-missing

Conversation

@alex-mextner

@alex-mextner alex-mextner commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Refs #757

Cause

The K1 SE camera rides on the toolhead, so after a job the same empty plate is seen shifted (~100 px, a few % zoom) from where the reference was taken. The 2026-11-13 preflight frames (20:37 / 20:38) show the plate on and empty; the only reference at the time (Z 125.0) was taken from yet another place. Compared pixel by pixel that read ~70% of the plate surface changed -> plate missing -> preflight FAIL, start refused, and bed check --assume-empty refuses a plate-missing verdict so it could not override. Not Z (124.8 vs 125.0 is within tolerance), LED or thresholds.

Change

lib/bed_pose.py locates the frame against its reference first, by the scene round the bed region (what a plate or part cannot change):

  • same view (a fixed camera, any light): judged as before
  • moved (SIFT homography, scene lines up): the frame is warped onto the reference and judged there; evidence masks are mapped back onto the camera frame
  • lost: the frame was not judged, so EVERY verdict (a clear bed with the plate on too, never a PASS) becomes unknown (preflight WARN) with the fix: 3d printer bed reference NAME --capture from where the camera is now (check the watch.bed.roi outline), or put the toolhead back
  • a --no-plate reference from another view is not used; a frame judged from a moved/lost camera never becomes the reference by itself (bed_refs.refresh_refusal)

Evidence

Real saved frames in tests/data/bed/k1se_*.jpg (camera frames of 2026-11-13, scaled to 640 px).

Tests

tests/test_bed_pose.py: 30 tests, e.g. both preflight frames against the old reference give unknown/WARN with the fix; the 20:37 frame passes against the 20:38 reference from ~100 px away; a plate taken off and a part on the plate still FAIL, also with the camera moved or zoomed; U1 parts/spaghetti/night light are never lost; empty/whole-frame ROI. With the pose check disabled the lost-pose test fails fail. pytest tests/test_bed_*.py: 591 passed.

Not done / follow-ups

bed reference k1se --capture from the idle view must wait until the running print ends; do not move the bed meanwhile. Review notes not addressed: a MOVED frame judges only the part of the bed region the moved frame still covers (>= 90 %), no bin/3d e2e test.

…becomes unknown

Refs #757. A lost pose means the frame was not judged against a picture the camera no longer sees; a clear/plate-present read from pixels that happen to match must not PASS the start gate. pose_shift_px is now in the lost metrics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant