Class KnownPositionAndInstantMagnetometerCalibrator

All Implemented Interfaces:
MagnetometerCalibrator, MagnetometerNonLinearCalibrator, UnknownHardIronMagnetometerCalibrator, UnknownHardIronNonLinearMagnetometerCalibrator, UnorderedStandardDeviationBodyMagneticFluxDensityMagnetometerCalibrator

Estimates magnetometer hard-iron biases, cross couplings and scaling factors. This calibrator uses Levenberg-Marquardt to find a minimum least squared error solution.

To use this calibrator at least 10 measurements taken at a single known position and instant must be taken at 10 different unknown orientations when common z-axis is assumed, otherwise at least 13 measurements are required.

Measured magnetic flux density is assumed to follow the model shown below:

     mBmeas = bm + (I + Mm) * mBtrue + w
 
Where: - mBmeas is the measured magnetic flux density. This is a 3x1 vector. - bm is magnetometer hard-iron bias. Ideally, on a perfect magnetometer, this should be a 3x1 zero vector. - I is the 3x3 identity matrix. - Mm is the 3x3 soft-iron matrix containing cross-couplings and scaling factors. Ideally, on a perfect magnetometer, this should be a 3x3 zero matrix. - mBtrue is ground-truth magnetic flux density. This is a 3x1 vector. - w is measurement noise. This is a 3x1 vector. Notice that this calibrator assumes that all measurements are taken in a short span of time, where Earth magnetic field can be assumed to be constant at provided location and instant.
  • Field Details

    • position

      private com.irurueta.navigation.frames.NEDPosition position
      Position where body magnetic flux density measurements have been taken.
    • year

      private Double year
      Timestamp expressed as decimal year, where magnetic flux density measurements have been measured.
    • magneticModel

      private WorldMagneticModel magneticModel
      Contains Earth's magnetic model.
  • Constructor Details

    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator()
      Constructor.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      listener - listener to handle events raised by this calibrator.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements)
      Constructor.
      Parameters:
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(boolean commonAxisUsed)
      Constructor.
      Parameters:
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(WorldMagneticModel magneticModel)
      Constructor.
      Parameters:
      magneticModel - Earth's magnetic model. If null, a default model will be used instead.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(double[] initialHardIron)
      Constructor.
      Parameters:
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      listener - listener to handle events raised by this calibrator.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      listener - listener to handle events raised by this calibrator.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.NEDPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      listener - listener to handle events raised by this calibrator.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      listener - listener to handle events raised by this calibrator.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • KnownPositionAndInstantMagnetometerCalibrator

      public KnownPositionAndInstantMagnetometerCalibrator(com.irurueta.navigation.frames.ECEFPosition position, List<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, KnownPositionAndInstantMagnetometerCalibratorListener listener)
      Constructor.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      measurements - collection of body magnetic flux density measurements with standard deviation of magnetometer measurements taken at the same position with zero velocity and unknown different orientations.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
  • Method Details

    • getNedPosition

      public com.irurueta.navigation.frames.NEDPosition getNedPosition()
      Gets position where body magnetic flux density measurements have been taken.
      Returns:
      position where body magnetic flux density measurements have been taken.
    • setPosition

      public void setPosition(com.irurueta.navigation.frames.NEDPosition position) throws com.irurueta.navigation.LockedException
      Sets position where body magnetic flux density measurements have been taken.
      Parameters:
      position - position where body magnetic flux density measurements have been taken.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getEcefPosition

      public com.irurueta.navigation.frames.ECEFPosition getEcefPosition()
      Gets position where body magnetic flux density measurements have been taken expressed in ECEF coordinates.
      Returns:
      position where body magnetic flux density measurements have been taken or null if not available.
    • getEcefPosition

      public boolean getEcefPosition(com.irurueta.navigation.frames.ECEFPosition result)
      Gets position where body magnetic flux density measurements have been taken expressed in ECEF coordinates.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if ECEF position could be computed, false otherwise.
    • setPosition

      public void setPosition(com.irurueta.navigation.frames.ECEFPosition position) throws com.irurueta.navigation.LockedException
      Sets position where body magnetic flux density measurements have been taken expressed in ECEF coordinates.
      Parameters:
      position - position where body magnetic flux density have been taken.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getYear

      public Double getYear()
      Gets timestamp expressed as decimal year where magnetic flux density measurements have been measured.
      Returns:
      timestamp expressed as decimal year or null if not defined.
    • setYear

      public void setYear(Double year) throws com.irurueta.navigation.LockedException
      Sets timestamp expressed as decimal year where magnetic flux density measurements have been measured.
      Parameters:
      year - timestamp expressed as decimal year.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setTime

      public void setTime(Long timestampMillis) throws com.irurueta.navigation.LockedException
      Sets timestamp when magnetic flux density measurements have been measured.
      Parameters:
      timestampMillis - a timestamp expressed in milliseconds since epoch time (January 1st, 1970 at midnight).
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setTime

      public void setTime(Date date) throws com.irurueta.navigation.LockedException
      Sets timestamp when magnetic flux density measurements have been measured.
      Parameters:
      date - a date instance containing a timestamp.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setTime

      public void setTime(GregorianCalendar calendar) throws com.irurueta.navigation.LockedException
      Sets timestamp when magnetic flux density measurements have been measured.
      Parameters:
      calendar - a calendar instance containing a timestamp.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • isReady

      public boolean isReady()
      Indicates whether calibrator is ready to start.
      Specified by:
      isReady in interface MagnetometerCalibrator
      Overrides:
      isReady in class BaseMagneticFluxDensityNormMagnetometerCalibrator<KnownPositionAndInstantMagnetometerCalibrator,KnownPositionAndInstantMagnetometerCalibratorListener>
      Returns:
      true if calibrator is ready, false otherwise.
    • getMagneticModel

      public WorldMagneticModel getMagneticModel()
      Gets Earth's magnetic model.
      Returns:
      Earth's magnetic model or null if not provided.
    • setMagneticModel

      public void setMagneticModel(WorldMagneticModel magneticModel) throws com.irurueta.navigation.LockedException
      Sets Earth's magnetic model.
      Parameters:
      magneticModel - Earth's magnetic model to be set.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • onBeforeCalibrate

      protected void onBeforeCalibrate() throws CalibrationException
      Called before calibration occurs. This can be overridden by subclasses.
      Overrides:
      onBeforeCalibrate in class BaseMagneticFluxDensityNormMagnetometerCalibrator<KnownPositionAndInstantMagnetometerCalibrator,KnownPositionAndInstantMagnetometerCalibratorListener>
      Throws:
      CalibrationException - if anything fails.
    • computeGroundTruthMagneticFluxDensityNorm

      private void computeGroundTruthMagneticFluxDensityNorm() throws CalibrationException
      Computes expected ground truth magnetic flux density norm based on World Magnetic Model. Notice that actual magnetic field measured by devices might differ from this value, since it might be attenuated or other devices might interfere.
      Throws:
      CalibrationException - if world magnetic model cannot be loaded.
    • convertTime

      private static Double convertTime(Long timestampMillis)
      Converts a time instance expressed in milliseconds since epoch time (January 1st, 1970 at midnight) to a decimal year.
      Parameters:
      timestampMillis - milliseconds value to be converted.
      Returns:
      converted value expressed in decimal years.
    • convertTime

      private static Double convertTime(Date date)
      Converts a time instant contained ina date object to a decimal year.
      Parameters:
      date - a time instance to be converted.
      Returns:
      converted value expressed in decimal years.
    • convertTime

      private static Double convertTime(GregorianCalendar calendar)
      Converts a time instant contained in a gregorian calendar to a decimal year.
      Parameters:
      calendar - calendar containing a specific instant to be converted.
      Returns:
      converted value expressed in decimal years.
    • convertPosition

      private static com.irurueta.navigation.frames.NEDPosition convertPosition(com.irurueta.navigation.frames.ECEFPosition position)
      Converts provided ECEF position to position expressed in NED coordinates.
      Parameters:
      position - ECEF position to be converted.
      Returns:
      converted position expressed in NED coordinates.