Repository navigation
Sensor noise that scales with the sample rate (noise density) - #233
Open
patrickmckeen wants to merge 1 commit into
Open
patrickmckeen wants to merge 1 commit into
patrickmckeen wants to merge 1 commit into
Conversation
… sample rate Noise gains an optional density, in reading units per root hertz (the angle random walk of a gyro, the noise density of a magnetometer data sheet). A reading averaged over the sensor's sample_time then has standard deviation sqrt(std_noise^2 + density^2 / sample_time), so the noise no longer silently changes when the simulation step changes. The sensor passes its sample time both when it draws and when the estimator asks for the measurement covariance, so both sides agree; the warm start uses the same standard deviation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
The problem
A sensor's
Noisehas one number,std_noise: the standard deviation of a single reading. That number does not know how often the sensor is read. Real sensor noise is specified as a density, in reading units per root hertz (for a gyro the angle random walk, for a magnetometer the noise density on the data sheet), because the noise on a reading depends on how long it averages: ten readings a second are each noisier than one reading a second, by a factor of about three. With a fixedstd_noise, changing the simulation step silently changes the effective noise level, and a data-sheet number cannot be entered as it is given.The fix
Noisetakes an optionaldensity. A reading averaged over the sensor'ssample_timethen has standard deviationsqrt(std_noise² + density² / sample_time): the density part scales with the rate,std_noisestays the part that does not (quantisation, electronics).Noise.std(sample_time)returns that value, andcov,covarianceandsrcovtake the same argument.Every sensor passes its own
sample_timeboth when it draws a reading and when the estimator asks for the measurement covariance, so what is drawn and what the filter assumes are the same number. The warm start uses it too. A model without a density behaves exactly as before, at every rate. A sensor given a density with a non-positivesample_timefails at construction with the sensor's name, rather than at its first reading.One thing to know: the density is interpreted per
sample_time, which is the sensor's configured rate. If the simulation reads the sensor more often than that (todaysimulate()reads every sensor every step), the readings are correlated in reality but independent here; that is the existing sample-time behaviour, not something this change alters.Actuator noise and the anisotropic star-tracker noise are per reading and do not take a density; they accept and ignore the sample time.
Tests
testing/test_sensors/test_noise_density.py, 6 tests: the formula and its covariance forms; the spread of 4000 drawn gyro readings at two sample rates matchesdensity / sqrt(sample_time); the estimator's measurement covariance, through the satellite's measurement stack, equals the drawn variance; a density without a rate, a negative density and a mismatched shape are refused with clear messages; the density survives sizing to a vector sensor and copies; the warm start's angular sigma uses the scaled value. The full suite passes.🤖 Generated with Claude Code