servo_sim: closed-loop DO/GNSS simulator (closedLoopServoSim)#81
Merged
Conversation
Deterministic closed-loop test bed for servo/gate/fusion design, so regressions stop being discovered overnight on lab hardware. Drives the REAL DOFreqEst (EKF + 6 arms + chi² gate) and OcxoTrustedGate in a closed loop: a ground-truth plant emits measurements that respond to the servo's commanded adjfine each epoch (z_ticc = -phi_do - qerr(phi_rx)). Faithfulness (honest, see docs): free-run floors calibrated EXACT (clkPoC3 45ps / PiFace 54ps), TICC-innovation median matches the day0527 captures (~3ns, driven by the modeled ~2.3ns PPS-edge jitter the PPP arm can't see), and the gate-starvation + EKF-overconfidence-on-coast failure modes reproduce. Exact lock-quality numbers (104/74/565ps) need the adaptive coast scheduler + fat-tail innovations — the next increment, and the test bed bravo needs for longTauGnssCoupling. Findings the sim already surfaces: - the OCXO gate only gates Arm 4 (TICC); a gated host locks iff x[2] has a non-TICC carrier (EXTINT) -> supports disciplineModeFsm mode-keyed gating - long coasts diverge because sqrt(P[3,3]) shrinks while x[3] (the hidden DO-freq state) stays biased -> the longTauGnssCoupling overconfidence problem, reproduced deterministically CLI: --preset / --faithfulness / --sweep field=v1,v2 / --two-clock / --set / --out / --plot. 11 new unit tests pin the invariants. Full suite: 1391 passed, 1 skipped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per main's PR #81 review (APPROVE): (1) document that plant and filter import the SAME _qerr/tick model, so the sim validates loop dynamics but cannot reveal a bug in the measurement model itself; (2) correct the run_two_clock docstring/CLI — it shares the WHOLE RNG (DO noise too) and desyncs across differing arm configs, so its |Δ| is a plumbing smoke test, not a cross-host-bound measurement, until next-increment #3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
952e039 to
6dfc3d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closed-loop DO/GNSS servo simulator — the
closedLoopServoSimbead (do-first item in main's 2026-05-29 handoff to charlie). A deterministic test bed so servo/gate/fusion regressions stop being discovered overnight on lab hardware.adjfineeach epoch (z_ticc = -φ_do - qerr(φ_rx)), so it exercises acquisition / gate over-rejection / coast dynamics thatvalidate_ocxo_gate_phase4.py(replay) cannot.DOFreqEst(EKF + 6 arms + chi² gate) andOcxoTrustedGate. The only new code is the plant + loop wiring. Verified the actuator sign againstpeppar_fix_engine.py:8148(adjfine_ppb = -servo.update(...)).scripts/peppar_fix/servo_sim.py(lib),scripts/servo_sim.py(CLI),scripts/peppar_fix/test_servo_sim.py(11 tests),docs/closed-loop-servo-sim.md.Faithfulness (honest — see docs table)
Findings the sim already surfaces
x[2]has a non-TICC carrier (EXTINT). SupportsdisciplineModeFsmmode-keyed gating.x[3](the hidden DO-freq state) stays biased — thelongTauGnssCouplingoverconfidence problem, reproduced deterministically. This is the test bed for its coast-cap fix.Test plan
pytest scripts/peppar_fix/ tests/).DisciplineScheduler(adaptive coast) forlongTauGnssCouplingvalidation; fat-tail innovation model to recover the 565→74ps gate win.🤖 Generated with Claude Code