Class BaseMagneticFluxDensityNormMagnetometerCalibrator<C extends BaseMagneticFluxDensityNormMagnetometerCalibrator<?,?>,L extends BaseMagneticFluxDensityNormMagnetometerCalibratorListener<C>>

java.lang.Object
com.irurueta.navigation.inertial.calibration.magnetometer.BaseMagneticFluxDensityNormMagnetometerCalibrator<C,L>
Type Parameters:
C - Calibrator type.
L - Listener type.
All Implemented Interfaces:
MagnetometerCalibrator, MagnetometerNonLinearCalibrator, UnknownHardIronMagnetometerCalibrator, UnknownHardIronNonLinearMagnetometerCalibrator, UnorderedStandardDeviationBodyMagneticFluxDensityMagnetometerCalibrator
Direct Known Subclasses:
KnownMagneticFluxDensityNormMagnetometerCalibrator, KnownPositionAndInstantMagnetometerCalibrator

public abstract class BaseMagneticFluxDensityNormMagnetometerCalibrator<C extends BaseMagneticFluxDensityNormMagnetometerCalibrator<?,?>,L extends BaseMagneticFluxDensityNormMagnetometerCalibratorListener<C>> extends Object implements MagnetometerNonLinearCalibrator, UnknownHardIronNonLinearMagnetometerCalibrator, UnorderedStandardDeviationBodyMagneticFluxDensityMagnetometerCalibrator
Abstract class to estimate 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 unknown position and 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.
  • Field Details

    • DEFAULT_USE_COMMON_Z_AXIS

      public static final boolean DEFAULT_USE_COMMON_Z_AXIS
      Indicates whether by default a common z-axis is assumed for the accelerometer, gyroscope and magnetometer.
      See Also:
    • COMMON_Z_AXIS_UNKNOWNS

      private static final int COMMON_Z_AXIS_UNKNOWNS
      Number of unknowns when common z-axis is assumed for the accelerometer, gyroscope and magnetometer.
      See Also:
    • GENERAL_UNKNOWNS

      private static final int GENERAL_UNKNOWNS
      Number of unknowns for the general case.
      See Also:
    • MINIMUM_MEASUREMENTS_COMMON_Z_AXIS

      public static final int MINIMUM_MEASUREMENTS_COMMON_Z_AXIS
      Required minimum number of measurements when common z-axis is assumed.
      See Also:
    • MINIMUM_MEASUREMENTS_GENERAL

      public static final int MINIMUM_MEASUREMENTS_GENERAL
      Required minimum number of measurements for the general case.
      See Also:
    • groundTruthMagneticFluxDensityNorm

      protected Double groundTruthMagneticFluxDensityNorm
      Ground truth magnetic flux density norm to be expected at location where measurements have been made, expressed in Teslas (T).
    • fitter

      private final com.irurueta.numerical.fitting.LevenbergMarquardtMultiDimensionFitter fitter
      Levenberg-Marquardt fitter to find a non-linear solution.
    • initialHardIronX

      private double initialHardIronX
      Initial x-coordinate of hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
    • initialHardIronY

      private double initialHardIronY
      Initial y-coordinate of hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
    • initialHardIronZ

      private double initialHardIronZ
      Initial z-coordinate of hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
    • initialSx

      private double initialSx
      Initial x scaling factor.
    • initialSy

      private double initialSy
      Initial y scaling factor.
    • initialSz

      private double initialSz
      Initial z scaling factor.
    • initialMxy

      private double initialMxy
      Initial x-y cross coupling error.
    • initialMxz

      private double initialMxz
      Initial x-z cross coupling error.
    • initialMyx

      private double initialMyx
      Initial y-x cross coupling error.
    • initialMyz

      private double initialMyz
      Initial y-z cross coupling error.
    • initialMzx

      private double initialMzx
      Initial z-x cross coupling error.
    • initialMzy

      private double initialMzy
      Initial z-y cross coupling error.
    • measurements

      Contains a collection of body magnetic flux density measurements taken at a given position with different unknown orientations and containing the standard deviation of magnetometer measurements.
    • commonAxisUsed

      private boolean commonAxisUsed
      This flag indicates whether z-axis is assumed to be common for accelerometer, gyroscope and magnetometer. When enabled, this eliminates 3 variables from Mm matrix.
    • listener

      Listener to handle events raised by this calibrator.
    • estimatedHardIron

      private double[] estimatedHardIron
      Estimated magnetometer hard-iron biases for each magnetometer axis expressed in Teslas (T).
    • estimatedMm

      private com.irurueta.algebra.Matrix estimatedMm
      Estimated magnetometer soft-iron matrix containing scale factors and cross coupling errors. This is the product of matrix Tm containing cross coupling errors and Km containing scaling factors. So tat:
           Mm = [sx    mxy  mxz] = Tm*Km
                [myx   sy   myz]
                [mzx   mzy  sz ]
       
      Where:
           Km = [sx 0   0 ]
                [0  sy  0 ]
                [0  0   sz]
       
      and
           Tm = [1          -alphaXy    alphaXz ]
                [alphaYx    1           -alphaYz]
                [-alphaZx   alphaZy     1       ]
       
      Hence:
           Mm = [sx    mxy  mxz] = Tm*Km =  [sx             -sy * alphaXy   sz * alphaXz ]
                [myx   sy   myz]            [sx * alphaYx   sy              -sz * alphaYz]
                [mzx   mzy  sz ]            [-sx * alphaZx  sy * alphaZy    sz           ]
       
      This instance allows any 3x3 matrix however, typically alphaYx, alphaZx and alphaZy are considered to be zero if the accelerometer z-axis is assumed to be the same as the body z-axis. When this is assumed, myx = mzx = mzy = 0 and the Mm matrix becomes upper diagonal:
           Mm = [sx    mxy  mxz]
                [0     sy   myz]
                [0     0    sz ]
       
      Values of this matrix are unit-less.
    • estimatedCovariance

      private com.irurueta.algebra.Matrix estimatedCovariance
      Estimated covariance matrix for estimated parameters.
    • estimatedChiSq

      private double estimatedChiSq
      Estimated chi square value.
    • estimatedMse

      private double estimatedMse
      Estimated mean square error respect to provided measurements.
    • running

      private boolean running
      Indicates whether calibrator is running.
    • bmeasX

      private double bmeasX
      Internally holds x-coordinate of measured magnetic flux density during calibration.
    • bmeasY

      private double bmeasY
      Internally holds y-coordinate of measured magnetic flux density during calibration.
    • bmeasZ

      private double bmeasZ
      Internally holds z-coordinate of measured magnetic flux density during calibration.
    • bmeas

      private com.irurueta.algebra.Matrix bmeas
      Internally holds measured magnetic flux density during calibration expressed as a column matrix.
    • m

      private com.irurueta.algebra.Matrix m
      Internally holds cross-coupling errors during calibration.
    • invM

      private com.irurueta.algebra.Matrix invM
      Internally holds inverse of cross-coupling errors during calibration.
    • b

      private com.irurueta.algebra.Matrix b
      Internally holds biases during calibration.
    • btrue

      private com.irurueta.algebra.Matrix btrue
      Internally holds computed true magnetic flux density during calibration.
  • Constructor Details

    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator()
      Constructor.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(L listener)
      Constructor.
      Parameters:
      listener - listener to handle events raised by this calibrator.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

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

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

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, L listener)
      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.
      listener - listener to handle events raised by this calibrator.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed)
      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.
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron)
      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.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron)
      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.
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, L listener)
      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.
      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.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      listener - listener to handle events raised by this calibrator.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, boolean commonAxisUsed)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      commonAxisUsed - indicates whether z-axis is assumed to be common for the accelerometer, gyroscope and magnetometer.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, double[] initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative, or if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      initialHardIron - initial hard-iron to find a solution.
      initialMm - initial soft-iron matrix containing scale factors and cross coupling errors.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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.
      Throws:
      IllegalArgumentException - if provided magnetic flux norm value is negative.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, double[] initialHardIron, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, double[] initialHardIron, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron array does not have length 3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
    • BaseMagneticFluxDensityNormMagnetometerCalibrator

      protected BaseMagneticFluxDensityNormMagnetometerCalibrator(Double groundTruthMagneticFluxDensityNorm, Collection<StandardDeviationBodyMagneticFluxDensity> measurements, boolean commonAxisUsed, com.irurueta.algebra.Matrix initialHardIron, com.irurueta.algebra.Matrix initialMm, L listener)
      Constructor.
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm expressed in Teslas (T).
      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 magnetic flux norm value is negative, or if provided hard-iron matrix is not 3x1 or if soft-iron matrix is not 3x3.
  • Method Details

    • getGroundTruthMagneticFluxDensityNorm

      public Double getGroundTruthMagneticFluxDensityNorm()
      Gets ground truth magnetic flux density norm to be expected at location where measurements have been made, expressed in Teslas (T).
      Returns:
      ground truth magnetic flux density or null.
    • getGroundTruthMagneticFluxDensityNormAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getGroundTruthMagneticFluxDensityNormAsMagneticFluxDensity()
      Gets ground truth magnetic flux density norm to be expected at location where measurements have been made.
      Returns:
      ground truth magnetic flux density or null.
    • getGroundTruthMagneticFluxDensityNormAsMagneticFluxDensity

      public boolean getGroundTruthMagneticFluxDensityNormAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets ground truth magnetic flux density norm to be expected at location where measurements have been made.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if ground truth magnetic flux density norm has been defined, false if it is not available yet.
    • getInitialHardIronX

      public double getInitialHardIronX()
      Gets initial x-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
      Specified by:
      getInitialHardIronX in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial x-coordinate of magnetometer hard-iron bias.
    • setInitialHardIronX

      public void setInitialHardIronX(double initialHardIronX) throws com.irurueta.navigation.LockedException
      Sets initial x-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
      Specified by:
      setInitialHardIronX in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronX - initial x-coordinate of magnetometer hard-iron bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronY

      public double getInitialHardIronY()
      Gets initial y-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
      Specified by:
      getInitialHardIronY in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial y-coordinate of magnetometer hard-iron bias.
    • setInitialHardIronY

      public void setInitialHardIronY(double initialHardIronY) throws com.irurueta.navigation.LockedException
      Sets initial y-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
      Specified by:
      setInitialHardIronY in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronY - initial y-coordinate of magnetometer hard-iron bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronZ

      public double getInitialHardIronZ()
      Gets initial z-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in Teslas (T).
      Specified by:
      getInitialHardIronZ in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial z-coordinate of magnetometer hard-iron bias.
    • setInitialHardIronZ

      public void setInitialHardIronZ(double initialHardIronZ) throws com.irurueta.navigation.LockedException
      Sets initial z-coordinate of magnetometer hard-iron bias to be used to find a solution. This is expressed in meters Teslas (T).
      Specified by:
      setInitialHardIronZ in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronZ - initial z-coordinate of magnetometer hard-iron bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronXAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getInitialHardIronXAsMagneticFluxDensity()
      Gets initial x-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronXAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial x-coordinate of magnetometer hard-iron bias.
    • getInitialHardIronXAsMagneticFluxDensity

      public void getInitialHardIronXAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets initial x-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronXAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
    • setInitialHardIronX

      public void setInitialHardIronX(com.irurueta.units.MagneticFluxDensity initialHardIronX) throws com.irurueta.navigation.LockedException
      Sets initial x-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      setInitialHardIronX in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronX - initial x-coordinate of magnetometer bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronYAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getInitialHardIronYAsMagneticFluxDensity()
      Gets initial y-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronYAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial y-coordinate of magnetometer hard-iron bias.
    • getInitialHardIronYAsMagneticFluxDensity

      public void getInitialHardIronYAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets initial y-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronYAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
    • setInitialHardIronY

      public void setInitialHardIronY(com.irurueta.units.MagneticFluxDensity initialHardIronY) throws com.irurueta.navigation.LockedException
      Sets initial y-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      setInitialHardIronY in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronY - initial y-coordinate of magnetometer bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronZAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getInitialHardIronZAsMagneticFluxDensity()
      Gets initial z-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronZAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial z-coordinate of magnetometer hard-iron bias.
    • getInitialHardIronZAsMagneticFluxDensity

      public void getInitialHardIronZAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets initial z-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      getInitialHardIronZAsMagneticFluxDensity in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
    • setInitialHardIronZ

      public void setInitialHardIronZ(com.irurueta.units.MagneticFluxDensity initialHardIronZ) throws com.irurueta.navigation.LockedException
      Sets initial z-coordinate of magnetometer hard iron bias to be used to find a solution.
      Specified by:
      setInitialHardIronZ in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronZ - initial z-coordinate of magnetometer bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setInitialHardIron

      public void setInitialHardIron(double initialHardIronX, double initialHardIronY, double initialHardIronZ) throws com.irurueta.navigation.LockedException
      Sets initial hard-iron bias coordinates of magnetometer used to find a solution expressed in Teslas (T).
      Specified by:
      setInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronX - initial x-coordinate of magnetometer hard-iron bias.
      initialHardIronY - initial y-coordinate of magnetometer hard-iron bias.
      initialHardIronZ - initial z-coordinate of magnetometer hard-iron bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setInitialHardIron

      public void setInitialHardIron(com.irurueta.units.MagneticFluxDensity initialHardIronX, com.irurueta.units.MagneticFluxDensity initialHardIronY, com.irurueta.units.MagneticFluxDensity initialHardIronZ) throws com.irurueta.navigation.LockedException
      Sets initial hard iron coordinates of magnetometer used to find a solution.
      Specified by:
      setInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIronX - initial x-coordinate of magnetometer bias.
      initialHardIronY - initial y-coordinate of magnetometer bias.
      initialHardIronZ - initial z-coordinate of magnetometer bias.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIronAsTriad

      public MagneticFluxDensityTriad getInitialHardIronAsTriad()
      Gets initial hard-iron used to find a solution.
      Specified by:
      getInitialHardIronAsTriad in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial hard-iron.
    • getInitialHardIronAsTriad

      public void getInitialHardIronAsTriad(MagneticFluxDensityTriad result)
      Gets initial hard-iron used to find a solution.
      Specified by:
      getInitialHardIronAsTriad in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
    • setInitialHardIron

      public void setInitialHardIron(MagneticFluxDensityTriad initialHardIron) throws com.irurueta.navigation.LockedException
      Sets initial hard-iron used to find a solution.
      Specified by:
      setInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIron - initial hard-iron to be set.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialSx

      public double getInitialSx()
      Gets initial x scaling factor.
      Specified by:
      getInitialSx in interface MagnetometerNonLinearCalibrator
      Returns:
      initial x scaling factor.
    • setInitialSx

      public void setInitialSx(double initialSx) throws com.irurueta.navigation.LockedException
      Sets initial x scaling factor.
      Specified by:
      setInitialSx in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialSx - initial x scaling factor.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialSy

      public double getInitialSy()
      Gets initial y scaling factor.
      Specified by:
      getInitialSy in interface MagnetometerNonLinearCalibrator
      Returns:
      initial y scaling factor.
    • setInitialSy

      public void setInitialSy(double initialSy) throws com.irurueta.navigation.LockedException
      Sets initial y scaling factor.
      Specified by:
      setInitialSy in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialSy - initial y scaling factor.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialSz

      public double getInitialSz()
      Gets initial z scaling factor.
      Specified by:
      getInitialSz in interface MagnetometerNonLinearCalibrator
      Returns:
      initial z scaling factor.
    • setInitialSz

      public void setInitialSz(double initialSz) throws com.irurueta.navigation.LockedException
      Sets initial z scaling factor.
      Specified by:
      setInitialSz in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialSz - initial z scaling factor.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMxy

      public double getInitialMxy()
      Gets initial x-y cross coupling error.
      Specified by:
      getInitialMxy in interface MagnetometerNonLinearCalibrator
      Returns:
      initial x-y cross coupling error.
    • setInitialMxy

      public void setInitialMxy(double initialMxy) throws com.irurueta.navigation.LockedException
      Sets initial x-y cross coupling error.
      Specified by:
      setInitialMxy in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMxy - initial x-y cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMxz

      public double getInitialMxz()
      Gets initial x-z cross coupling error.
      Specified by:
      getInitialMxz in interface MagnetometerNonLinearCalibrator
      Returns:
      initial x-z cross coupling error.
    • setInitialMxz

      public void setInitialMxz(double initialMxz) throws com.irurueta.navigation.LockedException
      Sets initial x-z cross coupling error.
      Specified by:
      setInitialMxz in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMxz - initial x-z cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMyx

      public double getInitialMyx()
      Gets initial y-x cross coupling error.
      Specified by:
      getInitialMyx in interface MagnetometerNonLinearCalibrator
      Returns:
      initial y-x cross coupling error.
    • setInitialMyx

      public void setInitialMyx(double initialMyx) throws com.irurueta.navigation.LockedException
      Sets initial y-x cross coupling error.
      Specified by:
      setInitialMyx in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMyx - initial y-x cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMyz

      public double getInitialMyz()
      Gets initial y-z cross coupling error.
      Specified by:
      getInitialMyz in interface MagnetometerNonLinearCalibrator
      Returns:
      initial y-z cross coupling error.
    • setInitialMyz

      public void setInitialMyz(double initialMyz) throws com.irurueta.navigation.LockedException
      Sets initial y-z cross coupling error.
      Specified by:
      setInitialMyz in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMyz - initial y-z cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMzx

      public double getInitialMzx()
      Gets initial z-x cross coupling error.
      Specified by:
      getInitialMzx in interface MagnetometerNonLinearCalibrator
      Returns:
      initial z-x cross coupling error.
    • setInitialMzx

      public void setInitialMzx(double initialMzx) throws com.irurueta.navigation.LockedException
      Sets initial z-x cross coupling error.
      Specified by:
      setInitialMzx in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMzx - initial z-x cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialMzy

      public double getInitialMzy()
      Gets initial z-y cross coupling error.
      Specified by:
      getInitialMzy in interface MagnetometerNonLinearCalibrator
      Returns:
      initial z-y cross coupling error.
    • setInitialMzy

      public void setInitialMzy(double initialMzy) throws com.irurueta.navigation.LockedException
      Sets initial z-y cross coupling error.
      Specified by:
      setInitialMzy in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMzy - initial z-y cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setInitialScalingFactors

      public void setInitialScalingFactors(double initialSx, double initialSy, double initialSz) throws com.irurueta.navigation.LockedException
      Sets initial scaling factors.
      Specified by:
      setInitialScalingFactors in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialSx - initial x scaling factor.
      initialSy - initial y scaling factor.
      initialSz - initial z scaling factor.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setInitialCrossCouplingErrors

      public void setInitialCrossCouplingErrors(double initialMxy, double initialMxz, double initialMyx, double initialMyz, double initialMzx, double initialMzy) throws com.irurueta.navigation.LockedException
      Sets initial cross coupling errors.
      Specified by:
      setInitialCrossCouplingErrors in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMxy - initial x-y cross coupling error.
      initialMxz - initial x-z cross coupling error.
      initialMyx - initial y-x cross coupling error.
      initialMyz - initial y-z cross coupling error.
      initialMzx - initial z-x cross coupling error.
      initialMzy - initial z-y cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • setInitialScalingFactorsAndCrossCouplingErrors

      public void setInitialScalingFactorsAndCrossCouplingErrors(double initialSx, double initialSy, double initialSz, double initialMxy, double initialMxz, double initialMyx, double initialMyz, double initialMzx, double initialMzy) throws com.irurueta.navigation.LockedException
      Sets initial scaling factors and cross coupling errors.
      Specified by:
      setInitialScalingFactorsAndCrossCouplingErrors in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialSx - initial x scaling factor.
      initialSy - initial y scaling factor.
      initialSz - initial z scaling factor.
      initialMxy - initial x-y cross coupling error.
      initialMxz - initial x-z cross coupling error.
      initialMyx - initial y-x cross coupling error.
      initialMyz - initial y-z cross coupling error.
      initialMzx - initial z-x cross coupling error.
      initialMzy - initial z-y cross coupling error.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getInitialHardIron

      public double[] getInitialHardIron()
      Gets initial hard-iron bias to be used to find a solution as an array. Array values are expressed in Teslas (T).
      Specified by:
      getInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      array containing coordinates of initial bias.
    • getInitialHardIron

      public void getInitialHardIron(double[] result)
      Gets initial hard-iron bias to be used to find a solution as an array. Array values are expressed in Teslas (T).
      Specified by:
      getInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result data will be copied to.
      Throws:
      IllegalArgumentException - if provided array does not have length 3.
    • setInitialHardIron

      public void setInitialHardIron(double[] initialHardIron) throws com.irurueta.navigation.LockedException
      Sets initial hard-iron bias to be used to find a solution as an array. Array values are expressed in Teslas (T).
      Specified by:
      setInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIron - initial hard-iron to find a solution.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
      IllegalArgumentException - if provided array does not have length 3.
    • getInitialHardIronAsMatrix

      public com.irurueta.algebra.Matrix getInitialHardIronAsMatrix()
      Gets initial hard-iron bias to be used to find a solution as a column matrix. Values are expressed in Teslas (T).
      Specified by:
      getInitialHardIronAsMatrix in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Returns:
      initial hard-iron bias to be used to find a solution as a column matrix.
    • getInitialHardIronAsMatrix

      public void getInitialHardIronAsMatrix(com.irurueta.algebra.Matrix result)
      Gets initial hard-iron bias to be used to find a solution as a column matrix. Values are expressed in Teslas (T).
      Specified by:
      getInitialHardIronAsMatrix in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      result - instance where result data will be copied to.
      Throws:
      IllegalArgumentException - if provided matrix is not 3x1.
    • setInitialHardIron

      public void setInitialHardIron(com.irurueta.algebra.Matrix initialHardIron) throws com.irurueta.navigation.LockedException
      Sets initial hard-iron bias to be used to find a solution as a column matrix with values expressed in Teslas (T).
      Specified by:
      setInitialHardIron in interface UnknownHardIronNonLinearMagnetometerCalibrator
      Parameters:
      initialHardIron - initial hard-iron bias to find a solution.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
      IllegalArgumentException - if provided matrix is not 3x1.
    • getInitialMm

      public com.irurueta.algebra.Matrix getInitialMm()
      Gets initial scale factors and cross coupling errors matrix.
      Specified by:
      getInitialMm in interface MagnetometerNonLinearCalibrator
      Returns:
      initial scale factors and cross coupling errors matrix.
    • getInitialMm

      public void getInitialMm(com.irurueta.algebra.Matrix result)
      Gets initial scale factors and cross coupling errors matrix.
      Specified by:
      getInitialMm in interface MagnetometerNonLinearCalibrator
      Parameters:
      result - instance where data will be stored.
      Throws:
      IllegalArgumentException - if provided matrix is not 3x3.
    • setInitialMm

      public void setInitialMm(com.irurueta.algebra.Matrix initialMm) throws com.irurueta.navigation.LockedException
      Sets initial scale factors and cross coupling errors matrix.
      Specified by:
      setInitialMm in interface MagnetometerNonLinearCalibrator
      Parameters:
      initialMm - initial scale factors and cross coupling errors matrix.
      Throws:
      IllegalArgumentException - if provided matrix is not 3x3.
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getMeasurements

      Gets collection of body magnetic flux density measurements taken at a given position with different unknown orientations and containing the standard deviation of magnetometer measurements.
      Specified by:
      getMeasurements in interface UnorderedStandardDeviationBodyMagneticFluxDensityMagnetometerCalibrator
      Returns:
      collection of body magnetic flux density measurements at a known position and timestamp with unknown orientations.
    • setMeasurements

      public void setMeasurements(Collection<StandardDeviationBodyMagneticFluxDensity> measurements) throws com.irurueta.navigation.LockedException
      Sets collection of body magnetic flux density measurements taken at a given position with different unknown orientations and containing the standard deviation of magnetometer measurements.
      Specified by:
      setMeasurements in interface UnorderedStandardDeviationBodyMagneticFluxDensityMagnetometerCalibrator
      Parameters:
      measurements - collection of body magnetic flux density measurements at a known position and timestamp with unknown orientations.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getMeasurementType

      public MagnetometerCalibratorMeasurementType getMeasurementType()
      Indicates the type of measurement used by this calibrator.
      Specified by:
      getMeasurementType in interface MagnetometerCalibrator
      Returns:
      type of measurement used by this calibrator.
    • isOrderedMeasurementsRequired

      public boolean isOrderedMeasurementsRequired()
      Indicates whether this calibrator requires ordered measurements in a list or not.
      Specified by:
      isOrderedMeasurementsRequired in interface MagnetometerCalibrator
      Returns:
      true if measurements must be ordered, false otherwise.
    • isQualityScoresRequired

      public boolean isQualityScoresRequired()
      Indicates whether this calibrator requires quality scores for each measurement or not.
      Specified by:
      isQualityScoresRequired in interface MagnetometerCalibrator
      Returns:
      true if quality scores are required, false otherwise.
    • isCommonAxisUsed

      public boolean isCommonAxisUsed()
      Indicates whether z-axis is assumed to be common for accelerometer, gyroscope and magnetometer. When enabled, this eliminates 3 variables from Mm (soft-iron) matrix.
      Specified by:
      isCommonAxisUsed in interface MagnetometerCalibrator
      Returns:
      true if z-axis is assumed to be common for accelerometer, gyroscope and magnetometer, false otherwise.
    • setCommonAxisUsed

      public void setCommonAxisUsed(boolean commonAxisUsed) throws com.irurueta.navigation.LockedException
      Specifies whether z-axis is assumed to be common for accelerometer and gyroscope. When enabled, this eliminates 3 variables from Mm matrix.
      Specified by:
      setCommonAxisUsed in interface MagnetometerCalibrator
      Parameters:
      commonAxisUsed - true if z-axis is assumed to be common for accelerometer, gyroscope and magnetometer, false otherwise.
      Throws:
      com.irurueta.navigation.LockedException - if estimator is currently running.
    • getListener

      public L getListener()
      Gets listener to handle events raised by this calibrator.
      Returns:
      listener to handle events raised by this calibrator.
    • setListener

      public void setListener(L listener) throws com.irurueta.navigation.LockedException
      Sets listener to handle events raised by this calibrator.
      Parameters:
      listener - listener to handle events raised by this calibrator.
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
    • getMinimumRequiredMeasurements

      public int getMinimumRequiredMeasurements()
      Gets minimum number of required measurements.
      Specified by:
      getMinimumRequiredMeasurements in interface MagnetometerCalibrator
      Returns:
      minimum number of required measurements.
    • isReady

      public boolean isReady()
      Indicates whether calibrator is ready to start.
      Specified by:
      isReady in interface MagnetometerCalibrator
      Returns:
      true if calibrator is ready, false otherwise.
    • isRunning

      public boolean isRunning()
      Indicates whether calibrator is currently running or not.
      Specified by:
      isRunning in interface MagnetometerCalibrator
      Returns:
      true if calibrator is running, false otherwise.
    • calibrate

      public void calibrate() throws com.irurueta.navigation.LockedException, com.irurueta.navigation.NotReadyException, CalibrationException
      Estimates magnetometer calibration parameters containing scale factors and cross-coupling errors.
      Specified by:
      calibrate in interface MagnetometerCalibrator
      Throws:
      com.irurueta.navigation.LockedException - if calibrator is currently running.
      com.irurueta.navigation.NotReadyException - if calibrator is not ready.
      CalibrationException - if calibration fails for numerical reasons.
    • getEstimatedHardIron

      public double[] getEstimatedHardIron()
      Gets array containing x,y,z components of estimated magnetometer hard-iron biases expressed in Teslas (T).
      Specified by:
      getEstimatedHardIron in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      array containing x,y,z components of estimated magnetometer hard-iron biases.
    • getEstimatedHardIron

      public boolean getEstimatedHardIron(double[] result)
      Gets array containing x,y,z components of estimated magnetometer hard-iron biases expressed in Teslas (T).
      Specified by:
      getEstimatedHardIron in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where estimated magnetometer biases will be stored.
      Returns:
      true if result instance was updated, false otherwise (when estimation is not yet available).
    • getEstimatedHardIronAsMatrix

      public com.irurueta.algebra.Matrix getEstimatedHardIronAsMatrix()
      Gets column matrix containing x,y,z components of estimated magnetometer hard-iron biases expressed in Teslas (T).
      Specified by:
      getEstimatedHardIronAsMatrix in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      column matrix containing x,y,z components of estimated magnetometer hard-iron biases.
    • getEstimatedHardIronAsMatrix

      public boolean getEstimatedHardIronAsMatrix(com.irurueta.algebra.Matrix result) throws com.irurueta.algebra.WrongSizeException
      Gets column matrix containing x,y,z components of estimated magnetometer hard-iron biases expressed in Teslas (T).
      Specified by:
      getEstimatedHardIronAsMatrix in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where result data will be stored.
      Returns:
      true if result was updated, false otherwise.
      Throws:
      com.irurueta.algebra.WrongSizeException - if provided result instance has invalid size.
    • getEstimatedHardIronX

      public Double getEstimatedHardIronX()
      Gets x coordinate of estimated magnetometer bias expressed in Teslas (T).
      Specified by:
      getEstimatedHardIronX in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      x coordinate of estimated magnetometer bias or null if not available.
    • getEstimatedHardIronY

      public Double getEstimatedHardIronY()
      Gets y coordinate of estimated magnetometer bias expressed in Teslas (T).
      Specified by:
      getEstimatedHardIronY in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      y coordinate of estimated magnetometer bias or null if not available.
    • getEstimatedHardIronZ

      public Double getEstimatedHardIronZ()
      Gets z coordinate of estimated magnetometer bias expressed in Teslas (T).
      Specified by:
      getEstimatedHardIronZ in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      z coordinate of estimated magnetometer bias or null if not available.
    • getEstimatedHardIronXAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronXAsMagneticFluxDensity()
      Gets x coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronXAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      x coordinate of estimated magnetometer bias.
    • getEstimatedHardIronXAsMagneticFluxDensity

      public boolean getEstimatedHardIronXAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets x coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronXAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if estimated magnetometer bias is available, false otherwise.
    • getEstimatedHardIronYAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronYAsMagneticFluxDensity()
      Gets y coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronYAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      y coordinate of estimated magnetometer bias.
    • getEstimatedHardIronYAsMagneticFluxDensity

      public boolean getEstimatedHardIronYAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets y coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronYAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if estimated magnetometer bias is available, false otherwise.
    • getEstimatedHardIronZAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronZAsMagneticFluxDensity()
      Gets z coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronZAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      z coordinate of estimated magnetometer bias.
    • getEstimatedHardIronZAsMagneticFluxDensity

      public boolean getEstimatedHardIronZAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets z coordinate of estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronZAsMagneticFluxDensity in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if estimated magnetometer bias is available, false otherwise.
    • getEstimatedHardIronAsTriad

      public MagneticFluxDensityTriad getEstimatedHardIronAsTriad()
      Gets estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronAsTriad in interface UnknownHardIronMagnetometerCalibrator
      Returns:
      estimated magnetometer bias or null if not available.
    • getEstimatedHardIronAsTriad

      public boolean getEstimatedHardIronAsTriad(MagneticFluxDensityTriad result)
      Gets estimated magnetometer bias.
      Specified by:
      getEstimatedHardIronAsTriad in interface UnknownHardIronMagnetometerCalibrator
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if estimated magnetometer bias is available and result was modified, false otherwise.
    • getEstimatedMm

      public com.irurueta.algebra.Matrix getEstimatedMm()
      Gets estimated magnetometer soft-iron matrix containing scale factors and cross coupling errors. This is the product of matrix Tm containing cross coupling errors and Km containing scaling factors. So tat:
           Mm = [sx    mxy  mxz] = Tm*Km
                [myx   sy   myz]
                [mzx   mzy  sz ]
       
      Where:
           Km = [sx 0   0 ]
                [0  sy  0 ]
                [0  0   sz]
       
      and
           Tm = [1          -alphaXy    alphaXz ]
                [alphaYx    1           -alphaYz]
                [-alphaZx   alphaZy     1       ]
       
      Hence:
           Mm = [sx    mxy  mxz] = Tm*Km =  [sx             -sy * alphaXy   sz * alphaXz ]
                [myx   sy   myz]            [sx * alphaYx   sy              -sz * alphaYz]
                [mzx   mzy  sz ]            [-sx * alphaZx  sy * alphaZy    sz           ]
       
      This instance allows any 3x3 matrix however, typically alphaYx, alphaZx and alphaZy are considered to be zero if the accelerometer z-axis is assumed to be the same as the body z-axis. When this is assumed, myx = mzx = mzy = 0 and the Mm matrix becomes upper diagonal:
           Mm = [sx    mxy  mxz]
                [0     sy   myz]
                [0     0    sz ]
       
      Values of this matrix are unit-less.
      Specified by:
      getEstimatedMm in interface MagnetometerCalibrator
      Returns:
      estimated magnetometer soft-iron scale factors and cross coupling errors, or null if not available.
    • getEstimatedSx

      public Double getEstimatedSx()
      Gets estimated x-axis scale factor.
      Specified by:
      getEstimatedSx in interface MagnetometerCalibrator
      Returns:
      estimated x-axis scale factor or null if not available.
    • getEstimatedSy

      public Double getEstimatedSy()
      Gets estimated y-axis scale factor.
      Specified by:
      getEstimatedSy in interface MagnetometerCalibrator
      Returns:
      estimated y-axis scale factor or null if not available.
    • getEstimatedSz

      public Double getEstimatedSz()
      Gets estimated z-axis scale factor.
      Specified by:
      getEstimatedSz in interface MagnetometerCalibrator
      Returns:
      estimated z-axis scale factor or null if not available.
    • getEstimatedMxy

      public Double getEstimatedMxy()
      Gets estimated x-y cross-coupling error.
      Specified by:
      getEstimatedMxy in interface MagnetometerCalibrator
      Returns:
      estimated x-y cross-coupling error or null if not available.
    • getEstimatedMxz

      public Double getEstimatedMxz()
      Gets estimated x-z cross-coupling error.
      Specified by:
      getEstimatedMxz in interface MagnetometerCalibrator
      Returns:
      estimated x-z cross-coupling error or null if not available.
    • getEstimatedMyx

      public Double getEstimatedMyx()
      Gets estimated y-x cross-coupling error.
      Specified by:
      getEstimatedMyx in interface MagnetometerCalibrator
      Returns:
      estimated y-x cross-coupling error or null if not available.
    • getEstimatedMyz

      public Double getEstimatedMyz()
      Gets estimated y-z cross-coupling error.
      Specified by:
      getEstimatedMyz in interface MagnetometerCalibrator
      Returns:
      estimated y-z cross-coupling error or null if not available.
    • getEstimatedMzx

      public Double getEstimatedMzx()
      Gets estimated z-x cross-coupling error.
      Specified by:
      getEstimatedMzx in interface MagnetometerCalibrator
      Returns:
      estimated z-x cross-coupling error or null if not available.
    • getEstimatedMzy

      public Double getEstimatedMzy()
      Gets estimated z-y cross-coupling error.
      Specified by:
      getEstimatedMzy in interface MagnetometerCalibrator
      Returns:
      estimated z-y cross-coupling error or null if not available.
    • getEstimatedCovariance

      public com.irurueta.algebra.Matrix getEstimatedCovariance()
      Gets estimated covariance matrix for estimated calibration parameters. Diagonal elements of the matrix contains variance for the following parameters (following indicated order): bx, by, bz, sx, sy, sz, mxy, mxz, myx, myz, mzx, mzy.
      Specified by:
      getEstimatedCovariance in interface MagnetometerNonLinearCalibrator
      Returns:
      estimated covariance matrix for estimated calibration parameters.
    • getEstimatedChiSq

      public double getEstimatedChiSq()
      Gets estimated chi square value.
      Specified by:
      getEstimatedChiSq in interface MagnetometerNonLinearCalibrator
      Returns:
      estimated chi square value.
    • getEstimatedMse

      public double getEstimatedMse()
      Gets estimated mean square error respect to provided measurements.
      Specified by:
      getEstimatedMse in interface MagnetometerNonLinearCalibrator
      Returns:
      estimated mean square error respect to provided measurements.
    • getEstimatedHardIronXVariance

      public Double getEstimatedHardIronXVariance()
      Gets variance of estimated x coordinate of magnetometer bias expressed in squared Teslas (T^2).
      Returns:
      variance of estimated x coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronXStandardDeviation

      public Double getEstimatedHardIronXStandardDeviation()
      Gets standard deviation of estimated x coordinate of magnetometer bias expressed in Teslas (T).
      Returns:
      standard deviation of estimated x coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronXStandardDeviationAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronXStandardDeviationAsMagneticFluxDensity()
      Gets standard deviation of estimated x coordinate of magnetometer bias.
      Returns:
      standard deviation of estimated x coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronXStandardDeviationAsMagneticFluxDensity

      public boolean getEstimatedHardIronXStandardDeviationAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets standard deviation of estimated x coordinate of magnetometer bias.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if standard deviation of estimated x coordinate of magnetometer bias is available, false otherwise.
    • getEstimatedHardIronYVariance

      public Double getEstimatedHardIronYVariance()
      Gets variance of estimated y coordinate of magnetometer bias expressed in squared Teslas (T^2).
      Returns:
      variance of estimated y coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronYStandardDeviation

      public Double getEstimatedHardIronYStandardDeviation()
      Gets standard deviation of estimated y coordinate of magnetometer bias expressed in Teslas (T).
      Returns:
      standard deviation of estimated y coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronYStandardDeviationAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronYStandardDeviationAsMagneticFluxDensity()
      Gets standard deviation of estimated y coordinate of magnetometer bias.
      Returns:
      standard deviation of estimated y coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronYStandardDeviationAsMagneticFluxDensity

      public boolean getEstimatedHardIronYStandardDeviationAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets standard deviation of estimated y coordinate of magnetometer bias.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if standard deviation of estimated y coordinate of magnetometer bias is available, false otherwise.
    • getEstimatedHardIronZVariance

      public Double getEstimatedHardIronZVariance()
      Gets variance of estimated z coordinate of magnetometer bias expressed in squared Teslas (T^2).
      Returns:
      variance of estimated z coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronZStandardDeviation

      public Double getEstimatedHardIronZStandardDeviation()
      Gets standard deviation of estimated z coordinate of magnetometer bias expressed in Teslas (T).
      Returns:
      standard deviation of estimated z coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronZStandardDeviationAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronZStandardDeviationAsMagneticFluxDensity()
      Gets standard deviation of estimated z coordinate of magnetometer bias.
      Returns:
      standard deviation of estimated z coordinate of magnetometer bias or null if not available.
    • getEstimatedHardIronZStandardDeviationAsMagneticFluxDensity

      public boolean getEstimatedHardIronZStandardDeviationAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets standard deviation of estimated z coordinate of magnetometer bias.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if standard deviation of estimated z coordinate of magnetometer bias is available, false otherwise.
    • getEstimatedHardIronStandardDeviation

      public MagneticFluxDensityTriad getEstimatedHardIronStandardDeviation()
      Gets standard deviation of estimated magnetometer bias coordinates.
      Returns:
      standard deviation of estimated magnetometer bias coordinates.
    • getEstimatedHardIronStandardDeviation

      public boolean getEstimatedHardIronStandardDeviation(MagneticFluxDensityTriad result)
      Gets standard deviation of estimated magnetometer bias coordinates.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if standard deviation of magnetometer bias was available, false otherwise.
    • getEstimatedHardIronStandardDeviationAverage

      public Double getEstimatedHardIronStandardDeviationAverage()
      Gets average of estimated standard deviation of magnetometer bias coordinates expressed in Teslas (T).
      Returns:
      average of estimated standard deviation of magnetometer bias coordinates, or null if not available.
    • getEstimatedHardIronStandardDeviationAverageAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronStandardDeviationAverageAsMagneticFluxDensity()
      Gets average of estimated standard deviation of magnetometer bias coordinates.
      Returns:
      average of estimated standard deviation of magnetometer bias coordinates, or null if not available.
    • getEstimatedHardIronStandardDeviationAverageAsMagneticFluxDensity

      public boolean getEstimatedHardIronStandardDeviationAverageAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets average of estimated standard deviation of magnetometer bias coordinates.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if average of estimated standard deviation of magnetometer bias is available, false otherwise.
    • getEstimatedHardIronStandardDeviationNorm

      public Double getEstimatedHardIronStandardDeviationNorm()
      Gets norm of estimated standard deviation of magnetometer bias expressed in Teslas (T).
      Returns:
      norm of estimated standard deviation of magnetometer bias or null if not available.
    • getEstimatedHardIronStandardDeviationNormAsMagneticFluxDensity

      public com.irurueta.units.MagneticFluxDensity getEstimatedHardIronStandardDeviationNormAsMagneticFluxDensity()
      Gets norm of estimated standard deviation of magnetometer bias.
      Returns:
      norm of estimated standard deviation of magnetometer bias or null if not available.
    • getEstimatedHardIronStandardDeviationNormAsMagneticFluxDensity

      public boolean getEstimatedHardIronStandardDeviationNormAsMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity result)
      Gets norm of estimated standard deviation of magnetometer bias.
      Parameters:
      result - instance where result will be stored.
      Returns:
      true if norm of estimated standard deviation of magnetometer bias is available, false otherwise.
    • onBeforeCalibrate

      protected void onBeforeCalibrate() throws CalibrationException
      Called before calibration occurs. This can be overridden by subclasses.
      Throws:
      CalibrationException - if anything fails.
    • internalSetGroundTruthMagneticFluxDensityNorm

      protected void internalSetGroundTruthMagneticFluxDensityNorm(Double groundTruthMagneticFluxDensityNorm)
      Internally sets ground truth magnetic flux density norm to be expected at location where measurements have been made, expressed in Teslas (T).
      Parameters:
      groundTruthMagneticFluxDensityNorm - ground truth magnetic flux density norm or null if undefined.
      Throws:
      IllegalArgumentException - if provided value is negative.
    • setInputData

      protected void setInputData() throws com.irurueta.algebra.WrongSizeException
      Sets input data into Levenberg-Marquardt fitter.
      Throws:
      com.irurueta.algebra.WrongSizeException - never happens.
    • calibrateGeneral

      private void calibrateGeneral() throws com.irurueta.algebra.AlgebraException, com.irurueta.numerical.fitting.FittingException, com.irurueta.numerical.NotReadyException
      Internal method to perform general calibration.
      Throws:
      com.irurueta.numerical.fitting.FittingException - if Levenberg-Marquardt fails for numerical reasons.
      com.irurueta.algebra.AlgebraException - if there are numerical instabilities that prevent matrix inversion.
      com.irurueta.numerical.NotReadyException - never happens.
    • calibrateCommonAxis

      private void calibrateCommonAxis() throws com.irurueta.algebra.AlgebraException, com.irurueta.numerical.fitting.FittingException, com.irurueta.numerical.NotReadyException
      Internal method to perform calibration when common z-axis is assumed for both the accelerometer and gyroscope.
      Throws:
      com.irurueta.numerical.fitting.FittingException - if Levenberg-Marquardt fails for numerical reasons.
      com.irurueta.algebra.AlgebraException - if there are numerical instabilities that prevent matrix inversion.
      com.irurueta.numerical.NotReadyException - never happens.
    • setResult

      private void setResult(com.irurueta.algebra.Matrix m, com.irurueta.algebra.Matrix b) throws com.irurueta.algebra.AlgebraException
      Makes proper conversion of internal cross-coupling and bias matrices.
      Parameters:
      m - internal cross-coupling matrix.
      b - internal bias matrix.
      Throws:
      com.irurueta.algebra.AlgebraException - if a numerical instability occurs.
    • evaluateGeneral

      private double evaluateGeneral(double[] params) throws com.irurueta.numerical.EvaluationException
      Computes estimated true magnetic flux density squared norm using current measured body magnetic flux density and provided parameters for the general case. This method is internally executed during gradient estimation and Levenberg-Marquardt fitting needed for calibration computation.
      Parameters:
      params - array containing current parameters for the general purpose case. Must have length 12.
      Returns:
      estimated true specific force squared norm.
      Throws:
      com.irurueta.numerical.EvaluationException - if there are numerical instabilities.
    • evaluateCommonAxis

      private double evaluateCommonAxis(double[] params) throws com.irurueta.numerical.EvaluationException
      Computes estimated true magnetic flux density squared norm using current measured body magnetic flux density and provided parameters when common z-axis is assumed. This method is internally executed during gradient estimation and Levenberg-Marquardt fitting needed for calibration computation.
      Parameters:
      params - array containing current parameters for the common z-axis case. Must have length 9.
      Returns:
      estimated true specific force squared norm.
      Throws:
      com.irurueta.numerical.EvaluationException - if there are numerical instabilities.
    • evaluate

      private double evaluate(double bx, double by, double bz, double m11, double m21, double m31, double m12, double m22, double m32, double m13, double m23, double m33) throws com.irurueta.numerical.EvaluationException
      Computes estimated true magnetic flux density squared norm using current measured body magnetic flux density and provided parameters. This method is internally executed during gradient estimation and Levenberg-Marquardt fitting needed for calibration computation.
      Parameters:
      bx - x-coordinate of bias.
      by - y-coordinate of bias.
      bz - z-coordinate of bias.
      m11 - element 1,1 of cross-coupling error matrix.
      m21 - element 2,1 of cross-coupling error matrix.
      m31 - element 3,1 of cross-coupling error matrix.
      m12 - element 1,2 of cross-coupling error matrix.
      m22 - element 2,2 of cross-coupling error matrix.
      m32 - element 3,2 of cross-coupling error matrix.
      m13 - element 1,3 of cross-coupling error matrix.
      m23 - element 2,3 of cross-coupling error matrix.
      m33 - element 3,3 of cross-coupling error matrix.
      Returns:
      estimated true specific force squared norm.
      Throws:
      com.irurueta.numerical.EvaluationException - if there are numerical instabilities.
    • convertMagneticFluxDensity

      private static double convertMagneticFluxDensity(double value, com.irurueta.units.MagneticFluxDensityUnit unit)
      Converts magnetic flux density value and unit to Teslas.
      Parameters:
      value - magnetic flux density value.
      unit - unit of magnetic flux density value.
      Returns:
      converted value.
    • convertMagneticFluxDensity

      private static double convertMagneticFluxDensity(com.irurueta.units.MagneticFluxDensity magneticFluxDensity)
      Converts magnetic flux density instance to Teslas.
      Parameters:
      magneticFluxDensity - magnetic flux density instance to be converted.
      Returns:
      converted value.