Class IntervalDetectorThresholdFactorOptimizer<T,S extends IntervalDetectorThresholdFactorOptimizerDataSource<T>>
java.lang.Object
com.irurueta.navigation.inertial.calibration.intervals.thresholdfactor.IntervalDetectorThresholdFactorOptimizer<T,S>
- Type Parameters:
T
- type of data to be used as input for this optimizer.S
- type of data source for this optimizer.
- Direct Known Subclasses:
AccelerometerAndGyroscopeIntervalDetectorThresholdFactorOptimizer
,AccelerometerGyroscopeAndMagnetometerIntervalDetectorThresholdFactorOptimizer
,AccelerometerIntervalDetectorThresholdFactorOptimizer
,GyroscopeIntervalDetectorThresholdFactorOptimizer
,MagnetometerIntervalDetectorThresholdFactorOptimizer
public abstract class IntervalDetectorThresholdFactorOptimizer<T,S extends IntervalDetectorThresholdFactorOptimizerDataSource<T>>
extends Object
Optimizes the threshold factor for interval detection of accelerometer data based
on results of accelerometers, gyroscopes or magnetometers calibration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected S
Retrieves data for this optimizer.static final float
Default amount of progress variation before notifying a change in optimization progress.protected IntervalDetectorThresholdFactorOptimizerListener<T,
S> Listener that notifies events generated by this optimizer.static final float
Maximum allowed value for progress delta.static final float
Minimum allowed value for progress delta.protected double
Minimum Mean Square Error that has been found.protected double
Optimal threshold factor that has been found.protected float
Previously notified progress of optimization.protected float
Current progress of optimization.protected float
Amount of progress variation before notifying a progress change during optimization.protected boolean
Indicates whether this optimizer is running or not. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor.protected
IntervalDetectorThresholdFactorOptimizer
(S dataSource) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks current progress and notifies if progress has changed significantly.Gets instance in charge of retrieving data for this optimizer.Gets a listener that notifies events generated by this optimizer.double
Gets minimum Mean Square Error that has been found for calibration.double
Gets the optimal threshold factor that has been found.float
Returns the amount of progress variation before notifying a progress change during optimization.protected void
Initializes progress values.boolean
isReady()
Indicates whether this optimizer is ready to start optimization.boolean
Indicates whether this optimizer is busy optimizing a threshold factor.abstract double
optimize()
Optimizes the threshold factor for a static interval detector or measurement generator to minimize MSE (Minimum Squared Error) of estimated calibration parameters.void
setDataSource
(S dataSource) Sets an instance in charge of retrieving data for this optimizer.void
Sets a listener that notifies events generated by this optimizer.void
setProgressDelta
(float progressDelta) Sets the amount of progress variation before notifying a progress change during optimization.
-
Field Details
-
DEFAULT_PROGRESS_DELTA
public static final float DEFAULT_PROGRESS_DELTADefault amount of progress variation before notifying a change in optimization progress. By default, this is set to 5%.- See Also:
-
MIN_PROGRESS_DELTA
public static final float MIN_PROGRESS_DELTAMinimum allowed value for progress delta.- See Also:
-
MAX_PROGRESS_DELTA
public static final float MAX_PROGRESS_DELTAMaximum allowed value for progress delta.- See Also:
-
dataSource
Retrieves data for this optimizer. -
running
protected boolean runningIndicates whether this optimizer is running or not. -
minMse
protected double minMseMinimum Mean Square Error that has been found. -
optimalThresholdFactor
protected double optimalThresholdFactorOptimal threshold factor that has been found. -
listener
protected IntervalDetectorThresholdFactorOptimizerListener<T,S extends IntervalDetectorThresholdFactorOptimizerDataSource<T>> listenerListener that notifies events generated by this optimizer. -
progressDelta
protected float progressDeltaAmount of progress variation before notifying a progress change during optimization. -
progress
protected float progressCurrent progress of optimization. -
previousProgress
protected float previousProgressPreviously notified progress of optimization.
-
-
Constructor Details
-
IntervalDetectorThresholdFactorOptimizer
protected IntervalDetectorThresholdFactorOptimizer()Constructor. -
IntervalDetectorThresholdFactorOptimizer
Constructor.- Parameters:
dataSource
- instance in charge of retrieving data for this optimizer.
-
-
Method Details
-
getDataSource
Gets instance in charge of retrieving data for this optimizer.- Returns:
- instance in charge of retrieving data for this optimizer.
-
setDataSource
Sets an instance in charge of retrieving data for this optimizer.- Parameters:
dataSource
- instance in charge of retrieving data for this optimizer.- Throws:
com.irurueta.navigation.LockedException
- if optimizer is already running.
-
getListener
Gets a listener that notifies events generated by this optimizer.- Returns:
- listener that notifies events generated by this optimizer.
-
getProgressDelta
public float getProgressDelta()Returns the amount of progress variation before notifying a progress change during optimization.- Returns:
- amount of progress variation before notifying a progress change during optimization.
-
setProgressDelta
public void setProgressDelta(float progressDelta) throws com.irurueta.navigation.LockedException Sets the amount of progress variation before notifying a progress change during optimization.- Parameters:
progressDelta
- amount of progress variation before notifying a progress change during optimization.- Throws:
IllegalArgumentException
- if the progress delta is less than zero or greater than 1.com.irurueta.navigation.LockedException
- if optimizer is currently running.
-
isRunning
public boolean isRunning()Indicates whether this optimizer is busy optimizing a threshold factor.- Returns:
- true if optimizer is busy, false otherwise.
-
isReady
public boolean isReady()Indicates whether this optimizer is ready to start optimization.- Returns:
- true if this optimizer is ready, false otherwise.
-
getMinMse
public double getMinMse()Gets minimum Mean Square Error that has been found for calibration.- Returns:
- minimum Mean Square Error that has been found.
-
getOptimalThresholdFactor
public double getOptimalThresholdFactor()Gets the optimal threshold factor that has been found.- Returns:
- optimal threshold factor that has been found.
-
optimize
public abstract double optimize() throws com.irurueta.navigation.NotReadyException, com.irurueta.navigation.LockedException, IntervalDetectorThresholdFactorOptimizerExceptionOptimizes the threshold factor for a static interval detector or measurement generator to minimize MSE (Minimum Squared Error) of estimated calibration parameters.- Returns:
- optimized threshold factor.
- Throws:
com.irurueta.navigation.NotReadyException
- if this optimizer is not ready to start optimization.com.irurueta.navigation.LockedException
- if optimizer is already running.IntervalDetectorThresholdFactorOptimizerException
- if optimization fails for some reason.
-
checkAndNotifyProgress
protected void checkAndNotifyProgress()Checks current progress and notifies if progress has changed significantly. -
initProgress
protected void initProgress()Initializes progress values.
-