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 import com.irurueta.navigation.NotReadyException;
21 import com.irurueta.navigation.inertial.calibration.CalibrationException;
22 import com.irurueta.navigation.inertial.calibration.StandardDeviationBodyKinematics;
23 import com.irurueta.numerical.robust.PROSACRobustEstimator;
24 import com.irurueta.numerical.robust.PROSACRobustEstimatorListener;
25 import com.irurueta.numerical.robust.RobustEstimator;
26 import com.irurueta.numerical.robust.RobustEstimatorException;
27 import com.irurueta.numerical.robust.RobustEstimatorMethod;
28 import com.irurueta.units.Acceleration;
29
30 import java.util.List;
31
32 /**
33 * Robustly estimates accelerometer cross couplings and scaling factors
34 * using a PROSAC algorithm to discard outliers.
35 * <p>
36 * To use this calibrator at least 7 measurements taken at a single position
37 * where gravity norm is known must be taken at 7 different unknown
38 * orientations and zero velocity when common z-axis
39 * is assumed, otherwise at least 10 measurements are required.
40 * <p>
41 * Measured specific force is assumed to follow the model shown below:
42 * <pre>
43 * fmeas = ba + (I + Ma) * ftrue + w
44 * </pre>
45 * Where:
46 * - fmeas is the measured specific force. This is a 3x1 vector.
47 * - ba is accelerometer bias. Ideally, on a perfect accelerometer, this should be a
48 * 3x1 zero vector.
49 * - I is the 3x3 identity matrix.
50 * - Ma is the 3x3 matrix containing cross-couplings and scaling factors. Ideally, on
51 * a perfect accelerometer, this should be a 3x3 zero matrix.
52 * - ftrue is ground-truth specific force.
53 * - w is measurement noise.
54 */
55 public class PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator extends
56 RobustKnownBiasAndGravityNormAccelerometerCalibrator {
57
58 /**
59 * Constant defining default threshold to determine whether samples are inliers or not.
60 */
61 public static final double DEFAULT_THRESHOLD = 1e-2;
62
63 /**
64 * Minimum value that can be set as threshold.
65 * Threshold must be strictly greater than 0.0.
66 */
67 public static final double MIN_THRESHOLD = 0.0;
68
69 /**
70 * Indicates that by default inliers will only be computed but not kept.
71 */
72 public static final boolean DEFAULT_COMPUTE_AND_KEEP_INLIERS = false;
73
74 /**
75 * Indicates that by default residuals will only be computed but not kept.
76 */
77 public static final boolean DEFAULT_COMPUTE_AND_KEEP_RESIDUALS = false;
78
79 /**
80 * Threshold to determine whether samples are inliers or not when testing possible solutions.
81 * The threshold refers to the amount of error on distance between estimated position and
82 * distances provided for each sample.
83 */
84 private double threshold = DEFAULT_THRESHOLD;
85
86 /**
87 * Indicates whether inliers must be computed and kept.
88 */
89 private boolean computeAndKeepInliers = DEFAULT_COMPUTE_AND_KEEP_INLIERS;
90
91 /**
92 * Indicates whether residuals must be computed and kept.
93 */
94 private boolean computeAndKeepResiduals = DEFAULT_COMPUTE_AND_KEEP_RESIDUALS;
95
96 /**
97 * Quality scores corresponding to each provided sample.
98 * The larger the score value the better the quality of the sample.
99 */
100 private double[] qualityScores;
101
102 /**
103 * Constructor.
104 */
105 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator() {
106 super();
107 }
108
109 /**
110 * Constructor.
111 *
112 * @param listener listener to be notified of events such as when estimation
113 * starts, ends or its progress significantly changes.
114 */
115 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
116 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
117 super(listener);
118 }
119
120 /**
121 * Constructor.
122 *
123 * @param measurements collection of body kinematics measurements with standard
124 * deviations taken at the same position with zero velocity
125 * and unknown different orientations.
126 */
127 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
128 final List<StandardDeviationBodyKinematics> measurements) {
129 super(measurements);
130 }
131
132
133 /**
134 * Constructor.
135 *
136 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
137 * accelerometer and gyroscope.
138 */
139 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final boolean commonAxisUsed) {
140 super(commonAxisUsed);
141 }
142
143 /**
144 * Constructor.
145 *
146 * @param bias known accelerometer bias. This must have length 3 and is expressed
147 * in meters per squared second (m/s^2).
148 * @throws IllegalArgumentException if provided bias array does not have length 3.
149 */
150 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final double[] bias) {
151 super(bias);
152 }
153
154 /**
155 * Constructor.
156 *
157 * @param bias known accelerometer bias.
158 * @throws IllegalArgumentException if provided bias matrix is not 3x1.
159 */
160 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final Matrix bias) {
161 super(bias);
162 }
163
164 /**
165 * Constructor.
166 *
167 * @param bias known accelerometer bias.
168 * @param initialMa initial scale factors and cross coupling errors matrix.
169 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
170 * scaling and coupling error matrix is not 3x3.
171 */
172 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final Matrix bias, final Matrix initialMa) {
173 super(bias, initialMa);
174 }
175
176 /**
177 * Constructor.
178 *
179 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
180 * squared second (m/s^2).
181 * @throws IllegalArgumentException if provided gravity norm value is negative.
182 */
183 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final Double groundTruthGravityNorm) {
184 super(groundTruthGravityNorm);
185 }
186
187 /**
188 * Constructor.
189 *
190 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
191 * squared second (m/s^2).
192 * @param measurements list of body kinematics measurements taken at a given position with
193 * different unknown orientations and containing the standard deviations
194 * of accelerometer and gyroscope measurements.
195 * @throws IllegalArgumentException if provided gravity norm value is negative.
196 */
197 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
198 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements) {
199 super(groundTruthGravityNorm, measurements);
200 }
201
202 /**
203 * Constructor.
204 *
205 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
206 * squared second (m/s^2).
207 * @param measurements list of body kinematics measurements taken at a given position with
208 * different unknown orientations and containing the standard deviations
209 * of accelerometer and gyroscope measurements.
210 * @param listener listener to be notified of events such as when estimation
211 * starts, ends or its progress significantly changes.
212 * @throws IllegalArgumentException if provided gravity norm value is negative.
213 */
214 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
215 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
216 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
217 super(groundTruthGravityNorm, measurements, listener);
218 }
219
220 /**
221 * Constructor.
222 *
223 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
224 * squared second (m/s^2).
225 * @param measurements list of body kinematics measurements taken at a given position with
226 * different unknown orientations and containing the standard deviations
227 * of accelerometer and gyroscope measurements.
228 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
229 * accelerometer and gyroscope.
230 * @throws IllegalArgumentException if provided gravity norm value is negative.
231 */
232 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
233 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
234 final boolean commonAxisUsed) {
235 super(groundTruthGravityNorm, measurements, commonAxisUsed);
236 }
237
238 /**
239 * Constructor.
240 *
241 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
242 * squared second (m/s^2).
243 * @param measurements list of body kinematics measurements taken at a given position with
244 * different unknown orientations and containing the standard deviations
245 * of accelerometer and gyroscope measurements.
246 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
247 * accelerometer and gyroscope.
248 * @param listener listener to be notified of events such as when estimation
249 * starts, ends or its progress significantly changes.
250 * @throws IllegalArgumentException if provided gravity norm value is negative.
251 */
252 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
253 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
254 final boolean commonAxisUsed, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
255 super(groundTruthGravityNorm, measurements, commonAxisUsed, listener);
256 }
257
258 /**
259 * Constructor.
260 *
261 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
262 * squared second (m/s^2).
263 * @param measurements collection of body kinematics measurements with standard
264 * deviations taken at the same position with zero velocity
265 * and unknown different orientations.
266 * @param bias known accelerometer bias. This must have length 3 and is expressed
267 * in meters per squared second (m/s^2).
268 * @throws IllegalArgumentException if provided bias array does not have length 3 or
269 * if provided gravity norm value is negative.
270 */
271 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
272 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
273 final double[] bias) {
274 super(groundTruthGravityNorm, measurements, bias);
275 }
276
277 /**
278 * Constructor.
279 *
280 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
281 * squared second (m/s^2).
282 * @param measurements collection of body kinematics measurements with standard
283 * deviations taken at the same position with zero velocity
284 * and unknown different orientations.
285 * @param bias known accelerometer bias. This must have length 3 and is expressed
286 * in meters per squared second (m/s^2).
287 * @param listener listener to handle events raised by this calibrator.
288 * @throws IllegalArgumentException if provided bias array does not have length 3 or
289 * if provided gravity norm value is negative.
290 */
291 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
292 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
293 final double[] bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
294 super(groundTruthGravityNorm, measurements, bias, listener);
295 }
296
297 /**
298 * Constructor.
299 *
300 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
301 * squared second (m/s^2).
302 * @param measurements collection of body kinematics measurements with standard
303 * deviations taken at the same position with zero velocity
304 * and unknown different orientations.
305 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
306 * accelerometer and gyroscope.
307 * @param bias known accelerometer bias. This must have length 3 and is expressed
308 * in meters per squared second (m/s^2).
309 * @throws IllegalArgumentException if provided bias array does not have length 3 or
310 * if provided gravity norm value is negative.
311 */
312 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
313 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
314 final boolean commonAxisUsed, final double[] bias) {
315 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
316 }
317
318 /**
319 * Constructor.
320 *
321 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
322 * squared second (m/s^2).
323 * @param measurements collection of body kinematics measurements with standard
324 * deviations taken at the same position with zero velocity
325 * and unknown different orientations.
326 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
327 * accelerometer and gyroscope.
328 * @param bias known accelerometer bias. This must have length 3 and is
329 * expressed in meters per squared second (m/s^2).
330 * @param listener listener to handle events raised by this calibrator.
331 * @throws IllegalArgumentException if provided bias array does not have length 3 or
332 * if provided gravity norm value is negative.
333 */
334 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
335 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
336 final boolean commonAxisUsed, final double[] bias,
337 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
338 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
339 }
340
341 /**
342 * Constructor.
343 *
344 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
345 * squared second (m/s^2).
346 * @param measurements collection of body kinematics measurements with standard
347 * deviations taken at the same position with zero velocity
348 * and unknown different orientations.
349 * @param bias known accelerometer bias.
350 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
351 * if provided gravity norm value is negative.
352 */
353 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
354 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
355 final Matrix bias) {
356 super(groundTruthGravityNorm, measurements, bias);
357 }
358
359 /**
360 * Constructor.
361 *
362 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
363 * squared second (m/s^2).
364 * @param measurements collection of body kinematics measurements with standard
365 * deviations taken at the same position with zero velocity
366 * and unknown different orientations.
367 * @param bias known accelerometer bias.
368 * @param listener listener to handle events raised by this calibrator.
369 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
370 * if provided gravity norm value is negative.
371 */
372 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
373 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
374 final Matrix bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
375 super(groundTruthGravityNorm, measurements, bias, listener);
376 }
377
378 /**
379 * Constructor.
380 *
381 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
382 * squared second (m/s^2).
383 * @param measurements collection of body kinematics measurements with standard
384 * deviations taken at the same position with zero velocity
385 * and unknown different orientations.
386 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
387 * accelerometer and gyroscope.
388 * @param bias known accelerometer bias.
389 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
390 * if provided gravity norm value is negative.
391 */
392 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
393 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
394 final boolean commonAxisUsed, final Matrix bias) {
395 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
396 }
397
398 /**
399 * Constructor.
400 *
401 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
402 * squared second (m/s^2).
403 * @param measurements collection of body kinematics measurements with standard
404 * deviations taken at the same position with zero velocity
405 * and unknown different orientations.
406 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
407 * accelerometer and gyroscope.
408 * @param bias known accelerometer bias.
409 * @param listener listener to handle events raised by this calibrator.
410 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
411 * if provided gravity norm value is negative.
412 */
413 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
414 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
415 final boolean commonAxisUsed, final Matrix bias,
416 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
417 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
418 }
419
420 /**
421 * Constructor.
422 *
423 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
424 * squared second (m/s^2).
425 * @param measurements collection of body kinematics measurements with standard
426 * deviations taken at the same position with zero velocity
427 * and unknown different orientations.
428 * @param bias known accelerometer bias.
429 * @param initialMa initial scale factors and cross coupling errors matrix.
430 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
431 * scaling and coupling error matrix is not 3x3 or
432 * if provided gravity norm value is negative.
433 */
434 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
435 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
436 final Matrix bias, final Matrix initialMa) {
437 super(groundTruthGravityNorm, measurements, bias, initialMa);
438 }
439
440 /**
441 * Constructor.
442 *
443 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
444 * squared second (m/s^2).
445 * @param measurements collection of body kinematics measurements with standard
446 * deviations taken at the same position with zero velocity
447 * and unknown different orientations.
448 * @param bias known accelerometer bias.
449 * @param initialMa initial scale factors and cross coupling errors matrix.
450 * @param listener listener to handle events raised by this calibrator.
451 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
452 * scaling and coupling error matrix is not 3x3 or
453 * if provided gravity norm value is negative.
454 */
455 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
456 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
457 final Matrix bias, final Matrix initialMa,
458 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
459 super(groundTruthGravityNorm, measurements, bias, initialMa, listener);
460 }
461
462 /**
463 * Constructor.
464 *
465 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
466 * squared second (m/s^2).
467 * @param measurements collection of body kinematics measurements with standard
468 * deviations taken at the same position with zero velocity
469 * and unknown different orientations.
470 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
471 * accelerometer and gyroscope.
472 * @param bias known accelerometer bias.
473 * @param initialMa initial scale factors and cross coupling errors matrix.
474 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
475 * scaling and coupling error matrix is not 3x3 or
476 * if provided gravity norm value is negative.
477 */
478 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
479 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
480 final boolean commonAxisUsed, final Matrix bias, final Matrix initialMa) {
481 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa);
482 }
483
484 /**
485 * Constructor.
486 *
487 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
488 * squared second (m/s^2).
489 * @param measurements collection of body kinematics measurements with standard
490 * deviations taken at the same position with zero velocity
491 * and unknown different orientations.
492 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
493 * accelerometer and gyroscope.
494 * @param bias known accelerometer bias.
495 * @param initialMa initial scale factors and cross coupling errors matrix.
496 * @param listener listener to handle events raised by this calibrator.
497 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
498 * scaling and coupling error matrix is not 3x3 or
499 * if provided gravity norm value is negative.
500 */
501 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
502 final Double groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
503 final boolean commonAxisUsed, final Matrix bias, final Matrix initialMa,
504 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
505 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa, listener);
506 }
507
508 /**
509 * Constructor.
510 *
511 * @param groundTruthGravityNorm ground truth gravity norm.
512 * @throws IllegalArgumentException if provided gravity norm value is negative.
513 */
514 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(final Acceleration groundTruthGravityNorm) {
515 super(groundTruthGravityNorm);
516 }
517
518 /**
519 * Constructor.
520 *
521 * @param groundTruthGravityNorm ground truth gravity norm.
522 * @param measurements list of body kinematics measurements taken at a given position with
523 * different unknown orientations and containing the standard deviations
524 * of accelerometer and gyroscope measurements.
525 * @throws IllegalArgumentException if provided gravity norm value is negative.
526 */
527 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
528 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements) {
529 super(groundTruthGravityNorm, measurements);
530 }
531
532 /**
533 * Constructor.
534 *
535 * @param groundTruthGravityNorm ground truth gravity norm.
536 * @param measurements list of body kinematics measurements taken at a given position with
537 * different unknown orientations and containing the standard deviations
538 * of accelerometer and gyroscope measurements.
539 * @param listener listener to be notified of events such as when estimation
540 * starts, ends or its progress significantly changes.
541 * @throws IllegalArgumentException if provided gravity norm value is negative.
542 */
543 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
544 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
545 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
546 super(groundTruthGravityNorm, measurements, listener);
547 }
548
549 /**
550 * Constructor.
551 *
552 * @param groundTruthGravityNorm ground truth gravity norm.
553 * @param measurements list of body kinematics measurements taken at a given position with
554 * different unknown orientations and containing the standard deviations
555 * of accelerometer and gyroscope measurements.
556 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
557 * accelerometer and gyroscope.
558 * @throws IllegalArgumentException if provided gravity norm value is negative.
559 */
560 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
561 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
562 final boolean commonAxisUsed) {
563 super(groundTruthGravityNorm, measurements, commonAxisUsed);
564 }
565
566 /**
567 * Constructor.
568 *
569 * @param groundTruthGravityNorm ground truth gravity norm.
570 * @param measurements list of body kinematics measurements taken at a given position with
571 * different unknown orientations and containing the standard deviations
572 * of accelerometer and gyroscope measurements.
573 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
574 * accelerometer and gyroscope.
575 * @param listener listener to be notified of events such as when estimation
576 * starts, ends or its progress significantly changes.
577 * @throws IllegalArgumentException if provided gravity norm value is negative.
578 */
579 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
580 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
581 final boolean commonAxisUsed, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
582 super(groundTruthGravityNorm, measurements, commonAxisUsed, listener);
583 }
584
585 /**
586 * Constructor.
587 *
588 * @param groundTruthGravityNorm ground truth gravity norm.
589 * @param measurements collection of body kinematics measurements with standard
590 * deviations taken at the same position with zero velocity
591 * and unknown different orientations.
592 * @param bias known accelerometer bias. This must have length 3 and is expressed
593 * in meters per squared second (m/s^2).
594 * @throws IllegalArgumentException if provided bias array does not have length 3 or
595 * if provided gravity norm value is negative.
596 */
597 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
598 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
599 final double[] bias) {
600 super(groundTruthGravityNorm, measurements, bias);
601 }
602
603 /**
604 * Constructor.
605 *
606 * @param groundTruthGravityNorm ground truth gravity norm.
607 * @param measurements collection of body kinematics measurements with standard
608 * deviations taken at the same position with zero velocity
609 * and unknown different orientations.
610 * @param bias known accelerometer bias. This must have length 3 and is expressed
611 * in meters per squared second (m/s^2).
612 * @param listener listener to handle events raised by this calibrator.
613 * @throws IllegalArgumentException if provided bias array does not have length 3 or
614 * if provided gravity norm value is negative.
615 */
616 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
617 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
618 final double[] bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
619 super(groundTruthGravityNorm, measurements, bias, listener);
620 }
621
622 /**
623 * Constructor.
624 *
625 * @param groundTruthGravityNorm ground truth gravity norm.
626 * @param measurements collection of body kinematics measurements with standard
627 * deviations taken at the same position with zero velocity
628 * and unknown different orientations.
629 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
630 * accelerometer and gyroscope.
631 * @param bias known accelerometer bias. This must have length 3 and is expressed
632 * in meters per squared second (m/s^2).
633 * @throws IllegalArgumentException if provided bias array does not have length 3 or
634 * if provided gravity norm value is negative.
635 */
636 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
637 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
638 final boolean commonAxisUsed, final double[] bias) {
639 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
640 }
641
642 /**
643 * Constructor.
644 *
645 * @param groundTruthGravityNorm ground truth gravity norm.
646 * @param measurements collection of body kinematics measurements with standard
647 * deviations taken at the same position with zero velocity
648 * and unknown different orientations.
649 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
650 * accelerometer and gyroscope.
651 * @param bias known accelerometer bias. This must have length 3 and is expressed
652 * in meters per squared second (m/s^2).
653 * @param listener listener to handle events raised by this calibrator.
654 * @throws IllegalArgumentException if provided bias array does not have length 3 or
655 * if provided gravity norm value is negative.
656 */
657 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
658 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
659 final boolean commonAxisUsed, final double[] bias,
660 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
661 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
662 }
663
664 /**
665 * Constructor.
666 *
667 * @param groundTruthGravityNorm ground truth gravity norm.
668 * @param measurements collection of body kinematics measurements with standard
669 * deviations taken at the same position with zero velocity
670 * and unknown different orientations.
671 * @param bias known accelerometer bias.
672 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
673 * if provided gravity norm value is negative.
674 */
675 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
676 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
677 final Matrix bias) {
678 super(groundTruthGravityNorm, measurements, bias);
679 }
680
681 /**
682 * Constructor.
683 *
684 * @param groundTruthGravityNorm ground truth gravity norm.
685 * @param measurements collection of body kinematics measurements with standard
686 * deviations taken at the same position with zero velocity
687 * and unknown different orientations.
688 * @param bias known accelerometer bias.
689 * @param listener listener to handle events raised by this calibrator.
690 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
691 * if provided gravity norm value is negative.
692 */
693 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
694 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
695 final Matrix bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
696 super(groundTruthGravityNorm, measurements, bias, listener);
697 }
698
699 /**
700 * Constructor.
701 *
702 * @param groundTruthGravityNorm ground truth gravity norm.
703 * @param measurements collection of body kinematics measurements with standard
704 * deviations taken at the same position with zero velocity
705 * and unknown different orientations.
706 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
707 * accelerometer and gyroscope.
708 * @param bias known accelerometer bias.
709 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
710 * if provided gravity norm value is negative.
711 */
712 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
713 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
714 final boolean commonAxisUsed, final Matrix bias) {
715 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
716 }
717
718 /**
719 * Constructor.
720 *
721 * @param groundTruthGravityNorm ground truth gravity norm.
722 * @param measurements collection of body kinematics measurements with standard
723 * deviations taken at the same position with zero velocity
724 * and unknown different orientations.
725 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
726 * accelerometer and gyroscope.
727 * @param bias known accelerometer bias.
728 * @param listener listener to handle events raised by this calibrator.
729 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
730 * if provided gravity norm value is negative.
731 */
732 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
733 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
734 final boolean commonAxisUsed, final Matrix bias,
735 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
736 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
737 }
738
739 /**
740 * Constructor.
741 *
742 * @param groundTruthGravityNorm ground truth gravity norm.
743 * @param measurements collection of body kinematics measurements with standard
744 * deviations taken at the same position with zero velocity
745 * and unknown different orientations.
746 * @param bias known accelerometer bias.
747 * @param initialMa initial scale factors and cross coupling errors matrix.
748 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
749 * scaling and coupling error matrix is not 3x3 or
750 * if provided gravity norm value is negative.
751 */
752 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
753 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
754 final Matrix bias, final Matrix initialMa) {
755 super(groundTruthGravityNorm, measurements, bias, initialMa);
756 }
757
758 /**
759 * Constructor.
760 *
761 * @param groundTruthGravityNorm ground truth gravity norm.
762 * @param measurements collection of body kinematics measurements with standard
763 * deviations taken at the same position with zero velocity
764 * and unknown different orientations.
765 * @param bias known accelerometer bias.
766 * @param initialMa initial scale factors and cross coupling errors matrix.
767 * @param listener listener to handle events raised by this calibrator.
768 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
769 * scaling and coupling error matrix is not 3x3 or
770 * if provided gravity norm value is negative.
771 */
772 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
773 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
774 final Matrix bias, final Matrix initialMa,
775 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
776 super(groundTruthGravityNorm, measurements, bias, initialMa, listener);
777 }
778
779 /**
780 * Constructor.
781 *
782 * @param groundTruthGravityNorm ground truth gravity norm.
783 * @param measurements collection of body kinematics measurements with standard
784 * deviations taken at the same position with zero velocity
785 * and unknown different orientations.
786 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
787 * accelerometer and gyroscope.
788 * @param bias known accelerometer bias.
789 * @param initialMa initial scale factors and cross coupling errors matrix.
790 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
791 * scaling and coupling error matrix is not 3x3 or
792 * if provided gravity norm value is negative.
793 */
794 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
795 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
796 final boolean commonAxisUsed, final Matrix bias, final Matrix initialMa) {
797 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa);
798 }
799
800 /**
801 * Constructor.
802 *
803 * @param groundTruthGravityNorm ground truth gravity norm.
804 * @param measurements collection of body kinematics measurements with standard
805 * deviations taken at the same position with zero velocity
806 * and unknown different orientations.
807 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
808 * accelerometer and gyroscope.
809 * @param bias known accelerometer bias.
810 * @param initialMa initial scale factors and cross coupling errors matrix.
811 * @param listener listener to handle events raised by this calibrator.
812 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
813 * scaling and coupling error matrix is not 3x3 or
814 * if provided gravity norm value is negative.
815 */
816 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
817 final Acceleration groundTruthGravityNorm, final List<StandardDeviationBodyKinematics> measurements,
818 final boolean commonAxisUsed, final Matrix bias, final Matrix initialMa,
819 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
820 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa, listener);
821 }
822
823 /**
824 * Constructor.
825 *
826 * @param qualityScores quality scores corresponding to each provided
827 * measurement. The larger the score value the better
828 * the quality of the sample.
829 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
830 * squared second (m/s^2).
831 * @param measurements list of body kinematics measurements taken at a given position with
832 * different unknown orientations and containing the standard deviations
833 * of accelerometer and gyroscope measurements.
834 * @throws IllegalArgumentException if provided gravity norm value is negative or
835 * if provided quality scores length is
836 * smaller than 13 samples.
837 */
838 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
839 final double[] qualityScores, final Double groundTruthGravityNorm,
840 final List<StandardDeviationBodyKinematics> measurements) {
841 super(groundTruthGravityNorm, measurements);
842 internalSetQualityScores(qualityScores);
843 }
844
845 /**
846 * Constructor.
847 *
848 * @param qualityScores quality scores corresponding to each provided
849 * measurement. The larger the score value the better
850 * the quality of the sample.
851 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
852 * squared second (m/s^2).
853 * @param measurements list of body kinematics measurements taken at a given position with
854 * different unknown orientations and containing the standard deviations
855 * of accelerometer and gyroscope measurements.
856 * @param listener listener to be notified of events such as when estimation
857 * starts, ends or its progress significantly changes.
858 * @throws IllegalArgumentException if provided gravity norm value is negative or
859 * if provided quality scores length is
860 * smaller than 13 samples.
861 */
862 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
863 final double[] qualityScores, final Double groundTruthGravityNorm,
864 final List<StandardDeviationBodyKinematics> measurements,
865 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
866 super(groundTruthGravityNorm, measurements, listener);
867 internalSetQualityScores(qualityScores);
868 }
869
870 /**
871 * Constructor.
872 *
873 * @param qualityScores quality scores corresponding to each provided
874 * measurement. The larger the score value the better
875 * the quality of the sample.
876 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
877 * squared second (m/s^2).
878 * @param measurements list of body kinematics measurements taken at a given position with
879 * different unknown orientations and containing the standard deviations
880 * of accelerometer and gyroscope measurements.
881 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
882 * accelerometer and gyroscope.
883 * @throws IllegalArgumentException if provided gravity norm value is negative or
884 * if provided quality scores length is
885 * smaller than 10 or 13 samples.
886 */
887 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
888 final double[] qualityScores, final Double groundTruthGravityNorm,
889 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed) {
890 super(groundTruthGravityNorm, measurements, commonAxisUsed);
891 internalSetQualityScores(qualityScores);
892 }
893
894 /**
895 * Constructor.
896 *
897 * @param qualityScores quality scores corresponding to each provided
898 * measurement. The larger the score value the better
899 * the quality of the sample.
900 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
901 * squared second (m/s^2).
902 * @param measurements list of body kinematics measurements taken at a given position with
903 * different unknown orientations and containing the standard deviations
904 * of accelerometer and gyroscope measurements.
905 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
906 * accelerometer and gyroscope.
907 * @param listener listener to be notified of events such as when estimation
908 * starts, ends or its progress significantly changes.
909 * @throws IllegalArgumentException if provided gravity norm value is negative or
910 * if provided quality scores length is
911 * smaller than 10 or 13 samples.
912 */
913 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
914 final double[] qualityScores, final Double groundTruthGravityNorm,
915 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
916 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
917 super(groundTruthGravityNorm, measurements, commonAxisUsed, listener);
918 internalSetQualityScores(qualityScores);
919 }
920
921 /**
922 * Constructor.
923 *
924 * @param qualityScores quality scores corresponding to each provided
925 * measurement. The larger the score value the better
926 * the quality of the sample.
927 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
928 * squared second (m/s^2).
929 * @param measurements collection of body kinematics measurements with standard
930 * deviations taken at the same position with zero velocity
931 * and unknown different orientations.
932 * @param bias known accelerometer bias. This must have length 3 and is expressed
933 * in meters per squared second (m/s^2).
934 * @throws IllegalArgumentException if provided bias array does not have length 3 or
935 * if provided gravity norm value is negative or
936 * if provided quality scores length is
937 * smaller than 13 samples.
938 */
939 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
940 final double[] qualityScores, final Double groundTruthGravityNorm,
941 final List<StandardDeviationBodyKinematics> measurements, final double[] bias) {
942 super(groundTruthGravityNorm, measurements, bias);
943 internalSetQualityScores(qualityScores);
944 }
945
946 /**
947 * Constructor.
948 *
949 * @param qualityScores quality scores corresponding to each provided
950 * measurement. The larger the score value the better
951 * the quality of the sample.
952 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
953 * squared second (m/s^2).
954 * @param measurements collection of body kinematics measurements with standard
955 * deviations taken at the same position with zero velocity
956 * and unknown different orientations.
957 * @param bias known accelerometer bias. This must have length 3 and is expressed
958 * in meters per squared second (m/s^2).
959 * @param listener listener to handle events raised by this calibrator.
960 * @throws IllegalArgumentException if provided bias array does not have length 3 or
961 * if provided gravity norm value is negative or
962 * if provided quality scores length is
963 * smaller than 13 samples.
964 */
965 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
966 final double[] qualityScores, final Double groundTruthGravityNorm,
967 final List<StandardDeviationBodyKinematics> measurements, final double[] bias,
968 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
969 super(groundTruthGravityNorm, measurements, bias, listener);
970 internalSetQualityScores(qualityScores);
971 }
972
973 /**
974 * Constructor.
975 *
976 * @param qualityScores quality scores corresponding to each provided
977 * measurement. The larger the score value the better
978 * the quality of the sample.
979 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
980 * squared second (m/s^2).
981 * @param measurements collection of body kinematics measurements with standard
982 * deviations taken at the same position with zero velocity
983 * and unknown different orientations.
984 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
985 * accelerometer and gyroscope.
986 * @param bias known accelerometer bias. This must have length 3 and is expressed
987 * in meters per squared second (m/s^2).
988 * @throws IllegalArgumentException if provided bias array does not have length 3 or
989 * if provided gravity norm value is negative or
990 * if provided quality scores length is
991 * smaller than 10 or 13 samples.
992 */
993 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
994 final double[] qualityScores, final Double groundTruthGravityNorm,
995 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
996 final double[] bias) {
997 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
998 internalSetQualityScores(qualityScores);
999 }
1000
1001 /**
1002 * Constructor.
1003 *
1004 * @param qualityScores quality scores corresponding to each provided
1005 * measurement. The larger the score value the better
1006 * the quality of the sample.
1007 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1008 * squared second (m/s^2).
1009 * @param measurements collection of body kinematics measurements with standard
1010 * deviations taken at the same position with zero velocity
1011 * and unknown different orientations.
1012 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1013 * accelerometer and gyroscope.
1014 * @param bias known accelerometer bias. This must have length 3 and is
1015 * expressed in meters per squared second (m/s^2).
1016 * @param listener listener to handle events raised by this calibrator.
1017 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1018 * if provided gravity norm value is negative or
1019 * if provided quality scores length is
1020 * smaller than 10 or 13 samples.
1021 */
1022 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1023 final double[] qualityScores, final Double groundTruthGravityNorm,
1024 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1025 final double[] bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1026 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
1027 internalSetQualityScores(qualityScores);
1028 }
1029
1030 /**
1031 * Constructor.
1032 *
1033 * @param qualityScores quality scores corresponding to each provided
1034 * measurement. The larger the score value the better
1035 * the quality of the sample.
1036 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1037 * squared second (m/s^2).
1038 * @param measurements collection of body kinematics measurements with standard
1039 * deviations taken at the same position with zero velocity
1040 * and unknown different orientations.
1041 * @param bias known accelerometer bias.
1042 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1043 * if provided gravity norm value is negative or
1044 * if provided quality scores length is
1045 * smaller than 13 samples.
1046 */
1047 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1048 final double[] qualityScores, final Double groundTruthGravityNorm,
1049 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias) {
1050 super(groundTruthGravityNorm, measurements, bias);
1051 internalSetQualityScores(qualityScores);
1052 }
1053
1054 /**
1055 * Constructor.
1056 *
1057 * @param qualityScores quality scores corresponding to each provided
1058 * measurement. The larger the score value the better
1059 * the quality of the sample.
1060 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1061 * squared second (m/s^2).
1062 * @param measurements collection of body kinematics measurements with standard
1063 * deviations taken at the same position with zero velocity
1064 * and unknown different orientations.
1065 * @param bias known accelerometer bias.
1066 * @param listener listener to handle events raised by this calibrator.
1067 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1068 * if provided gravity norm value is negative or
1069 * if provided quality scores length is
1070 * smaller than 13 samples.
1071 */
1072 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1073 final double[] qualityScores, final Double groundTruthGravityNorm,
1074 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias,
1075 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1076 super(groundTruthGravityNorm, measurements, bias, listener);
1077 internalSetQualityScores(qualityScores);
1078 }
1079
1080 /**
1081 * Constructor.
1082 *
1083 * @param qualityScores quality scores corresponding to each provided
1084 * measurement. The larger the score value the better
1085 * the quality of the sample.
1086 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1087 * squared second (m/s^2).
1088 * @param measurements collection of body kinematics measurements with standard
1089 * deviations taken at the same position with zero velocity
1090 * and unknown different orientations.
1091 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1092 * accelerometer and gyroscope.
1093 * @param bias known accelerometer bias.
1094 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1095 * if provided gravity norm value is negative or
1096 * if provided quality scores length is
1097 * smaller than 10 or 13 samples.
1098 */
1099 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1100 final double[] qualityScores, final Double groundTruthGravityNorm,
1101 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1102 final Matrix bias) {
1103 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
1104 internalSetQualityScores(qualityScores);
1105 }
1106
1107 /**
1108 * Constructor.
1109 *
1110 * @param qualityScores quality scores corresponding to each provided
1111 * measurement. The larger the score value the better
1112 * the quality of the sample.
1113 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1114 * squared second (m/s^2).
1115 * @param measurements collection of body kinematics measurements with standard
1116 * deviations taken at the same position with zero velocity
1117 * and unknown different orientations.
1118 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1119 * accelerometer and gyroscope.
1120 * @param bias known accelerometer bias.
1121 * @param listener listener to handle events raised by this calibrator.
1122 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1123 * if provided gravity norm value is negative or
1124 * if provided quality scores length is
1125 * smaller than 10 or 13 samples.
1126 */
1127 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1128 final double[] qualityScores, final Double groundTruthGravityNorm,
1129 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1130 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1131 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
1132 internalSetQualityScores(qualityScores);
1133 }
1134
1135 /**
1136 * Constructor.
1137 *
1138 * @param qualityScores quality scores corresponding to each provided
1139 * measurement. The larger the score value the better
1140 * the quality of the sample.
1141 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1142 * squared second (m/s^2).
1143 * @param measurements collection of body kinematics measurements with standard
1144 * deviations taken at the same position with zero velocity
1145 * and unknown different orientations.
1146 * @param bias known accelerometer bias.
1147 * @param initialMa initial scale factors and cross coupling errors matrix.
1148 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1149 * scaling and coupling error matrix is not 3x3 or
1150 * if provided gravity norm value is negative or
1151 * if provided quality scores length is
1152 * smaller than 13 samples.
1153 */
1154 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1155 final double[] qualityScores, final Double groundTruthGravityNorm,
1156 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias, final Matrix initialMa) {
1157 super(groundTruthGravityNorm, measurements, bias, initialMa);
1158 internalSetQualityScores(qualityScores);
1159 }
1160
1161 /**
1162 * Constructor.
1163 *
1164 * @param qualityScores quality scores corresponding to each provided
1165 * measurement. The larger the score value the better
1166 * the quality of the sample.
1167 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1168 * squared second (m/s^2).
1169 * @param measurements collection of body kinematics measurements with standard
1170 * deviations taken at the same position with zero velocity
1171 * and unknown different orientations.
1172 * @param bias known accelerometer bias.
1173 * @param initialMa initial scale factors and cross coupling errors matrix.
1174 * @param listener listener to handle events raised by this calibrator.
1175 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1176 * scaling and coupling error matrix is not 3x3 or
1177 * if provided gravity norm value is negative or
1178 * if provided quality scores length is
1179 * smaller than 13 samples.
1180 */
1181 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1182 final double[] qualityScores, final Double groundTruthGravityNorm,
1183 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias, final Matrix initialMa,
1184 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1185 super(groundTruthGravityNorm, measurements, bias, initialMa, listener);
1186 internalSetQualityScores(qualityScores);
1187 }
1188
1189 /**
1190 * Constructor.
1191 *
1192 * @param qualityScores quality scores corresponding to each provided
1193 * measurement. The larger the score value the better
1194 * the quality of the sample.
1195 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1196 * squared second (m/s^2).
1197 * @param measurements collection of body kinematics measurements with standard
1198 * deviations taken at the same position with zero velocity
1199 * and unknown different orientations.
1200 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1201 * accelerometer and gyroscope.
1202 * @param bias known accelerometer bias.
1203 * @param initialMa initial scale factors and cross coupling errors matrix.
1204 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1205 * scaling and coupling error matrix is not 3x3 or
1206 * if provided gravity norm value is negative or
1207 * if provided quality scores length is
1208 * smaller than 10 or 13 samples.
1209 */
1210 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1211 final double[] qualityScores, final Double groundTruthGravityNorm,
1212 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1213 final Matrix initialMa) {
1214 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa);
1215 internalSetQualityScores(qualityScores);
1216 }
1217
1218 /**
1219 * Constructor.
1220 *
1221 * @param qualityScores quality scores corresponding to each provided
1222 * measurement. The larger the score value the better
1223 * the quality of the sample.
1224 * @param groundTruthGravityNorm ground truth gravity norm expressed in meters per
1225 * squared second (m/s^2).
1226 * @param measurements collection of body kinematics measurements with standard
1227 * deviations taken at the same position with zero velocity
1228 * and unknown different orientations.
1229 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1230 * accelerometer and gyroscope.
1231 * @param bias known accelerometer bias.
1232 * @param initialMa initial scale factors and cross coupling errors matrix.
1233 * @param listener listener to handle events raised by this calibrator.
1234 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1235 * scaling and coupling error matrix is not 3x3 or
1236 * if provided gravity norm value is negative or
1237 * if provided quality scores length is
1238 * smaller than 10 or 13 samples.
1239 */
1240 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1241 final double[] qualityScores, final Double groundTruthGravityNorm,
1242 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1243 final Matrix initialMa, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1244 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa, listener);
1245 internalSetQualityScores(qualityScores);
1246 }
1247
1248 /**
1249 * Constructor.
1250 *
1251 * @param qualityScores quality scores corresponding to each provided
1252 * measurement. The larger the score value the better
1253 * the quality of the sample.
1254 * @param groundTruthGravityNorm ground truth gravity norm.
1255 * @throws IllegalArgumentException if provided gravity norm value is negative or
1256 * if provided quality scores length is smaller
1257 * than 13 samples.
1258 */
1259 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1260 final double[] qualityScores, final Acceleration groundTruthGravityNorm) {
1261 super(groundTruthGravityNorm);
1262 internalSetQualityScores(qualityScores);
1263 }
1264
1265 /**
1266 * Constructor.
1267 *
1268 * @param qualityScores quality scores corresponding to each provided
1269 * measurement. The larger the score value the better
1270 * the quality of the sample.
1271 * @param groundTruthGravityNorm ground truth gravity norm.
1272 * @param measurements list of body kinematics measurements taken at a given position with
1273 * different unknown orientations and containing the standard deviations
1274 * of accelerometer and gyroscope measurements.
1275 * @throws IllegalArgumentException if provided gravity norm value is negative or
1276 * if provided quality scores length is smaller
1277 * than 13 samples.
1278 */
1279 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1280 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1281 final List<StandardDeviationBodyKinematics> measurements) {
1282 super(groundTruthGravityNorm, measurements);
1283 internalSetQualityScores(qualityScores);
1284 }
1285
1286 /**
1287 * Constructor.
1288 *
1289 * @param qualityScores quality scores corresponding to each provided
1290 * measurement. The larger the score value the better
1291 * the quality of the sample.
1292 * @param groundTruthGravityNorm ground truth gravity norm.
1293 * @param measurements list of body kinematics measurements taken at a given position with
1294 * different unknown orientations and containing the standard deviations
1295 * of accelerometer and gyroscope measurements.
1296 * @param listener listener to be notified of events such as when estimation
1297 * starts, ends or its progress significantly changes.
1298 * @throws IllegalArgumentException if provided gravity norm value is negative or
1299 * if provided quality scores length is smaller
1300 * than 13 samples.
1301 */
1302 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1303 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1304 final List<StandardDeviationBodyKinematics> measurements,
1305 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1306 super(groundTruthGravityNorm, measurements, listener);
1307 internalSetQualityScores(qualityScores);
1308 }
1309
1310 /**
1311 * Constructor.
1312 *
1313 * @param qualityScores quality scores corresponding to each provided
1314 * measurement. The larger the score value the better
1315 * the quality of the sample.
1316 * @param groundTruthGravityNorm ground truth gravity norm.
1317 * @param measurements list of body kinematics measurements taken at a given position with
1318 * different unknown orientations and containing the standard deviations
1319 * of accelerometer and gyroscope measurements.
1320 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1321 * accelerometer and gyroscope.
1322 * @throws IllegalArgumentException if provided gravity norm value is negative or
1323 * if provided quality scores length is smaller
1324 * than 10 or 13 samples.
1325 */
1326 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1327 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1328 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed) {
1329 super(groundTruthGravityNorm, measurements, commonAxisUsed);
1330 internalSetQualityScores(qualityScores);
1331 }
1332
1333 /**
1334 * Constructor.
1335 *
1336 * @param qualityScores quality scores corresponding to each provided
1337 * measurement. The larger the score value the better
1338 * the quality of the sample.
1339 * @param groundTruthGravityNorm ground truth gravity norm.
1340 * @param measurements list of body kinematics measurements taken at a given position with
1341 * different unknown orientations and containing the standard deviations
1342 * of accelerometer and gyroscope measurements.
1343 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1344 * accelerometer and gyroscope.
1345 * @param listener listener to be notified of events such as when estimation
1346 * starts, ends or its progress significantly changes.
1347 * @throws IllegalArgumentException if provided gravity norm value is negative or
1348 * if provided quality scores length is smaller
1349 * than 10 or 13 samples.
1350 */
1351 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1352 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1353 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1354 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1355 super(groundTruthGravityNorm, measurements, commonAxisUsed, listener);
1356 internalSetQualityScores(qualityScores);
1357 }
1358
1359 /**
1360 * Constructor.
1361 *
1362 * @param qualityScores quality scores corresponding to each provided
1363 * measurement. The larger the score value the better
1364 * the quality of the sample.
1365 * @param groundTruthGravityNorm ground truth gravity norm.
1366 * @param measurements collection of body kinematics measurements with standard
1367 * deviations taken at the same position with zero velocity
1368 * and unknown different orientations.
1369 * @param bias known accelerometer bias. This must have length 3 and is expressed
1370 * in meters per squared second (m/s^2).
1371 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1372 * if provided gravity norm value is negative or
1373 * if provided quality scores length is smaller
1374 * than 13 samples.
1375 */
1376 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1377 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1378 final List<StandardDeviationBodyKinematics> measurements, final double[] bias) {
1379 super(groundTruthGravityNorm, measurements, bias);
1380 internalSetQualityScores(qualityScores);
1381 }
1382
1383 /**
1384 * Constructor.
1385 *
1386 * @param qualityScores quality scores corresponding to each provided
1387 * measurement. The larger the score value the better
1388 * the quality of the sample.
1389 * @param groundTruthGravityNorm ground truth gravity norm.
1390 * @param measurements collection of body kinematics measurements with standard
1391 * deviations taken at the same position with zero velocity
1392 * and unknown different orientations.
1393 * @param bias known accelerometer bias. This must have length 3 and is expressed
1394 * in meters per squared second (m/s^2).
1395 * @param listener listener to handle events raised by this calibrator.
1396 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1397 * if provided gravity norm value is negative or
1398 * if provided quality scores length is smaller
1399 * than 13 samples.
1400 */
1401 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1402 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1403 final List<StandardDeviationBodyKinematics> measurements, final double[] bias,
1404 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1405 super(groundTruthGravityNorm, measurements, bias, listener);
1406 internalSetQualityScores(qualityScores);
1407 }
1408
1409 /**
1410 * Constructor.
1411 *
1412 * @param qualityScores quality scores corresponding to each provided
1413 * measurement. The larger the score value the better
1414 * the quality of the sample.
1415 * @param groundTruthGravityNorm ground truth gravity norm.
1416 * @param measurements collection of body kinematics measurements with standard
1417 * deviations taken at the same position with zero velocity
1418 * and unknown different orientations.
1419 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1420 * accelerometer and gyroscope.
1421 * @param bias known accelerometer bias. This must have length 3 and is expressed
1422 * in meters per squared second (m/s^2).
1423 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1424 * if provided gravity norm value is negative or
1425 * if provided quality scores length is smaller
1426 * than 10 or 13 samples.
1427 */
1428 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1429 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1430 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1431 final double[] bias) {
1432 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias);
1433 internalSetQualityScores(qualityScores);
1434 }
1435
1436 /**
1437 * Constructor.
1438 *
1439 * @param qualityScores quality scores corresponding to each provided
1440 * measurement. The larger the score value the better
1441 * the quality of the sample.
1442 * @param groundTruthGravityNorm ground truth gravity norm.
1443 * @param measurements collection of body kinematics measurements with standard
1444 * deviations taken at the same position with zero velocity
1445 * and unknown different orientations.
1446 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1447 * accelerometer and gyroscope.
1448 * @param bias known accelerometer bias. This must have length 3 and is expressed
1449 * in meters per squared second (m/s^2).
1450 * @param listener listener to handle events raised by this calibrator.
1451 * @throws IllegalArgumentException if provided bias array does not have length 3 or
1452 * if provided gravity norm value is negative or
1453 * if provided quality scores length is smaller
1454 * than 10 or 13 samples.
1455 */
1456 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1457 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1458 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1459 final double[] bias, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1460 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
1461 internalSetQualityScores(qualityScores);
1462 }
1463
1464 /**
1465 * Constructor.
1466 *
1467 * @param qualityScores quality scores corresponding to each provided
1468 * measurement. The larger the score value the better
1469 * the quality of the sample.
1470 * @param groundTruthGravityNorm ground truth gravity norm.
1471 * @param measurements collection of body kinematics measurements with standard
1472 * deviations taken at the same position with zero velocity
1473 * and unknown different orientations.
1474 * @param bias known accelerometer bias.
1475 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1476 * if provided gravity norm value is negative or
1477 * if provided quality scores length is smaller
1478 * than 13 samples.
1479 */
1480 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1481 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1482 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias) {
1483 super(groundTruthGravityNorm, measurements, bias);
1484 internalSetQualityScores(qualityScores);
1485 }
1486
1487 /**
1488 * Constructor.
1489 *
1490 * @param qualityScores quality scores corresponding to each provided
1491 * measurement. The larger the score value the better
1492 * the quality of the sample.
1493 * @param groundTruthGravityNorm ground truth gravity norm.
1494 * @param measurements collection of body kinematics measurements with standard
1495 * deviations taken at the same position with zero velocity
1496 * and unknown different orientations.
1497 * @param initialBias initial bias to find a solution.
1498 * @param listener listener to handle events raised by this calibrator.
1499 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1500 * if provided gravity norm value is negative or
1501 * if provided quality scores length is smaller
1502 * than 13 samples.
1503 */
1504 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1505 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1506 final List<StandardDeviationBodyKinematics> measurements, final Matrix initialBias,
1507 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1508 super(groundTruthGravityNorm, measurements, initialBias, listener);
1509 internalSetQualityScores(qualityScores);
1510 }
1511
1512 /**
1513 * Constructor.
1514 *
1515 * @param qualityScores quality scores corresponding to each provided
1516 * measurement. The larger the score value the better
1517 * the quality of the sample.
1518 * @param groundTruthGravityNorm ground truth gravity norm.
1519 * @param measurements collection of body kinematics measurements with standard
1520 * deviations taken at the same position with zero velocity
1521 * and unknown different orientations.
1522 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1523 * accelerometer and gyroscope.
1524 * @param initialBias initial bias to find a solution.
1525 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1526 * if provided gravity norm value is negative or
1527 * if provided quality scores length is smaller
1528 * than 10 or 13 samples.
1529 */
1530 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1531 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1532 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed,
1533 final Matrix initialBias) {
1534 super(groundTruthGravityNorm, measurements, commonAxisUsed, initialBias);
1535 internalSetQualityScores(qualityScores);
1536 }
1537
1538 /**
1539 * Constructor.
1540 *
1541 * @param qualityScores quality scores corresponding to each provided
1542 * measurement. The larger the score value the better
1543 * the quality of the sample.
1544 * @param groundTruthGravityNorm ground truth gravity norm.
1545 * @param measurements collection of body kinematics measurements with standard
1546 * deviations taken at the same position with zero velocity
1547 * and unknown different orientations.
1548 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1549 * accelerometer and gyroscope.
1550 * @param bias known accelerometer bias.
1551 * @param listener listener to handle events raised by this calibrator.
1552 * @throws IllegalArgumentException if provided bias matrix is not 3x1 or
1553 * if provided gravity norm value is negative or
1554 * if provided quality scores length is smaller
1555 * than 10 or 13 samples.
1556 */
1557 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1558 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1559 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1560 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1561 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, listener);
1562 internalSetQualityScores(qualityScores);
1563 }
1564
1565 /**
1566 * Constructor.
1567 *
1568 * @param qualityScores quality scores corresponding to each provided
1569 * measurement. The larger the score value the better
1570 * the quality of the sample.
1571 * @param groundTruthGravityNorm ground truth gravity norm.
1572 * @param measurements collection of body kinematics measurements with standard
1573 * deviations taken at the same position with zero velocity
1574 * and unknown different orientations.
1575 * @param bias known accelerometer bias.
1576 * @param initialMa initial scale factors and cross coupling errors matrix.
1577 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1578 * scaling and coupling error matrix is not 3x3 or
1579 * if provided gravity norm value is negative or
1580 * if provided quality scores length is smaller
1581 * than 13 samples.
1582 */
1583 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1584 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1585 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias, final Matrix initialMa) {
1586 super(groundTruthGravityNorm, measurements, bias, initialMa);
1587 internalSetQualityScores(qualityScores);
1588 }
1589
1590 /**
1591 * Constructor.
1592 *
1593 * @param qualityScores quality scores corresponding to each provided
1594 * measurement. The larger the score value the better
1595 * the quality of the sample.
1596 * @param groundTruthGravityNorm ground truth gravity norm.
1597 * @param measurements collection of body kinematics measurements with standard
1598 * deviations taken at the same position with zero velocity
1599 * and unknown different orientations.
1600 * @param bias known accelerometer bias.
1601 * @param initialMa initial scale factors and cross coupling errors matrix.
1602 * @param listener listener to handle events raised by this calibrator.
1603 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1604 * scaling and coupling error matrix is not 3x3 or
1605 * if provided gravity norm value is negative or
1606 * if provided quality scores length is smaller
1607 * than 13 samples.
1608 */
1609 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1610 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1611 final List<StandardDeviationBodyKinematics> measurements, final Matrix bias, final Matrix initialMa,
1612 final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1613 super(groundTruthGravityNorm, measurements, bias, initialMa, listener);
1614 internalSetQualityScores(qualityScores);
1615 }
1616
1617 /**
1618 * Constructor.
1619 *
1620 * @param qualityScores quality scores corresponding to each provided
1621 * measurement. The larger the score value the better
1622 * the quality of the sample.
1623 * @param groundTruthGravityNorm ground truth gravity norm.
1624 * @param measurements collection of body kinematics measurements with standard
1625 * deviations taken at the same position with zero velocity
1626 * and unknown different orientations.
1627 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1628 * accelerometer and gyroscope.
1629 * @param bias known accelerometer bias.
1630 * @param initialMa initial scale factors and cross coupling errors matrix.
1631 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1632 * scaling and coupling error matrix is not 3x3 or
1633 * if provided gravity norm value is negative or
1634 * if provided quality scores length is smaller
1635 * than 10 or 13 samples.
1636 */
1637 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1638 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1639 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1640 final Matrix initialMa) {
1641 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa);
1642 internalSetQualityScores(qualityScores);
1643 }
1644
1645 /**
1646 * Constructor.
1647 *
1648 * @param qualityScores quality scores corresponding to each provided
1649 * measurement. The larger the score value the better
1650 * the quality of the sample.
1651 * @param groundTruthGravityNorm ground truth gravity norm.
1652 * @param measurements collection of body kinematics measurements with standard
1653 * deviations taken at the same position with zero velocity
1654 * and unknown different orientations.
1655 * @param commonAxisUsed indicates whether z-axis is assumed to be common for
1656 * accelerometer and gyroscope.
1657 * @param bias known accelerometer bias.
1658 * @param initialMa initial scale factors and cross coupling errors matrix.
1659 * @param listener listener to handle events raised by this calibrator.
1660 * @throws IllegalArgumentException if either provided bias matrix is not 3x1 or
1661 * scaling and coupling error matrix is not 3x3 or
1662 * if provided gravity norm value is negative or
1663 * if provided quality scores length is smaller
1664 * than 10 or 13 samples.
1665 */
1666 public PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator(
1667 final double[] qualityScores, final Acceleration groundTruthGravityNorm,
1668 final List<StandardDeviationBodyKinematics> measurements, final boolean commonAxisUsed, final Matrix bias,
1669 final Matrix initialMa, final RobustKnownBiasAndGravityNormAccelerometerCalibratorListener listener) {
1670 super(groundTruthGravityNorm, measurements, commonAxisUsed, bias, initialMa, listener);
1671 internalSetQualityScores(qualityScores);
1672 }
1673
1674 /**
1675 * Gets threshold to determine whether samples are inliers or not when testing possible solutions.
1676 * The threshold refers to the amount of error on norm between measured specific forces and the
1677 * ones generated with estimated calibration parameters provided for each sample.
1678 *
1679 * @return threshold to determine whether samples are inliers or not.
1680 */
1681 public double getThreshold() {
1682 return threshold;
1683 }
1684
1685 /**
1686 * Sets threshold to determine whether samples are inliers or not when testing possible solutions.
1687 * The threshold refers to the amount of error on norm between measured specific forces and the
1688 * ones generated with estimated calibration parameters provided for each sample.
1689 *
1690 * @param threshold threshold to determine whether samples are inliers or not.
1691 * @throws IllegalArgumentException if provided value is equal or less than zero.
1692 * @throws LockedException if calibrator is currently running.
1693 */
1694 public void setThreshold(final double threshold) throws LockedException {
1695 if (running) {
1696 throw new LockedException();
1697 }
1698 if (threshold <= MIN_THRESHOLD) {
1699 throw new IllegalArgumentException();
1700 }
1701 this.threshold = threshold;
1702 }
1703
1704 /**
1705 * Returns quality scores corresponding to each provided sample.
1706 * The larger the score value the better the quality of the sample.
1707 *
1708 * @return quality scores corresponding to each sample.
1709 */
1710 @Override
1711 public double[] getQualityScores() {
1712 return qualityScores;
1713 }
1714
1715 /**
1716 * Sets quality scores corresponding to each provided sample.
1717 * The larger the score value the better the quality of the sample.
1718 *
1719 * @param qualityScores quality scores corresponding to each sample.
1720 * @throws IllegalArgumentException if provided quality scores length
1721 * is smaller than minimum required samples
1722 * (10 or 13).
1723 * @throws LockedException if calibrator is currently running.
1724 */
1725 @Override
1726 public void setQualityScores(final double[] qualityScores) throws LockedException {
1727 if (running) {
1728 throw new LockedException();
1729 }
1730 internalSetQualityScores(qualityScores);
1731 }
1732
1733 /**
1734 * Indicates whether calibrator is ready to find a solution.
1735 *
1736 * @return true if calibrator is ready, false otherwise.
1737 */
1738 @Override
1739 public boolean isReady() {
1740 return super.isReady() && qualityScores != null && qualityScores.length == measurements.size();
1741 }
1742
1743 /**
1744 * Indicates whether inliers must be computed and kept.
1745 *
1746 * @return true if inliers must be computed and kept, false if inliers
1747 * only need to be computed but not kept.
1748 */
1749 public boolean isComputeAndKeepInliersEnabled() {
1750 return computeAndKeepInliers;
1751 }
1752
1753 /**
1754 * Specifies whether inliers must be computed and kept.
1755 *
1756 * @param computeAndKeepInliers true if inliers must be computed and kept,
1757 * false if inliers only need to be computed but not kept.
1758 * @throws LockedException if calibrator is currently running.
1759 */
1760 public void setComputeAndKeepInliersEnabled(final boolean computeAndKeepInliers) throws LockedException {
1761 if (running) {
1762 throw new LockedException();
1763 }
1764 this.computeAndKeepInliers = computeAndKeepInliers;
1765 }
1766
1767 /**
1768 * Indicates whether residuals must be computed and kept.
1769 *
1770 * @return true if residuals must be computed and kept, false if residuals
1771 * only need to be computed but not kept.
1772 */
1773 public boolean isComputeAndKeepResiduals() {
1774 return computeAndKeepResiduals;
1775 }
1776
1777 /**
1778 * Specifies whether residuals must be computed and kept.
1779 *
1780 * @param computeAndKeepResiduals true if residuals must be computed and kept,
1781 * false if residuals only need to be computed but not kept.
1782 * @throws LockedException if calibrator is currently running.
1783 */
1784 public void setComputeAndKeepResidualsEnabled(final boolean computeAndKeepResiduals) throws LockedException {
1785 if (running) {
1786 throw new LockedException();
1787 }
1788 this.computeAndKeepResiduals = computeAndKeepResiduals;
1789 }
1790
1791 /**
1792 * Estimates accelerometer calibration parameters scale factors
1793 * and cross-coupling errors.
1794 *
1795 * @throws LockedException if calibrator is currently running.
1796 * @throws NotReadyException if calibrator is not ready.
1797 * @throws CalibrationException if estimation fails for numerical reasons.
1798 */
1799 @Override
1800 public void calibrate() throws LockedException, NotReadyException, CalibrationException {
1801 if (running) {
1802 throw new LockedException();
1803 }
1804 if (!isReady()) {
1805 throw new NotReadyException();
1806 }
1807
1808 final var innerEstimator = new PROSACRobustEstimator<>(new PROSACRobustEstimatorListener<PreliminaryResult>() {
1809 @Override
1810 public double[] getQualityScores() {
1811 return qualityScores;
1812 }
1813
1814 @Override
1815 public double getThreshold() {
1816 return threshold;
1817 }
1818
1819 @Override
1820 public int getTotalSamples() {
1821 return measurements.size();
1822 }
1823
1824 @Override
1825 public int getSubsetSize() {
1826 return preliminarySubsetSize;
1827 }
1828
1829 @Override
1830 public void estimatePreliminarSolutions(
1831 final int[] samplesIndices, final List<PreliminaryResult> solutions) {
1832 computePreliminarySolutions(samplesIndices, solutions);
1833 }
1834
1835 @Override
1836 public double computeResidual(final PreliminaryResult currentEstimation, final int i) {
1837 return computeError(measurements.get(i), currentEstimation);
1838 }
1839
1840 @Override
1841 public boolean isReady() {
1842 return PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator.this.isReady();
1843 }
1844
1845 @Override
1846 public void onEstimateStart(final RobustEstimator<PreliminaryResult> estimator) {
1847 // no action needed
1848 }
1849
1850 @Override
1851 public void onEstimateEnd(final RobustEstimator<PreliminaryResult> estimator) {
1852 // no action needed
1853 }
1854
1855 @Override
1856 public void onEstimateNextIteration(
1857 final RobustEstimator<PreliminaryResult> estimator, final int iteration) {
1858 if (listener != null) {
1859 listener.onCalibrateNextIteration(
1860 PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator.this, iteration);
1861 }
1862 }
1863
1864 @Override
1865 public void onEstimateProgressChange(
1866 final RobustEstimator<PreliminaryResult> estimator, final float progress) {
1867 if (listener != null) {
1868 listener.onCalibrateProgressChange(
1869 PROSACRobustKnownBiasAndGravityNormAccelerometerCalibrator.this, progress);
1870 }
1871 }
1872 });
1873
1874 try {
1875 running = true;
1876
1877 if (listener != null) {
1878 listener.onCalibrateStart(this);
1879 }
1880
1881 inliersData = null;
1882 innerEstimator.setComputeAndKeepInliersEnabled(computeAndKeepInliers || refineResult);
1883 innerEstimator.setComputeAndKeepResidualsEnabled(computeAndKeepResiduals || refineResult);
1884 innerEstimator.setConfidence(confidence);
1885 innerEstimator.setMaxIterations(maxIterations);
1886 innerEstimator.setProgressDelta(progressDelta);
1887 final var preliminaryResult = innerEstimator.estimate();
1888 inliersData = innerEstimator.getInliersData();
1889
1890 attemptRefine(preliminaryResult);
1891
1892 if (listener != null) {
1893 listener.onCalibrateEnd(this);
1894 }
1895
1896 } catch (final com.irurueta.numerical.LockedException e) {
1897 throw new LockedException(e);
1898 } catch (final com.irurueta.numerical.NotReadyException e) {
1899 throw new NotReadyException(e);
1900 } catch (final RobustEstimatorException e) {
1901 throw new CalibrationException(e);
1902 } finally {
1903 running = false;
1904 }
1905 }
1906
1907 /**
1908 * Returns method being used for robust estimation.
1909 *
1910 * @return method being used for robust estimation.
1911 */
1912 @Override
1913 public RobustEstimatorMethod getMethod() {
1914 return RobustEstimatorMethod.PROSAC;
1915 }
1916
1917 /**
1918 * Indicates whether this calibrator requires quality scores for each
1919 * measurement or not.
1920 *
1921 * @return true if quality scores are required, false otherwise.
1922 */
1923 @Override
1924 public boolean isQualityScoresRequired() {
1925 return true;
1926 }
1927
1928 /**
1929 * Sets quality scores corresponding to each provided sample.
1930 * This method is used internally and does not check whether instance is
1931 * locked or not.
1932 *
1933 * @param qualityScores quality scores to be set.
1934 * @throws IllegalArgumentException if provided quality scores length
1935 * is smaller than the minimum required
1936 * number of samples (10 or 13).
1937 */
1938 private void internalSetQualityScores(final double[] qualityScores) {
1939 if (qualityScores == null || qualityScores.length < getMinimumRequiredMeasurements()) {
1940 throw new IllegalArgumentException();
1941 }
1942
1943 this.qualityScores = qualityScores;
1944 }
1945 }