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