Skip to content

Bias as constant offset, random walk and bias instability - #235

Open
patrickmckeen wants to merge 1 commit into
feat/sensor-scale-misalignmentfrom
feat/sensor-bias-instability
Open

patrickmckeen wants to merge 1 commit into
feat/sensor-scale-misalignmentfrom
feat/sensor-bias-instability

Conversation

@patrickmckeen

Copy link
Copy Markdown
Collaborator

What this adds

A sensor's Bias had two things: a starting value and a random-walk rate, and the walk started from the starting value. That conflates two different errors, and it leaves out a third:

  • the constant offset a device is built with (the turn-on bias, which calibration can remove), which should stay put;
  • the random walk (rate random walk in gyro terms), which should start at zero and accumulate;
  • the bias instability, the slow wander that an Allan-variance plot shows as its floor, which is neither constant nor a random walk: it stays within a band but is correlated over a characteristic time.

Bias now keeps the three parts separately, with bias as their sum so everything that reads or writes it keeps working:

  • offset: the bias given at construction, constant.
  • walk: starts at zero, steps with standard deviation std_bias · sqrt(Δt) as before.
  • instability: a first-order Gauss-Markov process with standard deviation instability_std and correlation time instability_time (seconds), the standard stand-in for the flicker floor. It decays towards zero over the correlation time and is topped up each step so its standard deviation stays where configured, exactly for any step length.

A bias built the old way (value and rate only) produces the same sequence as before. On the estimator side, the random-walk rate the filter assumes for a bias state covers the instability with the usual 2·σ²/τ term, so a filter with a random-walk bias model still tracks a bias that wanders. The same applies to actuator biases, since they share the class.

This stacks on #234.

Tests

testing/test_sensors/test_bias_instability.py, 5 tests: the offset stays constant and the walk starts from it; without an instability the sequence equals the old random walk draw for draw; the instability is stationary with the configured standard deviation and lag-one correlation exp(−Δt/τ) over 40 000 steps; the estimator's rate includes the instability term; and the configuration is validated and survives sizing and copies. The full suite passes.

🤖 Generated with Claude Code

Bias keeps three parts and their sum: the constant offset the device was
built with, a random walk of rate std_bias that now starts at zero rather
than at the offset, and a bias instability modelled as a first-order
Gauss-Markov process (instability_std, instability_time), the slow wander
an Allan-variance plot shows as its floor. The estimator's random-walk
rate covers the instability with the usual 2 sigma^2 / tau term. A bias
built the old way produces the same sequence as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Test Results

1 579 tests  +5   1 577 ✅ +5   3m 54s ⏱️ + 1m 28s
    1 suites ±0       2 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit a82a3e9. ± Comparison against base commit b4c6bc2.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant