Class TimeIntervalEstimator
java.lang.Object
com.irurueta.navigation.inertial.calibration.TimeIntervalEstimator
Estimates average time interval between processed samples.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
Estimated average time interval between body kinematics samples expressed in seconds (s).static final int
Default total samples to be processed.private Double
Last provided timestamp expressed in seconds (s).private TimeIntervalEstimatorListener
Listener to handle events raised by this estimator.private int
Number of processed timestamp samples.private int
Number of processed timestamp samples plus one.private boolean
Indicates that estimator is running.private double
Estimated variance of time interval between body kinematics samples expressed in squared seconds (s^2).private int
Total samples to be processed to finish estimation. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.TimeIntervalEstimator
(int totalSamples) Constructor.TimeIntervalEstimator
(int totalSamples, TimeIntervalEstimatorListener listener) Constructor.Copy constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTimestamp
(double timestamp) Adds a timestamp value to current estimation.boolean
addTimestamp
(com.irurueta.units.Time timestamp) Adds a timestamp value to current estimation.void
copyFrom
(TimeIntervalEstimator input) Copies instance from provided one into this one.void
copyTo
(TimeIntervalEstimator output) Copies current instance into provided instance.double
Gets estimated average time interval between body kinematics samples expressed in seconds (s).com.irurueta.units.Time
Gets estimated average time interval between body kinematics samples.void
getAverageTimeIntervalAsTime
(com.irurueta.units.Time result) Gets estimated average time interval between body kinematics samples.Gets last provided timestamp expressed in seconds or null if none has been provided yet.com.irurueta.units.Time
Gets last provided timestamp or null if none has been provided yet.boolean
getLastTimestampAsTime
(com.irurueta.units.Time result) Gets last provided timestamp.Gets listener to handle events raised by this estimator.int
Gets number of samples that have been processed so far.double
Gets estimate standard deviation of time interval between body kinematics samples expressed in seconds (s).com.irurueta.units.Time
Gets estimate standard deviation of time interval between body kinematics samples.void
getTimeIntervalStandardDeviationAsTime
(com.irurueta.units.Time result) Gets estimate standard deviation of time interval between body kinematics samples.double
Gets estimated variance of time interval between body kinematics samples expressed in squared seconds (s^2).int
Gets total samples to be processed to finish estimation.boolean
Indicates whether estimator has finished the estimation.boolean
Indicates whether estimator is currently running or not.boolean
reset()
Resets current estimator.void
setListener
(TimeIntervalEstimatorListener listener) Sets listener to handle events raised by this estimator.void
setTotalSamples
(int totalSamples) Sets total samples to be processed to finish estimation.
-
Field Details
-
DEFAULT_TOTAL_SAMPLES
public static final int DEFAULT_TOTAL_SAMPLESDefault total samples to be processed.- See Also:
-
totalSamples
private int totalSamplesTotal samples to be processed to finish estimation. -
listener
Listener to handle events raised by this estimator. -
lastTimestamp
Last provided timestamp expressed in seconds (s). -
averageTimeInterval
private double averageTimeIntervalEstimated average time interval between body kinematics samples expressed in seconds (s). -
timeIntervalVariance
private double timeIntervalVarianceEstimated variance of time interval between body kinematics samples expressed in squared seconds (s^2). -
numberOfProcessedSamples
private int numberOfProcessedSamplesNumber of processed timestamp samples. -
numberOfProcessedSamplesPlusOne
private int numberOfProcessedSamplesPlusOneNumber of processed timestamp samples plus one. -
running
private boolean runningIndicates that estimator is running.
-
-
Constructor Details
-
TimeIntervalEstimator
public TimeIntervalEstimator()Constructor. -
TimeIntervalEstimator
public TimeIntervalEstimator(int totalSamples) Constructor.- Parameters:
totalSamples
- total samples to be processed to finish estimation.- Throws:
IllegalArgumentException
- if provided total samples is zero or negative.
-
-
Method Details
-
getTotalSamples
public int getTotalSamples()Gets total samples to be processed to finish estimation.- Returns:
- total samples to be processed to finish estimation.
-
setTotalSamples
public void setTotalSamples(int totalSamples) throws com.irurueta.navigation.LockedException Sets total samples to be processed to finish estimation.- Parameters:
totalSamples
- total samples to be processed to finish estimation.- Throws:
com.irurueta.navigation.LockedException
- if estimator is currently running.
-
getListener
Gets listener to handle events raised by this estimator.- Returns:
- listener to handle events raised by this estimator.
-
getLastTimestamp
Gets last provided timestamp expressed in seconds or null if none has been provided yet.- Returns:
- last provided timestamp or null.
-
getLastTimestampAsTime
public com.irurueta.units.Time getLastTimestampAsTime()Gets last provided timestamp or null if none has been provided yet.- Returns:
- last provided timestamp or null.
-
getLastTimestampAsTime
public boolean getLastTimestampAsTime(com.irurueta.units.Time result) Gets last provided timestamp.- Parameters:
result
- instance where last provided timestamp will be stored.- Returns:
- true if last provided timestamp was available, false otherwise.
-
getAverageTimeInterval
public double getAverageTimeInterval()Gets estimated average time interval between body kinematics samples expressed in seconds (s). Calling this method before the estimator is finished will return a provisional value containing current estimation.- Returns:
- estimated average time interval.
-
getAverageTimeIntervalAsTime
public com.irurueta.units.Time getAverageTimeIntervalAsTime()Gets estimated average time interval between body kinematics samples. Calling this method before the estimator is finished will return a provisional value containing current estimation.- Returns:
- estimate average time interval.
-
getAverageTimeIntervalAsTime
public void getAverageTimeIntervalAsTime(com.irurueta.units.Time result) Gets estimated average time interval between body kinematics samples. Calling this method before the estimator is finished will return a provisional value containing current estimation.- Parameters:
result
- instance where estimated average time interval will be stored.
-
getTimeIntervalVariance
public double getTimeIntervalVariance()Gets estimated variance of time interval between body kinematics samples expressed in squared seconds (s^2). Calling this method before the estimator is finished will return a provisional value containing current estimation.- Returns:
- estimated variance of time interval between body kinematics samples.
-
getTimeIntervalStandardDeviation
public double getTimeIntervalStandardDeviation()Gets estimate standard deviation of time interval between body kinematics samples expressed in seconds (s). Calling this method before the estimator is finished will return a provisional value containing current estimation.- Returns:
- estimated standard deviation of time interval between body kinematics samples.
-
getTimeIntervalStandardDeviationAsTime
public com.irurueta.units.Time getTimeIntervalStandardDeviationAsTime()Gets estimate standard deviation of time interval between body kinematics samples. Calling this method before the estimator is finished will return a provisional value containing current estimation.- Returns:
- estimated standard deviation of time interval between body kinematics samples.
-
getTimeIntervalStandardDeviationAsTime
public void getTimeIntervalStandardDeviationAsTime(com.irurueta.units.Time result) Gets estimate standard deviation of time interval between body kinematics samples. Calling this method before the estimator is finished will return a provisional value containing current estimation.- Parameters:
result
- instance where estimated standard deviation of time interval between body kinematics samples will be stored.
-
getNumberOfProcessedSamples
public int getNumberOfProcessedSamples()Gets number of samples that have been processed so far.- Returns:
- number of samples that have been processed so far.
-
isRunning
public boolean isRunning()Indicates whether estimator is currently running or not.- Returns:
- true if estimator is running, false otherwise.
-
isFinished
public boolean isFinished()Indicates whether estimator has finished the estimation.- Returns:
- true if estimator has finished, false otherwise.
-
addTimestamp
public boolean addTimestamp(com.irurueta.units.Time timestamp) throws com.irurueta.navigation.LockedException Adds a timestamp value to current estimation. If estimator is already finished, provided timestamp will be ignored.- Parameters:
timestamp
- timestamp since epoch time.- Returns:
- true if provided timestamp has been processed, false if it has been ignored.
- Throws:
com.irurueta.navigation.LockedException
- if estimator is currently running.
-
addTimestamp
public boolean addTimestamp(double timestamp) throws com.irurueta.navigation.LockedException Adds a timestamp value to current estimation. If estimator is already finished, provided timestamp will be ignored.- Parameters:
timestamp
- timestamp since epoch time expressed in seconds (s).- Returns:
- true if provided timestamp has been processed, false if it has been ignored.
- Throws:
com.irurueta.navigation.LockedException
- if estimator is currently running.
-
reset
public boolean reset() throws com.irurueta.navigation.LockedExceptionResets current estimator.- Returns:
- true if estimator was successfully reset, false if no reset was needed.
- Throws:
com.irurueta.navigation.LockedException
- if estimator is currently running.
-