Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.orekit.propagation.SpacecraftState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hipparchus.random.RandomDataGenerator;

import msp.simulator.environment.Environment;
import msp.simulator.environment.geomagneticField.EarthMagneticField;
Expand All @@ -36,9 +37,14 @@
* @author Florian CHAUBEYRE <chaubeyre.f@gmail.com>
*/
public class Magnetometer {


/* ******* Public Static Attributes ******* */



/* Random number generator */
private RandomDataGenerator randomDataGenerator = new RandomDataGenerator(1000);

/** This intensity is used to generate a random number to be
* added to each components of the true magnetic field.
* (nanoTesla)
Expand Down Expand Up @@ -85,13 +91,15 @@ public Magnetometer(Environment environment, Assembly assembly) {
*/
public GeoMagneticElements retrieveNoisyField() {
/* Perfect Measure. */


GeoMagneticElements perfectMeasure = this.retrievePerfectField();

/* Normally distributed random noise contribution. */
Vector3D noise = new Vector3D ( new double[] {
2 * (FastMath.random() - 0.5) * this.noiseIntensity,
2 * (FastMath.random() - 0.5) * this.noiseIntensity,
2 * (FastMath.random() - 0.5) * this.noiseIntensity
randomDataGenerator.nextNormal(0, this.noiseIntensity),
randomDataGenerator.nextNormal(0, this.noiseIntensity),
randomDataGenerator.nextNormal(0, this.noiseIntensity)
});

/* Disturbing the perfect measurement. */
Expand Down