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 SRetrieves data for this optimizer.static final floatDefault 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 floatMaximum allowed value for progress delta.static final floatMinimum allowed value for progress delta.protected doubleMinimum Mean Square Error that has been found.protected doubleOptimal threshold factor that has been found.protected floatPreviously notified progress of optimization.protected floatCurrent progress of optimization.protected floatAmount of progress variation before notifying a progress change during optimization.protected booleanIndicates whether this optimizer is running or not. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedIntervalDetectorThresholdFactorOptimizer(S dataSource) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks 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.doubleGets minimum Mean Square Error that has been found for calibration.doubleGets the optimal threshold factor that has been found.floatReturns the amount of progress variation before notifying a progress change during optimization.protected voidInitializes progress values.booleanisReady()Indicates whether this optimizer is ready to start optimization.booleanIndicates whether this optimizer is busy optimizing a threshold factor.abstract doubleoptimize()Optimizes the threshold factor for a static interval detector or measurement generator to minimize MSE (Minimum Squared Error) of estimated calibration parameters.voidsetDataSource(S dataSource) Sets an instance in charge of retrieving data for this optimizer.voidSets a listener that notifies events generated by this optimizer.voidsetProgressDelta(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.
-