Skip to content
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

Feature/issue 800 magnetometer noise #831

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/source/Support/bskKnownIssues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Version |release|
-----------------
- pip-based installation in editable mode using ``pip install -e .`` is not currently supported.
Developers and users alike should continue to use ``python conanfile.py`` installation.

- When using `senNoiseStd()` to set the sensor noise standard deviations
in :ref:`magnetometer` and :ref:`coarsesunsensor`
the value was being multiplied by 1.5 when creating the diagonal noise matrix.
This 1.5x multiplier has now been removed. This is corrected in current release.

Version 2.5.0
-------------
Expand Down
2 changes: 2 additions & 0 deletions docs/source/Support/bskReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Version |release|
- Updated :ref:`scenarioMonteCarloAttRW` to use more pythonic OOP for Monte Carlo data retention
- Updated :ref:`scenarioMonteCarloSpice` to use more pythonic OOP for Monte Carlo data retention
- Removed the now deprecated ``datashader_utilities.py`` in favor of the new bokeh plotting features in ``AnalysisBaseClass.py``
- Removed the false 1.5x multiplier in :ref:`magnetometer` and :ref:`coarsesunsensor`
when setting 'senNoiseStd'


Version 2.5.0 (Sept. 30, 2024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def setupCSS(CSS):
CSS.kellyFactor = kelly
CSS.scaleFactor = scaleFactor
CSS.senBias = bias
CSS.senNoiseStd = noiseStd
CSS.senNoiseStd = noiseStd*1.5 # test value is adjusted after we no longer use 1.5 in the code. No impact on the test validity
CSS.albedoValue = albedoValue
CSS.minOutput = minIn
CSS.maxOutput = maxIn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
@pytest.mark.parametrize(
"cssFault",
[
"CSSFAULT_OFF",
"CSSFAULT_STUCK_CURRENT",
"CSSFAULT_STUCK_MAX",
"CSSFAULT_STUCK_RAND",
"CSSFAULT_RAND",
"CSSFAULT_OFF",
"CSSFAULT_STUCK_CURRENT",
"CSSFAULT_STUCK_MAX",
"CSSFAULT_STUCK_RAND",
"CSSFAULT_RAND",
])
# provide a unique test method name, starting with test_
def test_coarseSunSensor(cssFault):
Expand All @@ -73,7 +73,7 @@ def run(cssFault):
# Create a simulation container
unitTestSim = SimulationBaseClass.SimBaseClass()
# unitTestSim.RNGSeed = 10

# Ensure simulation is empty
testProc = unitTestSim.CreateNewProcess(testProcessName)
testProc.addTask(unitTestSim.CreateNewTask(testTaskName, testTaskRate))
Expand Down Expand Up @@ -120,10 +120,10 @@ def run(cssFault):
truthValue = 2.0
elif cssFault == "CSSFAULT_STUCK_RAND":
cssFaultValue = coarseSunSensor.CSSFAULT_STUCK_RAND
truthValue = 1.7278304838858731
truthValue = 1.7278304838858731/1.5
elif cssFault == "CSSFAULT_RAND":
cssFaultValue = coarseSunSensor.CSSFAULT_RAND
truthValue = 0.7974448327854251
truthValue = 0.7974448327854251/1.5
else:
NotImplementedError("Fault type specified does not exist.")

Expand All @@ -138,15 +138,20 @@ def run(cssFault):
cssOutput = cssRecoder.OutputData[-1]
print(cssOutput)
print(truthValue)

if cssFault == "CSSFAULT_OFF":
if not truthValue == cssOutput:
testFailCount += 1
testMessages.append("css value didn't match")
elif not unitTestSupport.isDoubleEqualRelative(cssOutput, truthValue, 1E-12):
testFailCount += 1
testMessages.append("css value didn't match")

if testFailCount:
print(testFailCount)
print(testMessages)
return [testFailCount, ''.join(testMessages)]


if __name__ == "__main__":
run("CSSFAULT_STUCK_MAX")
run("CSSFAULT_STUCK_RAND")
4 changes: 2 additions & 2 deletions src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void CoarseSunSensor::Reset(uint64_t CurrentSimNanos)

this->noiseModel.setRNGSeed(this->RNGSeed);

nMatrix(0,0) = this->senNoiseStd*1.5;
nMatrix(0,0) = this->senNoiseStd;
this->noiseModel.setNoiseMatrix(nMatrix);

bounds(0,0) = this->walkBounds;
Expand All @@ -155,7 +155,7 @@ void CoarseSunSensor::Reset(uint64_t CurrentSimNanos)

this->faultNoiseModel.setRNGSeed(this->RNGSeed+1);

nMatrixFault(0,0) = this->faultNoiseStd*1.5; // sensor noise standard dev
nMatrixFault(0,0) = this->faultNoiseStd; // sensor noise standard dev
this->faultNoiseModel.setNoiseMatrix(nMatrixFault);

boundsFault(0,0) = 2.0; // walk bounds
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/sensors/magnetometer/magnetometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Magnetometer::Reset(uint64_t CurrentSimNanos)
}

this->noiseModel.setUpperBounds(this->walkBounds);
auto nMatrix = (this->senNoiseStd * 1.5).asDiagonal();
auto nMatrix = this->senNoiseStd.asDiagonal();
this->noiseModel.setNoiseMatrix(nMatrix);
this->noiseModel.setRNGSeed(this->RNGSeed);
Eigen::MatrixXd satBounds;
Expand Down
Loading