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