Class TimeIntervalEstimator

java.lang.Object
com.irurueta.navigation.inertial.calibration.TimeIntervalEstimator

public class TimeIntervalEstimator extends Object
Estimates average time interval between processed samples.
  • Field Details

    • DEFAULT_TOTAL_SAMPLES

      public static final int DEFAULT_TOTAL_SAMPLES
      Default total samples to be processed.
      See Also:
    • totalSamples

      private int totalSamples
      Total samples to be processed to finish estimation.
    • listener

      Listener to handle events raised by this estimator.
    • lastTimestamp

      private Double lastTimestamp
      Last provided timestamp expressed in seconds (s).
    • averageTimeInterval

      private double averageTimeInterval
      Estimated average time interval between body kinematics samples expressed in seconds (s).
    • timeIntervalVariance

      private double timeIntervalVariance
      Estimated variance of time interval between body kinematics samples expressed in squared seconds (s^2).
    • numberOfProcessedSamples

      private int numberOfProcessedSamples
      Number of processed timestamp samples.
    • numberOfProcessedSamplesPlusOne

      private int numberOfProcessedSamplesPlusOne
      Number of processed timestamp samples plus one.
    • running

      private boolean running
      Indicates that estimator is running.
  • Constructor Details

    • TimeIntervalEstimator

      public TimeIntervalEstimator()
      Constructor.
    • TimeIntervalEstimator

      public TimeIntervalEstimator(TimeIntervalEstimatorListener listener)
      Constructor.
      Parameters:
      listener - listener to handle events raised by this estimator.
    • 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.
    • TimeIntervalEstimator

      public TimeIntervalEstimator(int totalSamples, TimeIntervalEstimatorListener listener)
      Constructor.
      Parameters:
      totalSamples - total samples to be processed to finish estimation.
      listener - listener to handle events raised by this estimator.
      Throws:
      IllegalArgumentException - if provided total samples is zero or negative.
    • TimeIntervalEstimator

      public TimeIntervalEstimator(TimeIntervalEstimator input)
      Copy constructor.
      Parameters:
      input - instance to get a copy from.
  • 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

      public TimeIntervalEstimatorListener getListener()
      Gets listener to handle events raised by this estimator.
      Returns:
      listener to handle events raised by this estimator.
    • setListener

      public void setListener(TimeIntervalEstimatorListener listener) throws com.irurueta.navigation.LockedException
      Sets listener to handle events raised by this estimator.
      Parameters:
      listener - listener to handle events raised by this estimator.
      Throws:
      com.irurueta.navigation.LockedException - if this estimator is running.
    • getLastTimestamp

      public Double 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.LockedException
      Resets 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.
    • copyFrom

      public void copyFrom(TimeIntervalEstimator input)
      Copies instance from provided one into this one.
      Parameters:
      input - input instance to be copied.
    • copyTo

      public void copyTo(TimeIntervalEstimator output)
      Copies current instance into provided instance.
      Parameters:
      output - output instance to copy to.