Package org.ros.time

Class RemoteUptimeClock

java.lang.Object
org.ros.time.RemoteUptimeClock

public class RemoteUptimeClock extends Object
Author:
damonkohler@google.com (Damon Kohler)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    calibrate(int sampleSize, double samplingDelayMillis)
    Good calibration settings will depend on the remote uptime provider.
    newDefault(TimeProvider timeProvider, Callable<Double> callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold)
    The provided Callable should return the current measuredRemoteUptime of the remote clock with minimal overhead since the run time of this call will be used to further improve the estimation of measuredRemoteUptime.
    double
    toLocalUptime(double remoteUptime)
    Returns the estimated local uptime in seconds for the given remote uptime.
    void
    Update this RemoteUptimeClock with the latest uptime from the remote clock.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newDefault

      public static RemoteUptimeClock newDefault(TimeProvider timeProvider, Callable<Double> callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold)
      The provided Callable should return the current measuredRemoteUptime of the remote clock with minimal overhead since the run time of this call will be used to further improve the estimation of measuredRemoteUptime.
      Parameters:
      timeProvider - the local time provider
      callable - returns the current remote uptime in arbitrary units
      driftSensitivity - the sensitivity to drift adjustments, must be in the range [0, 1]
      errorReductionCoefficientSensitivity - the sensitivity to error reduction coefficient adjustments, must be in the range [0, 1]
      Returns:
      a new RemoteUptimeClock
    • calibrate

      public void calibrate(int sampleSize, double samplingDelayMillis)
      Good calibration settings will depend on the remote uptime provider. In general, choosing a sample size around 10 and a delay that is large enough to include more than 100 uptime ticks will give reasonable results.
      Parameters:
      sampleSize - the number of samples to use for calibration
      samplingDelayMillis - the delay in milliseconds between collecting each sample
    • update

      public void update()
      Update this RemoteUptimeClock with the latest uptime from the remote clock.

      This will update internal estimates of drift and error. Ideally, it should be called periodically with a consistent time interval between updates (e.g. 10 seconds).

    • toLocalUptime

      public double toLocalUptime(double remoteUptime)
      Returns the estimated local uptime in seconds for the given remote uptime.
      Parameters:
      remoteUptime - the remote uptime to convert to local uptime
      Returns:
      the estimated local uptime in seconds at the provided remote uptime