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.accelerometer;
17  
18  import com.irurueta.navigation.LockedException;
19  import com.irurueta.navigation.inertial.calibration.FrameBodyKinematics;
20  
21  import java.util.Collection;
22  
23  /**
24   * Interface defining accelerometer calibrators to estimate biases, cross coupling and
25   * scaling factors.
26   *
27   * @param <T> a {@link FrameBodyKinematics} containing measures used by the calibrator.
28   * @param <L> a listener type.
29   */
30  public interface KnownFrameAccelerometerCalibrator<T extends FrameBodyKinematics,
31          L extends KnownFrameAccelerometerCalibratorListener<?>>
32          extends UnknownBiasAccelerometerCalibrator, AccelerometerCalibrator {
33  
34      /**
35       * Gets a collection of body kinematics 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 the 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 kinematics measurements taken at different
48       * frames (positions, orientations and velocities).
49       */
50      Collection<T> getMeasurements();
51  
52      /**
53       * Sets a collection of body kinematics 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 the 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 kinematics measurements taken at different
66       *                     frames (positions, orientations and velocities).
67       * @throws LockedException if calibrator is currently running.
68       */
69      void setMeasurements(final Collection<? extends T> measurements) throws LockedException;
70  
71      /**
72       * Gets listener to handle events raised by this calibrator.
73       *
74       * @return listener to handle events raised by this calibrator.
75       */
76      L getListener();
77  
78      /**
79       * Sets listener to handle events raised by this calibrator.
80       *
81       * @param listener listener to handle events raised by this calibrator.
82       * @throws LockedException if estimator is currently running.
83       */
84      void setListener(final L listener) throws LockedException;
85  }