View Javadoc
1   /*
2    * Copyright (C) 2020 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.navigation.inertial.calibration.magnetometer;
17  
18  import com.irurueta.navigation.LockedException;
19  import com.irurueta.navigation.inertial.calibration.FrameBodyMagneticFluxDensity;
20  
21  import java.util.Collection;
22  
23  /**
24   * Interface defining magnetometer calibrators to estimate hard-iron biases,
25   * cross coupling and scaling factors.
26   *
27   * @param <T> a {@link FrameBodyMagneticFluxDensity} containing measures used
28   *            by the calibrator.
29   * @param <L> a listener type.
30   */
31  public interface KnownFrameMagnetometerCalibrator<T extends FrameBodyMagneticFluxDensity,
32          L extends KnownFrameMagnetometerCalibratorListener<?>> extends UnknownHardIronMagnetometerCalibrator,
33          MagnetometerCalibrator {
34  
35      /**
36       * Gets a collection of body magnetic flux density measurements taken at different
37       * frames (positions, orientations and velocities).
38       * If a single device IMU needs to be calibrated, typically all measurements are
39       * taken at the same position, with zero velocity and multiple orientations.
40       * However, if we just want to calibrate a given IMU model (e.g. obtain
41       * an average and less precise calibration for the IMU of a given phone model),
42       * we could take measurements collected throughout the planet at multiple positions
43       * while the phone remains static (e.g. while charging), hence each measurement
44       * position will change, velocity will remain zero and orientation will be
45       * typically constant at horizontal orientation while the phone remains on a
46       * flat surface.
47       *
48       * @return a collection of body magnetic flux density measurements taken at different
49       * frames (positions, orientations and velocities).
50       */
51      Collection<T> getMeasurements();
52  
53      /**
54       * Sets a collection of body magnetic flux density measurements taken at different
55       * frames (positions, orientations and velocities).
56       * If a single device IMU needs to be calibrated, typically all measurements are
57       * taken at the same position, with zero velocity and multiple orientations.
58       * However, if we just want to calibrate the a given IMU model (e.g. obtain
59       * an average and less precise calibration for the IMU of a given phone model),
60       * we could take measurements collected throughout the planet at multiple positions
61       * while the phone remains static (e.g. while charging), hence each measurement
62       * position will change, velocity will remain zero and orientation will be
63       * typically constant at horizontal orientation while the phone remains on a
64       * flat surface.
65       *
66       * @param measurements collection of body magnetic flux density measurements
67       *                     taken at different frames (positions, orientations
68       *                     and velocities).
69       * @throws LockedException if estimator is currently running.
70       */
71      void setMeasurements(final Collection<? extends T> measurements) throws LockedException;
72  
73      /**
74       * Gets listener to handle events raised by this calibrator.
75       *
76       * @return listener to handle events raised by this calibrator.
77       */
78      L getListener();
79  
80      /**
81       * Sets listener to handle events raised by this calibrator.
82       *
83       * @param listener listener to handle events raised by this calibrator.
84       * @throws LockedException if estimator is currently running.
85       */
86      void setListener(final L listener) throws LockedException;
87  }