ARBI
Documents / docs/software/gimbal-model.md

Calibrated gimbal source model

The #42 model lives in apps/arbi-pod-firmware/src/gimbal.ts. ADR-0032 records its simulation boundary. The ordinary pod runtime still uses unavailable servos and only accepts diagnostic resynchronization.

Construct GimbalModel with an actual locally applied pod configuration, its accepted compatibility boundary, current pod/motion identities, trusted current command gate, trusted stopped-motion evidence, a local monotonic clock and a synthetic/unavailable servo adapter. Its private arbi.gimbal-model/1.0 calibration binds configuration digest, calibration/frame revisions, each axis's reference/direction, angle/PWM bounds and maximum velocity, a safe travel pose and a named synthetic settling fixture. The shared configured-command checker verifies hardware, geometry, limits and calibration before dispatch. No private calibration can expand configured angle limits.

reconcile requires a named synthetic known-pose fixture and fresh stopped motion evidence. It cannot discover a real reference or home a mechanism. move consumes the actual protocol command, authenticated source, authorized actor and lease from the trusted local gate. It rejects non-gimbal commands and returns cached running/completed/failed outcomes for duplicates. Its 128-entry ledger never evicts old identities; this model's ledger is in memory, and a service restart must use the runtime's fresh pod epoch. No source-only outcome is automatically a cloud audit receipt.

The servo sink receives bounded pulse targets and modeled travel duration; it does not write PWM. tick requires current stopped evidence and authority, then distinct in-order fresh samples within tolerance for the whole synthetic settling interval. captureEligibility() rechecks those conditions. A timeout, link/lease loss, clock reversal or missing sample inhibits without another move. The safeMotionPose gate is false while moving and requires the configured safe angles. Fresh evidence of normal main motion retains an already settled safe pose while blocking capture and any new repositioning; motion with an unsafe pose inhibits. Orchestration must restore/settle the safe pose before allowing normal main motion; it cannot infer permission from elapsed time.

Status marks pose as commanded or unavailable, simulatedCaptureEligible separately, physicalCaptureEligible=false and physicalSettlingMeasured=false. The tests' ranges and 30 ms interval are synthetic fixtures, not accepted real servo or ribbon limits. Physical autofocus/capture stays disabled until the bench requirements are accepted.