AUTOMATED PATH A MAPS  /  SUPERVISED COMMISSIONING
This adapter drives the reviewed M1 Grbl/Uno + Pico branch. For a loan stage
use its controller protocol and equivalent safeguards, or capture spot data
with capture.py while the stage is handled manually. The old Bench Studio
teaser remains disconnected. No real motor or Pico was available for these
software checks. The rig's limits, travel, mechanics and photometry must be
accepted at the instrument before commanding a scan.

1. Plan four points. The default is offline; it never opens a port.
    python3 raster.py --config raster_smoke_template.json
   Its 2×2 grid at ±1 mm around the registered optical field centre gives
   (-1,-1), (+1,-1), (+1,+1), (-1,+1) in Grbl G54 work X,Z. A larger map
   uses the same convention. Proposed 1 mm configuration = 100 mm X span,
   75 mm Z span, nx=101, nz=76; a 0.5 mm map uses nx=201, nz=151.
   First do a short mechanical stroke and four points. With validated
   bidirectional positioning use serpentine. If backlash requires approaching
   each row from negative X, use same_x_approach with a qualified positive
   approach_mm; reserve margin beyond the leftmost point in the safe rectangle.
   The runner checks that extra waypoint too. Z rows progress in +Z; start
   from a preloaded position if Z approach history matters.

2. With hardware at hand and qualified, fill the copied config and setup JSON.
   Set physical +X and +Z in the same directions as the bench. Survey the
   receiver-plane optical centre; nominal (-35.053 mm, 120 mm) at Y=−70 mm.
   In the motion controller set persistent G54 (X0,Z0) to that actual point.
   Measure the G54 machine-coordinate offsets, archive them and the firmware
   build; fit the finite *swept* detector body, cable transitions, carriage,
   far corners, transit from home and the return path, under load. Enter the
   surveyed G54 X/Z offsets, actual world centre, safe work rectangle, tested
   travel/feed, arrival tolerance, upper move time, settling determined from
   the edge test, IDs and signer. A value from CAD is not a signed inspection.
   Run the manual checks in MOTOR_OPTION.txt including positive/end/NC break
   alarms; harness opened at either end must suppress motion.
   The configuration requires a stock negative Grbl machine-coordinate range.
   Use $5=1, $10=0 (WPos state), $13=0 (report mm), $20=1, $21=1, $22=1.
   Set G21 G54 G90 G94, zero G92 and tool length offsets. Verify no inactive
   G54 axis switch, spindle tool, or position transformation is in use.
   Home with supervision. Jog inside the cleared work region at the registered
   point. Verify its position independently. Never bypass a fault using $X.
   Confirm the optical Pico and motion controller's exact USB ports and state.

3. Install the tested host dependencies in an isolated Python environment:
    .venv/bin/python -m pip install mpremote==1.26.1 pyserial==3.5
    cp raster_smoke_template.json qualified_smoke.json
    cp setup_template.json point_setup.json
   Replace the unfilled values. For a dark trial use both_dark and caps on
   both heads; specify the state anew for refs/recesses. The stored G54 offset
   must agree with the real firmware's $#. Verify the ADC with capture.py once.
   Set up the soft/hard limits and independent disconnect before this command.
   Example port tokens MUST be replaced with the actual different device paths:
    .venv/bin/python raster.py --config qualified_smoke.json --metadata point_setup.json --pico-port /dev/cu.PICO --stage-port /dev/cu.GRBL --output smoke001 --execute
   The runner requires "GO smoke001" at the controlling terminal, keeps both
   serial links open, executes G1 travel in mm, checks actual controller
   status/coordinates and settling, and saves each raw bracket under raw/.
   The session starts from a supervised home with an established safe centre.
   Some Uno USB bridges reset when opened. If that happens, the program stops.
   Use a fresh attempt name and add --manual-setup to obtain a supervised
   console on the *same connection* before the scan. The operator may type
   $H then HOME to request the commissioned home cycle, MODES to restore
   G21 G54 G90 G94, '?' for position/status, or one-axis relative jogs up to
   5 mm (e.g. X -2) to regain the inspected starting region. Every motion is
   requested by the operator and logged. Check clearance for the entire
   home-to-centre transit. Verify registered centre on the gauge and type
   DONE before scan preflight. No automatic homing, alarm unlock, centring or
   retry occurs. An uncommissioned/invalid rig needs manual setup outside this
   program; the console cannot change offsets, soft limits or machine settings.

4. Spot-check run001 at the centre, then exercise 2×2 with LED off; a one-way
   move, settle, bright reading and return-to-fiducial test follows. Journaled
   positions explicitly distinguish commanded world and controller-reported
   work position. The independent observation is null until an external gauge
   is read; preserve external observations with the run. A motor that stalls
   can still return perfect Grbl coordinates. Map each surface with the same
   detector, relevant reference/dark/temperature/monitor IDs and protocol.
   Keep specimen/reference map IDs. Optical triage and repeated map protocol
   are in OPTICS_AND_COLLECTION. Collect actual production timings.

5. Recover deliberately. journal.jsonl records an intent before every move
   and a separate completed point after raw-file flush and SHA-256,
   order/completeness/time checks, ADC headroom and stage status. A fault triggers feed hold.
   Verify that the actual stage has stopped, protect the vertical load and
   isolate motor power if necessary. On ambiguous or partial move, check
   the journal and last observed location, re-home under supervision and
   reacquire as a new complete map or use a separately approved recovery
   protocol. The program never replays motions or merges partial runs.
   An 'opening' status after sudden host loss requires physical inspection.
