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.
25 *
26 * @param <T> a {@link FrameBodyMagneticFluxDensity} containing measures used by
27 * the calibrator.
28 * @param <L> a listener type.
29 */
30 public interface KnownHardIronAndFrameMagnetometerCalibrator<T extends FrameBodyMagneticFluxDensity,
31 L extends KnownHardIronAndFrameMagnetometerCalibratorListener<?>>
32 extends KnownHardIronMagnetometerCalibrator, MagnetometerCalibrator {
33
34 /**
35 * Gets a collection of body magnetic flux density measurements taken at different
36 * frames (positions, orientations and velocities).
37 * If a single device IMU needs to be calibrated, typically all measurements are
38 * taken at the same position, with zero velocity and multiple orientations.
39 * However, if we just want to calibrate a given IMU model (e.g. obtain
40 * an average and less precise calibration for the IMU of a given phone model),
41 * we could take measurements collected throughout the planet at multiple positions
42 * while the phone remains static (e.g. while charging), hence each measurement
43 * position will change, velocity will remain zero and orientation will be
44 * typically constant at horizontal orientation while the phone remains on a
45 * flat surface.
46 *
47 * @return a collection of body magnetic flux density measurements taken at different
48 * frames (positions, orientations and velocities).
49 */
50 Collection<T> getMeasurements();
51
52 /**
53 * Sets a collection of body magnetic flux density measurements taken at different
54 * frames (positions, orientations and velocities).
55 * If a single device IMU needs to be calibrated, typically all measurements are
56 * taken at the same position, with zero velocity and multiple orientations.
57 * However, if we just want to calibrate a given IMU model (e.g. obtain
58 * an average and less precise calibration for the IMU of a given phone model),
59 * we could take measurements collected throughout the planet at multiple positions
60 * while the phone remains static (e.g. while charging), hence each measurement
61 * position will change, velocity will remain zero and orientation will be
62 * typically constant at horizontal orientation while the phone remains on a
63 * flat surface.
64 *
65 * @param measurements collection of body magnetic flux density measurements
66 * taken at different frames (positions, orientations
67 * and velocities).
68 * @throws LockedException if estimator is currently running.
69 */
70 void setMeasurements(final Collection<? extends T> measurements) throws LockedException;
71
72 /**
73 * Gets listener to handle events raised by this estimator.
74 *
75 * @return listener to handle events raised by this estimator.
76 */
77 L getListener();
78
79 /**
80 * Sets listener to handle events raised by this estimator.
81 *
82 * @param listener listener to handle events raised by this estimator.
83 * @throws LockedException if estimator is currently running.
84 */
85 void setListener(final L listener) throws LockedException;
86 }