Repository navigation
feat(chronos): add device clock models - #307
Conversation
|
Tested All 51 clock/model tests passed. A separate native probe used 24 real The four Chronos PRs passed 450 workspace tests together on dev Test commands and log excerptscargo test --locked -p robonix-chronos-clock -p robonix-chronos -- --nocapture |
|
Thanks! Both #307 and #309 now need a rebase onto the current dev. For #307, dev bumped the workspace to 1.1.0, so after merging, |
Device timestamps need a versioned conversion to reference time. Add a deterministic model estimator with bounded observation windows, drift and uncertainty limits, counter wrap handling, and generation-aware resets. Support step and bounded slew updates and preserve retained model identity when refreshing a later generation after a fault. Validate 32 model tests, including the retained-model regression, and workspace format, clippy, build and tests. Assisted-by: Codex:gpt-6
Reject the floating-point upper boundary before converting fitted rates to signed coefficients. Document and test that a newer reference generation resets Fault while availability recovery preserves it.
The workspace now uses version 1.1.0. Refresh the Chronos lockfile entry so locked builds resolve the rebased workspace without updating it.
a5c042f to
58d187e
Compare
enkerewpo
left a comment
There was a problem hiding this comment.
LGTM, thanks!
Tested locally with this branch merged into current dev (7540fe2):
cargo fmt --all -- --check exit 0
cargo clippy --workspace --tests -- -D warnings exit 0
cargo build --workspace exit 0
cargo test --workspace --all-targets exit 0 (25 suites, 466 passed, 0 failed, 3 ignored)
Chronos crates and Python bindings:
cargo clippy --locked -p robonix-chronos-clock --features python --all-targets -- -D warnings exit 0
cargo test --locked -p robonix-chronos-clock --features python 12 + 6 passed
cargo test -p robonix-chronos 1 + 32 passed
maturin build --release + python -m unittest (test_python.py) Ran 5 tests ... OK
Device timestamps need a conversion to reference time that accounts for clock drift, counter wrap and resets. Add
ChronosCore, a deterministic library that fits affine models from caller-supplied device/reference observation pairs and returns conversions with their model version, generations and uncertainty.The estimator bounds its observation window, rejects outliers, tracks holdover and supports step or bounded slew updates. Outlier limits include elapsed drift allowance so permitted rate changes can update the model. Refreshing a later generation preserves the identity of retained models from an earlier generation. The library runs without a daemon and does not read host clocks.
Fitted coefficients outside the signed range return
Overflow, including a floating-point rate rounded to the exclusive upper boundary, instead of silently saturating during conversion.A strictly newer reference generation clears
FaulttoResetand replaces its reason; retained models becomeUnsyncedwith their old generation identity. Equal-generation updates are idempotent, and reference availability recovery preservesFault. The fault regression covers availability recovery, an equal generation, and a newer generation in that order.Validation
Validated locally on Linux x86_64, based on
devata7ec8606: 33 model tests passed, including the signed upper-bound regression. The format, workspace Clippy and portability checks below passed.cargo fmt --all -- --check cargo clippy --offline --locked --workspace --all-targets -- -D warnings cargo test --offline --locked -p robonix-chronos --all-targets python3 scripts/check_runtime_portability.pyRelated: #298.