Skip to content

fix(camera): Test Mode solves again on imx296 units (#712) - #713

Open
brickbots wants to merge 1 commit into
mainfrom
fix/test-mode-fov-gate
Open

brickbots wants to merge 1 commit into
mainfrom
fix/test-mode-fov-gate

Conversation

@brickbots

Copy link
Copy Markdown
Owner

Summary

Since 2.6.3, Test Mode does not solve on most v3 PiFinders. This PR makes Test Mode solve again. Fixes #712.

Cause

Test Mode (Tools > Test Mode) gives the solver a stored star image instead of camera frames. That image shows 10.2 degrees of sky.

In 2.6.3, the solver started to accept only solves whose field of view agrees with the sensor and lens of the PiFinder (the FOV gate, ADR 0027 and ADR 0029). Most v3 units have the imx296 sensor. With the imx296, no lens setting gives a gate that includes 10.2 degrees:

imx296 lens FOV gate (degrees)
Not set (16mm assumed) 11.65 to 18.84
12mm 13.92 to 18.84
16mm 11.65 to 15.77
25mm 7.02 to 9.50

So the solver rejects every Test Mode frame. In 2.6.1 the gate was always 12 ± 4 degrees, and the test image solved.

#632 added the optical_train_known flag for this problem: frames that did not come through the PiFinder's own lens get no FOV gate. But the camera set this flag only once, at startup, from the camera type. Test Mode did not change it.

Changes

  • camera_interface.py: the new method _set_test_mode turns Test Mode on or off and publishes optical_train_known again. When Test Mode is on, the flag is false. When Test Mode is off, the flag goes back to the camera's own value (true for real cameras, false for the debug camera). The Test Mode state moves from a local variable in the camera loop to the attribute _test_mode_on.
  • With the flag false, lens self-heal (fix(optics): FOV gate width follows lens confidence, plus lens self-heal (ADR 0029) #624) also ignores Test Mode solves. Without this, self-heal could read the test image's 10.2 degrees as a measurement of the fitted lens and change the lens setting.
  • docs/ax/camera/CONTEXT.md: the definition of unknown optical train now includes Test Mode.

Tests

  • New unit tests in test_camera_interface.py: Test Mode on makes the flag false. Test Mode off makes it true again on a real camera and keeps it false on the debug camera.
  • tetra3 with test_images/pifinder_debug_02.png: the image solves at 10.20 degrees with no gate and with the 2.6.1 gate. It does not solve with any imx296 gate.
  • 2425 smoke and unit tests pass. ruff and nox -s type_hints pass.

Not tested

  • Not tested on hardware. To check on a v3 with imx296: select Tools > Test Mode and look for a solve. Then select Test Mode again and look for a normal solve on the sky.

🤖 Generated with Claude Code

Since 2.6.3 the solver's FOV gate comes from the device's sensor and lens
(ADR 0027/0029). Test Mode feeds the solver the bundled test image, which
is 10.2 deg wide. On an imx296 no lens gives a gate that includes 10.2 deg
(no lens [11.65, 18.84], 12mm [13.92, 18.84], 16mm [11.65, 15.77], 25mm
[7.02, 9.50]), so on most v3 units Test Mode never solves.

#632 added optical_train_known for frames that did not come through the
device's optics, but the camera published it once at startup and Test
Mode did not change it. Move the Test Mode toggle into _set_test_mode,
which republishes the flag: unknown while Test Mode is on, the camera's
own answer when it is off. An unknown train also keeps lens self-heal
from reading the test image's FOV as a measurement of the fitted lens.

Checked with tetra3 on test_images/pifinder_debug_02.png: it solves at
10.20 deg with no gate and with 2.6.1's fixed 12 +- 4 gate, and does not
solve under any imx296 gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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