AVSLab / basilisk

Astrodynamics simulation framework
https://hanspeterschaub.info/basilisk
ISC License
148 stars 61 forks source link

Magnetometer Sensor Noise Std is scaled by a factor of 1.5 #800

Open AmolikaSoni opened 2 months ago

AmolikaSoni commented 2 months ago

Describe the bug The standard deviation provided as input for magnetometer modelling is scaled by a factor of 1.5

To reproduce Locate line no. 71 in https://github.com/AVSLab/basilisk/blob/develop/src/simulation/sensors/magnetometer/magnetometer.cpp auto nMatrix = (this->senNoiseStd * 1.5).asDiagonal();

Expected behavior Not sure on why 1.5 is being multiplied.

Screenshots Code lines already mentioned above

schaubh commented 2 months ago

Howdy @AmolikaSoni , thanks for the info. I'm not sure either why this 1.5 multiplier was added there in the original code. I'll take a look this weekend and correct or document if needed.

AmolikaSoni commented 1 month ago

Hi @schaubh, any updates on this? I just found the same scaling of 1.5 in the coarse sun sensor modeling as well! https://github.com/AVSLab/basilisk/blob/develop/src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp

schaubh commented 1 month ago

Howdy @AmolikaSoni , I found the same. I searched the BSK code base for the use of .setNoiseMatrix() and found that only the magnetometer and CSS modules use the 1.5 multiplier. At this point I have a task to make a branch to remove the 1.5x term and document this change in the known issues file.

sdunlap-afit commented 1 month ago

Hi @schaubh, While reviewing the following document, I came across multiple references to scaling standard deviations by 1.5 and remembered this thread. Is the document correct, or should I provide the desired standard deviations without scaling? Thank you for your time.

"where senRotNoiseStd and senTransNoiseStd are input by the user as 1.5x the desired standard deviation as scalar floats."

https://github.com/AVSLab/basilisk/blob/develop/src/simulation/sensors/imuSensor/_Documentation/BasiliskCorruptions.pdf

schaubh commented 1 month ago

@sjkcarnahan , you wrote this original documentation. Do you recall why this 1.5x factor was put in there? Some modules used it, most didn't?

schaubh commented 1 month ago

I spoke with the original author and he said this 1.5x factor was added to ensure the noise had the expected standard deviation. We will create a test to validate this. If correct after we test this, I don't think the coder should have to set this 1.5 in the BSK module. I'd like to look at a solution where the user sets the expected noise standard deviation and the gaussMarkow library does the required scaling.

schaubh commented 2 weeks ago

We can verify that the 1.5x factor is required to get the expected noise behavior. We are looking at ideas to avoid having the module need to this easier to setup.

AmolikaSoni commented 2 weeks ago

@schaubh I read the document shared by @sdunlap-afit. If you see the recommendations section, it does mention that "make it so that the given standard deviation does not have to be scaled by 1.5x" (Ref. section 2.2 ->2.2.1->6) https://github.com/AVSLab/basilisk/blob/develop/src/simulation/sensors/imuSensor/_Documentation/BasiliskCorruptions.pdf