ARBI
Documents / docs/software/input-homing-model.md

Input and homing model

The C11 control-cabinet application contains inputs.c and homing.c as pure fixed-memory simulated models. ADR-0027 keeps physical circuit approval separate. No input GPIO, driver enable, real sensor reader or homing command is registered. inputs_physical_available always returns false, including after a successful fixture. The diagnostic target remains Fault and actuation-inhibited.

Four axes have separate home/limit/alarm channels; dock and latch have independent channels. Explicit raw states are unavailable, inactive, active, disconnected and contradictory. Model readings distinguish unavailable, unstable, valid and latched fault. A raw unavailable state never becomes a healthy inactive measurement. Sample age over 100 ms, future/out-of-order timestamps, disconnected/contradictory values and excessive changes block or fault the model. Five-millisecond fixture debounce requires observation on both sides of the interval; repeated identical timestamps cannot advance it. Alarm/limit fixture assertion is immediate and release is debounced. No timing here is a physical response measurement.

The homing policy accepts only simulation:true and fixture record synthetic-homing-59. It copies the policy and active configuration/hardware/calibration/frame/model identity. Axis order must be a permutation of four axes, directions must be ±1, relative travel is at most 128 commanded steps per axis, backoff 2–16 steps, repeatability at most four steps, per-axis time at most 5 seconds and total time at most 20 seconds. Seek rate is 100–1,000 Hz, slow rate is 100 Hz through the seek ceiling and discrete acceleration is 10,000–100,000 steps/s². These are synthetic parameters; the actual pulse planner can impose tighter bounds. They are not accepted homing rates for the mechanical system.

Only one axis and one finite one-step pulse plan can be pending. The consumer owns a copy and reports its sequence completion; another tick cannot publish a second plan until completion. Homing first releases an initially active switch, seeks its first reference, backs off until release, approaches slowly and requires the second reference to agree within the configured tolerance. Axis/total travel and time include all phases. Every tick checks required home/limit/alarm evidence and revision identity. Any fault, missing channel, alarm/limit, scheduler error, clock/sequence bound or implausible reference inhibits new plans, discards pending intent and invalidates all reference flags. A mismatched or repeated completion cannot settle an old plan. Deliberate restore starts a new model sequence with no restored motion.

Reference counts are simulated command-relative observations. They never replace the shared calibration or a measured home reference. Completion is HOME_COMPLETE with reason SIMULATED_REFERENCES_ONLY; the model has no Ready/Parked transition or physical permission. Dock/latch inputs do not become engagement proof through pose, and missing tension/alarm/limit prerequisites remain explicit. Real input and output adapters require the linked review requirements, qualified circuit records and secured physical evidence.

Application host tests compile the same model as the target. All four host binaries support AddressSanitizer/UndefinedBehaviorSanitizer through the documented build command. Evidence records source checks separately from missing wiring/rig validation.