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