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