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.algebra.Matrix;
19  import com.irurueta.navigation.LockedException;
20  import com.irurueta.navigation.inertial.calibration.MagneticFluxDensityTriad;
21  import com.irurueta.units.MagneticFluxDensity;
22  
23  /**
24   * Interface for magnetometer calibrator where hard-iron is known.
25   * Hard-iron term of magnetometer model behaves like accelerometer bias.
26   */
27  public interface KnownHardIronMagnetometerCalibrator {
28  
29      /**
30       * Gets known x coordinate of magnetometer hard-iron expressed in
31       * Teslas (T).
32       *
33       * @return x coordinate of magnetometer hard-iron.
34       */
35      double getHardIronX();
36  
37      /**
38       * Sets known x coordinate of magnetometer hard-iron expressed in
39       * Teslas (T).
40       *
41       * @param hardIronX x coordinate of magnetometer hard-iron.
42       * @throws LockedException if calibrator is currently running.
43       */
44      void setHardIronX(final double hardIronX) throws LockedException;
45  
46      /**
47       * Gets known y coordinate of magnetometer hard-iron expressed in
48       * Teslas (T).
49       *
50       * @return y coordinate of magnetometer hard-iron.
51       */
52      double getHardIronY();
53  
54      /**
55       * Sets known y coordinate of magnetometer hard-iron expressed in
56       * Teslas (T).
57       *
58       * @param hardIronY y coordinate of magnetometer hard-iron.
59       * @throws LockedException if calibrator is currently running.
60       */
61      void setHardIronY(final double hardIronY) throws LockedException;
62  
63      /**
64       * Gets known z coordinate of magnetometer hard-iron expressed in
65       * Teslas (T).
66       *
67       * @return z coordinate of magnetometer hard-iron.
68       */
69      double getHardIronZ();
70  
71      /**
72       * Sets known z coordinate of magnetometer hard-iron expressed in
73       * Teslas (T).
74       *
75       * @param hardIronZ z coordinate of magnetometer hard-iron.
76       * @throws LockedException if calibrator is currently running.
77       */
78      void setHardIronZ(final double hardIronZ) throws LockedException;
79  
80      /**
81       * Gets known x coordinate of magnetometer hard-iron.
82       *
83       * @return x coordinate of magnetometer hard-iron.
84       */
85      MagneticFluxDensity getHardIronXAsMagneticFluxDensity();
86  
87      /**
88       * Gets known x coordinate of magnetometer hard-iron.
89       *
90       * @param result instance where result will be stored.
91       */
92      void getHardIronXAsMagneticFluxDensity(final MagneticFluxDensity result);
93  
94      /**
95       * Sets known x-coordinate of magnetometer hard-iron.
96       *
97       * @param hardIronX known x-coordinate of magnetometer hard-iron.
98       * @throws LockedException if calibrator is currently running.
99       */
100     void setHardIronX(final MagneticFluxDensity hardIronX) throws LockedException;
101 
102     /**
103      * Gets known y coordinate of magnetometer hard-iron.
104      *
105      * @return y coordinate of magnetometer hard-iron.
106      */
107     MagneticFluxDensity getHardIronYAsMagneticFluxDensity();
108 
109     /**
110      * Gets known y coordinate of magnetometer hard-iron.
111      *
112      * @param result instance where result will be stored.
113      */
114     void getHardIronYAsMagneticFluxDensity(final MagneticFluxDensity result);
115 
116     /**
117      * Sets known y-coordinate of magnetometer hard-iron.
118      *
119      * @param hardIronY known y-coordinate of magnetometer hard-iron.
120      * @throws LockedException if calibrator is currently running.
121      */
122     void setHardIronY(final MagneticFluxDensity hardIronY) throws LockedException;
123 
124     /**
125      * Gets known z coordinate of magnetometer hard-iron.
126      *
127      * @return z coordinate of magnetometer hard-iron.
128      */
129     MagneticFluxDensity getHardIronZAsMagneticFluxDensity();
130 
131     /**
132      * Gets known z coordinate of magnetometer hard-iron.
133      *
134      * @param result instance where result will be stored.
135      */
136     void getHardIronZAsMagneticFluxDensity(final MagneticFluxDensity result);
137 
138     /**
139      * Sets known z-coordinate of magnetometer hard-iron.
140      *
141      * @param hardIronZ known z-coordinate of magnetometer hard-iron.
142      * @throws LockedException if calibrator is currently running.
143      */
144     void setHardIronZ(final MagneticFluxDensity hardIronZ) throws LockedException;
145 
146     /**
147      * Sets known hard-iron coordinates expressed in Teslas (T).
148      *
149      * @param hardIronX x-coordinate of magnetometer hard-iron.
150      * @param hardIronY y-coordinate of magnetometer hard-iron.
151      * @param hardIronZ z-coordinate of magnetometer hard-iron.
152      * @throws LockedException if calibrator is currently running.
153      */
154     void setHardIronCoordinates(
155             final double hardIronX, final double hardIronY, final double hardIronZ) throws LockedException;
156 
157     /**
158      * Sets known hard-iron coordinates.
159      *
160      * @param hardIronX x-coordinate of magnetometer hard-iron.
161      * @param hardIronY y-coordinate of magnetometer hard-iron.
162      * @param hardIronZ z-coordinate of magnetometer hard-iron.
163      * @throws LockedException if calibrator is currently running.
164      */
165     void setHardIronCoordinates(
166             final MagneticFluxDensity hardIronX, final MagneticFluxDensity hardIronY,
167             final MagneticFluxDensity hardIronZ) throws LockedException;
168 
169     /**
170      * Gets known hard-iron.
171      *
172      * @return known hard-iron.
173      */
174     MagneticFluxDensityTriad getHardIronAsTriad();
175 
176     /**
177      * Gets known hard-iron.
178      *
179      * @param result instance where result will be stored.
180      */
181     void getHardIronAsTriad(final MagneticFluxDensityTriad result);
182 
183     /**
184      * Sets known hard-iron.
185      *
186      * @param hardIron hard-iron to be set.
187      * @throws LockedException if calibrator is currently running.
188      */
189     void setHardIron(final MagneticFluxDensityTriad hardIron) throws LockedException;
190 
191     /**
192      * Gets known hard-iron bias as an array.
193      * Array values are expressed in Teslas (T).
194      *
195      * @return array containing coordinates of known hard-iron bias.
196      */
197     double[] getHardIron();
198 
199     /**
200      * Gets known hard-iron bias as an array.
201      * Array values are expressed in Teslas (T).
202      *
203      * @param result instance where result data will be copied to.
204      * @throws IllegalArgumentException if provided array does not have length 3.
205      */
206     void getHardIron(final double[] result);
207 
208     /**
209      * Sets known hard-iron bias as an array.
210      * Array values are expressed in Teslas (T).
211      *
212      * @param hardIron known hard-iron bias.
213      * @throws LockedException          if calibrator is currently running.
214      * @throws IllegalArgumentException if provided array does not have length 3.
215      */
216     void setHardIron(final double[] hardIron) throws LockedException;
217 
218     /**
219      * Gets known hard-iron bias as a column matrix.
220      *
221      * @return known hard-iron bias as a column matrix.
222      */
223     Matrix getHardIronMatrix();
224 
225     /**
226      * Gets known hard-iron bias as a column matrix.
227      *
228      * @param result instance where result data will be copied to.
229      * @throws IllegalArgumentException if provided matrix is not 3x1.
230      */
231     void getHardIronMatrix(final Matrix result);
232 
233     /**
234      * Sets known hard-iron bias as a column matrix.
235      *
236      * @param hardIron magnetometer hard-iron bias to be set.
237      * @throws LockedException          if calibrator is currently running.
238      * @throws IllegalArgumentException if provided matrix is not 3x1.
239      */
240     void setHardIron(final Matrix hardIron) throws LockedException;
241 }