Package org.ros.time
Class RemoteUptimeClock
java.lang.Object
org.ros.time.RemoteUptimeClock
- Author:
- damonkohler@google.com (Damon Kohler)
-
Method Summary
Modifier and TypeMethodDescriptionvoidcalibrate(int sampleSize, double samplingDelayMillis) Good calibration settings will depend on the remote uptime provider.static RemoteUptimeClocknewDefault(TimeProvider timeProvider, Callable<Double> callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold) The providedCallableshould 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.doubletoLocalUptime(double remoteUptime) Returns the estimated local uptime in seconds for the given remote uptime.voidupdate()Update thisRemoteUptimeClockwith the latest uptime from the remote clock.
-
Method Details
-
newDefault
public static RemoteUptimeClock newDefault(TimeProvider timeProvider, Callable<Double> callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold) The providedCallableshould 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 providercallable- returns the current remote uptime in arbitrary unitsdriftSensitivity- 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 calibrationsamplingDelayMillis- the delay in milliseconds between collecting each sample
-
update
public void update()Update thisRemoteUptimeClockwith 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
-