-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor GaussMarkov sensor noise handling #881
base: develop
Are you sure you want to change the base?
Conversation
34b0b7e
to
a7c5408
Compare
@Natsoulas Looking through the code, it seems |
Thanks @sdunlap-afit for looking over my changes. I'll incorporate that change this afternoon. |
a7c5408
to
fc98f12
Compare
fc98f12
to
e04558d
Compare
@sdunlap-afit I just removed the lines setting A as the identity in Reset(), and edited the comment in the scenario. Let me know if you have any more suggestions. I appreciate your help! |
@Natsoulas On my last pass, I was primarily looking for references to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great progress, some additional feedback to address.
@@ -73,19 +81,19 @@ class ImuSensor: public SysModel { | |||
bool NominalReady; //!< -- Flag indicating that system is in run | |||
Eigen::Matrix3d PMatrixAccel; //!< [-] Cholesky-decomposition or matrix square root of the covariance matrix to apply errors with | |||
Eigen::Matrix3d AMatrixAccel; //!< [-] AMatrix that we use for error propagation | |||
Eigen::Vector3d walkBoundsAccel;//!< [-] "3-sigma" errors to permit for states | |||
Eigen::Vector3d walkBoundsAccel; //!< [-] Total error bounds for accelerometer states. @warning Will be renamed to errorBoundsAccel in December 2025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, this gives the user 1 year to know a change is coming, but not a true depreciation. Can we create the new errorBoundsAccel
variable now as a privat variable, create the suitable setter and getter, document, but leave the public walkBoundsAccel
. To see if the user sets it, could we default it to -1, and if anything else when we set errorBoundsAccel
to this value? This way old code doesn't break, but users have 1 year to upgrade to the new setter and getter?
void setAMatrixGyro(const Eigen::MatrixXd& propMatrix); | ||
Eigen::MatrixXd getAMatrixAccel() const; | ||
Eigen::MatrixXd getAMatrixGyro() const; | ||
void setWalkBoundsAccel(const Eigen::Vector3d& bounds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to the new setter and getter names?
Eigen::Vector3d ImuSensor::getWalkBoundsGyro() const | ||
{ | ||
return this->walkBoundsGyro; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the imuSensor.rst file to discuss how to properly set the noise values. You can note that the use of directly setting walkBoundsAccel
is now deprecated.
@@ -54,6 +54,11 @@ | |||
|
|||
Both IMUs use the same process noise level (P Matrix) to ensure comparable noise magnitudes. | |||
|
|||
Note that any sensors using the ``GaussMarkov`` noise model should be configured with | |||
user-defined configuration parameters such as ``walkBounds`` and ``AMatrix``. Otherwise, | |||
the default values will be used and they may not be appropriate for the sensor the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default we should have have no noise or random walk? Please ensure that signal is not modified unless the users sets these values.
@@ -47,9 +47,12 @@ class StarTracker: public SysModel { | |||
void applySensorErrors(); | |||
void computeTrueOutput(); | |||
void computeQuaternion(double *sigma, STSensorMsgPayload *sensorValue); | |||
|
|||
|
|||
void setAMatrix(const Eigen::MatrixXd& propMatrix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have a getAMatrix()?
public: | ||
|
||
uint64_t sensorTimeTag; //!< [ns] Current time tag for sensor out | ||
ReadFunctor<SCStatesMsgPayload> scStateInMsg; //!< [-] sc input state message | ||
Message<STSensorMsgPayload> sensorOutMsg; //!< [-] sensor output state message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update starTracker.rst as well to discuss how to set the noise values.
nMatrix.setZero(); | ||
nMatrix(0,0) = this->senNoiseStd(0); | ||
nMatrix(1,1) = this->senNoiseStd(1); | ||
nMatrix(2,2) = this->senNoiseStd(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update module RST file on how to set noise values.
@@ -99,6 +99,9 @@ class CoarseSunSensor: public SysModel { | |||
int CSSGroupID=-1; //!< [-] (optional) CSS group id identifier, -1 means it is not set and default is used | |||
BSKLogger bskLogger; //!< -- BSK Logging | |||
|
|||
void setAMatrix(const Eigen::Matrix<double, -1, 1, 0, -1, 1>& propMatrix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the getAMatrix()?
@@ -120,7 +124,7 @@ class CSSConstellation: public SysModel { | |||
void Reset(uint64_t CurrentClock); //!< Method for reseting the module | |||
void UpdateState(uint64_t CurrentSimNanos); //!< @brief [-] Main update method for CSS constellation | |||
void appendCSS(CoarseSunSensor *newSensor); //!< @brief [-] Method for adding sensor to list | |||
|
|||
public: | |||
Message<CSSArraySensorMsgPayload> constellationOutMsg; //!< [-] CSS constellation output message | |||
std::vector<CoarseSunSensor *> sensorList; //!< [-] List of coarse sun sensors in constellation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update module RST file on how to set noise values.
Description
Followed user feedback about inconsistencies in how various sensors handle the GaussMarkov noise model. This PR addresses all the issues pointed out in issue #867 and updates relevant documentation. Necessary private class attributes are made accessible outside of the class via getter and setter methods introduced in this PR. Additionally, I edited sensor modules to initialize the GM noise models in their constructors rather than in their Reset() methods (this was only some sensors).
Verification
Each change/refactor was verified via passing unit tests and running scenarioGaussMarkovRandomWalk.py to ensure the refactor did not change any functionality of the code.
Documentation
Changed imuSensor name for walkBounds to errorBounds, and documented latex doc for the IMU Sensor called imuSensor/_Documentation/BasiliskCorruptions.tex
Future work
See if community desires any additional refactoring or clarification of Gauss Markov sensor noise modeling through additional documentation