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.algebra.Matrix;
19  import com.irurueta.navigation.LockedException;
20  
21  /**
22   * Interface for non-linear accelerometer calibrators.
23   */
24  public interface AccelerometerNonLinearCalibrator extends AccelerometerCalibrator {
25  
26      /**
27       * Gets initial x scaling factor.
28       *
29       * @return initial x scaling factor.
30       */
31      double getInitialSx();
32  
33      /**
34       * Sets initial x scaling factor.
35       *
36       * @param initialSx initial x scaling factor.
37       * @throws LockedException if calibrator is currently running.
38       */
39      void setInitialSx(final double initialSx) throws LockedException;
40  
41      /**
42       * Gets initial y scaling factor.
43       *
44       * @return initial y scaling factor.
45       */
46      double getInitialSy();
47  
48      /**
49       * Sets initial y scaling factor.
50       *
51       * @param initialSy initial y scaling factor.
52       * @throws LockedException if calibrator is currently running.
53       */
54      void setInitialSy(final double initialSy) throws LockedException;
55  
56      /**
57       * Gets initial z scaling factor.
58       *
59       * @return initial z scaling factor.
60       */
61      double getInitialSz();
62  
63      /**
64       * Sets initial z scaling factor.
65       *
66       * @param initialSz initial z scaling factor.
67       * @throws LockedException if calibrator is currently running.
68       */
69      void setInitialSz(final double initialSz) throws LockedException;
70  
71      /**
72       * Gets initial x-y cross coupling error.
73       *
74       * @return initial x-y cross coupling error.
75       */
76      double getInitialMxy();
77  
78      /**
79       * Sets initial x-y cross coupling error.
80       *
81       * @param initialMxy initial x-y cross coupling error.
82       * @throws LockedException if calibrator is currently running.
83       */
84      void setInitialMxy(final double initialMxy) throws LockedException;
85  
86      /**
87       * Gets initial x-z cross coupling error.
88       *
89       * @return initial x-z cross coupling error.
90       */
91      double getInitialMxz();
92  
93      /**
94       * Sets initial x-z cross coupling error.
95       *
96       * @param initialMxz initial x-z cross coupling error.
97       * @throws LockedException if calibrator is currently running.
98       */
99      void setInitialMxz(final double initialMxz) throws LockedException;
100 
101     /**
102      * Gets initial y-x cross coupling error.
103      *
104      * @return initial y-x cross coupling error.
105      */
106     double getInitialMyx();
107 
108     /**
109      * Sets initial y-x cross coupling error.
110      *
111      * @param initialMyx initial y-x cross coupling error.
112      * @throws LockedException if calibrator is currently running.
113      */
114     void setInitialMyx(final double initialMyx) throws LockedException;
115 
116     /**
117      * Gets initial y-z cross coupling error.
118      *
119      * @return initial y-z cross coupling error.
120      */
121     double getInitialMyz();
122 
123     /**
124      * Sets initial y-z cross coupling error.
125      *
126      * @param initialMyz initial y-z cross coupling error.
127      * @throws LockedException if calibrator is currently running.
128      */
129     void setInitialMyz(final double initialMyz) throws LockedException;
130 
131     /**
132      * Gets initial z-x cross coupling error.
133      *
134      * @return initial z-x cross coupling error.
135      */
136     double getInitialMzx();
137 
138     /**
139      * Sets initial z-x cross coupling error.
140      *
141      * @param initialMzx initial z-x cross coupling error.
142      * @throws LockedException if calibrator is currently running.
143      */
144     void setInitialMzx(final double initialMzx) throws LockedException;
145 
146     /**
147      * Gets initial z-y cross coupling error.
148      *
149      * @return initial z-y cross coupling error.
150      */
151     double getInitialMzy();
152 
153     /**
154      * Sets initial z-y cross coupling error.
155      *
156      * @param initialMzy initial z-y cross coupling error.
157      * @throws LockedException if calibrator is currently running.
158      */
159     void setInitialMzy(final double initialMzy) throws LockedException;
160 
161     /**
162      * Sets initial scaling factors.
163      *
164      * @param initialSx initial x scaling factor.
165      * @param initialSy initial y scaling factor.
166      * @param initialSz initial z scaling factor.
167      * @throws LockedException if calibrator is currently running.
168      */
169     void setInitialScalingFactors(final double initialSx, final double initialSy, final double initialSz)
170             throws LockedException;
171 
172     /**
173      * Sets initial cross coupling errors.
174      *
175      * @param initialMxy initial x-y cross coupling error.
176      * @param initialMxz initial x-z cross coupling error.
177      * @param initialMyx initial y-x cross coupling error.
178      * @param initialMyz initial y-z cross coupling error.
179      * @param initialMzx initial z-x cross coupling error.
180      * @param initialMzy initial z-y cross coupling error.
181      * @throws LockedException if calibrator is currently running.
182      */
183     void setInitialCrossCouplingErrors(
184             final double initialMxy, final double initialMxz, final double initialMyx,
185             final double initialMyz, final double initialMzx, final double initialMzy) throws LockedException;
186 
187     /**
188      * Sets initial scaling factors and cross coupling errors.
189      *
190      * @param initialSx  initial x scaling factor.
191      * @param initialSy  initial y scaling factor.
192      * @param initialSz  initial z scaling factor.
193      * @param initialMxy initial x-y cross coupling error.
194      * @param initialMxz initial x-z cross coupling error.
195      * @param initialMyx initial y-x cross coupling error.
196      * @param initialMyz initial y-z cross coupling error.
197      * @param initialMzx initial z-x cross coupling error.
198      * @param initialMzy initial z-y cross coupling error.
199      * @throws LockedException if calibrator is currently running.
200      */
201     void setInitialScalingFactorsAndCrossCouplingErrors(
202             final double initialSx, final double initialSy, final double initialSz,
203             final double initialMxy, final double initialMxz, final double initialMyx,
204             final double initialMyz, final double initialMzx, final double initialMzy) throws LockedException;
205 
206     /**
207      * Gets initial scale factors and cross coupling errors matrix.
208      *
209      * @return initial scale factors and cross coupling errors matrix.
210      */
211     Matrix getInitialMa();
212 
213     /**
214      * Gets initial scale factors and cross coupling errors matrix.
215      *
216      * @param result instance where data will be stored.
217      * @throws IllegalArgumentException if provided matrix is not 3x3.
218      */
219     void getInitialMa(final Matrix result);
220 
221     /**
222      * Sets initial scale factors and cross coupling errors matrix.
223      *
224      * @param initialMa initial scale factors and cross coupling errors matrix.
225      * @throws IllegalArgumentException if provided matrix is not 3x3.
226      * @throws LockedException          if calibrator is currently running.
227      */
228     void setInitialMa(final Matrix initialMa) throws LockedException;
229 
230     /**
231      * Gets estimated covariance matrix for estimated position.
232      *
233      * @return estimated covariance matrix for estimated position.
234      */
235     Matrix getEstimatedCovariance();
236 
237     /**
238      * Gets estimated chi square value.
239      *
240      * @return estimated chi square value.
241      */
242     double getEstimatedChiSq();
243 
244     /**
245      * Gets estimated chi square degrees of freedom. Degrees of freedom is equal to the number of sampled data minus the
246      * number of estimated parameters.
247      *
248      * @return estimated degrees of freedom of chi square value
249      */
250     int getEstimatedChiSqDegreesOfFreedom();
251 
252     /**
253      * Gets estimated reduced chi square value. This is equal to estimated chi square value divided by its degrees of
254      * freedom. Ideally this value should be close to 1.0, indicating that fit is optimal.
255      * A value larger than 1.0 indicates that fit is not good or noise has been underestimated, and a value smaller than
256      * 1.0 indicates that there is overfitting or noise has been overestimated.
257      *
258      * @return estimated reduced chi square value
259      */
260     double getEstimatedReducedChiSq();
261 
262     /**
263      * Gets estimated mean square error respect to provided measurements.
264      *
265      * @return estimated mean square error respect to provided measurements.
266      */
267     double getEstimatedMse();
268 
269     /**
270      * Gets estimated probability of finding a smaller chi square value expressed as a value between 0.0 and 1.0. The
271      * smaller the found chi square value is, the better the fit of the estimated parameters to the actual parameter.
272      * Thus, the smaller the chance of finding a smaller chi square value, then the better the estimated fit is.
273      *
274      * @return estimated probability of finding a smaller chi square value or null if there were numerical unstabilities
275      * to compute such value.
276      */
277     double getEstimatedP();
278 
279     /**
280      * Gets estimated measure of quality of estimated fit as a value between 0.0 and 1.0. The larger the quality value
281      * is, the better the fit that has been estimated.
282      *
283      * @return estimated measure of quality of estimated fit.
284      */
285     double getEstimatedQ();
286 }