Classes | |
class | LatencyOutlierFilter |
interface | LocalUptimeProvider |
class | UptimeCalculationResult |
Public Member Functions | |
void | calibrate (int sampleSize, double samplingDelayMillis) |
double | toLocalUptime (double remoteUptime) |
void | update () |
Static Public Member Functions | |
static RemoteUptimeClock | newDefault (final TimeProvider timeProvider, Callable< Double > callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold) |
Package Functions | |
double | getDrift () |
double | getErrorReductionCoefficient () |
RemoteUptimeClock (LocalUptimeProvider localUptimeProvider, Callable< Double > callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold) | |
Private Member Functions | |
double | calculateDrift (double localUptimeDelta, double remoteUptimeDelta) |
UptimeCalculationResult | calculateNewUptime (Callable< Double > callable) |
Private Attributes | |
final Callable< Double > | callable |
double | drift |
final double | driftSensitivity |
double | errorReductionCoefficient |
final double | errorReductionCoefficientSensitivity |
final LatencyOutlierFilter | latencyOutlierFilter |
double | localUptime |
final LocalUptimeProvider | localUptimeProvider |
double | measuredRemoteUptime |
double | predictedRemoteUptime |
Static Private Attributes | |
static final boolean | DEBUG = false |
static final Log | log = LogFactory.getLog(RemoteUptimeClock.class) |
Definition at line 35 of file RemoteUptimeClock.java.
org.ros.time.RemoteUptimeClock.RemoteUptimeClock | ( | LocalUptimeProvider | localUptimeProvider, |
Callable< Double > | callable, | ||
double | driftSensitivity, | ||
double | errorReductionCoefficientSensitivity, | ||
int | latencyOutlierFilterSampleSize, | ||
double | latencyOutlierFilterThreshold | ||
) | [inline, package] |
Definition at line 194 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.calculateDrift | ( | double | localUptimeDelta, |
double | remoteUptimeDelta | ||
) | [inline, private] |
localUptimeDelta | the delta between the two local uptimes that correspond to the two remote uptimes used to determine remoteUptimeDelta |
remoteUptimeDelta | the delta between the two remote uptimes that correspond to the two local uptimes used to determine localUptimeDelta |
Definition at line 264 of file RemoteUptimeClock.java.
UptimeCalculationResult org.ros.time.RemoteUptimeClock.calculateNewUptime | ( | Callable< Double > | callable | ) | [inline, private] |
Creates a new UptimeCalculationResult where the local uptime has been adjusted to compensate for latency while retrieving the remote uptime.
callable | returns the remote uptime as quickly as possible |
Definition at line 333 of file RemoteUptimeClock.java.
void org.ros.time.RemoteUptimeClock.calibrate | ( | int | sampleSize, |
double | samplingDelayMillis | ||
) | [inline] |
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.
sampleSize | the number of samples to use for calibration |
samplingDelayMillis | the delay in milliseconds between collecting each sample |
Definition at line 219 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.getDrift | ( | ) | [inline, package] |
Definition at line 362 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.getErrorReductionCoefficient | ( | ) | [inline, package] |
Definition at line 367 of file RemoteUptimeClock.java.
static RemoteUptimeClock org.ros.time.RemoteUptimeClock.newDefault | ( | final TimeProvider | timeProvider, |
Callable< Double > | callable, | ||
double | driftSensitivity, | ||
double | errorReductionCoefficientSensitivity, | ||
int | latencyOutlierFilterSampleSize, | ||
double | latencyOutlierFilterThreshold | ||
) | [inline, static] |
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.
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] |
Definition at line 180 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.toLocalUptime | ( | double | remoteUptime | ) | [inline] |
Returns the estimated local uptime in seconds for the given remote uptime.
remoteUptime | the remote uptime to convert to local uptime |
Definition at line 355 of file RemoteUptimeClock.java.
void org.ros.time.RemoteUptimeClock.update | ( | ) | [inline] |
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).
Definition at line 278 of file RemoteUptimeClock.java.
final Callable<Double> org.ros.time.RemoteUptimeClock.callable [private] |
Definition at line 41 of file RemoteUptimeClock.java.
final boolean org.ros.time.RemoteUptimeClock.DEBUG = false [static, private] |
Definition at line 37 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.drift [private] |
Drift is measured in local uptime ticks per remote uptime tick.
Definition at line 76 of file RemoteUptimeClock.java.
final double org.ros.time.RemoteUptimeClock.driftSensitivity [private] |
Sensitivity values are used to sampleSize the effect of jitter. The value should be in the range [0, 1] where 0 indicates that the current estimate will never change (i.e. new measurements have no effect on estimates) and 1 indicates that previous estimates have no effect on changes to the current estimate.
Definition at line 51 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.errorReductionCoefficient [private] |
With drift alone, it is possible to accumulate a constant error that will never be corrected for. The errorReductionCoefficient is an additional term for removing this error.
Definition at line 83 of file RemoteUptimeClock.java.
final double org.ros.time.RemoteUptimeClock.errorReductionCoefficientSensitivity [private] |
Definition at line 56 of file RemoteUptimeClock.java.
Definition at line 42 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.localUptime [private] |
Definition at line 58 of file RemoteUptimeClock.java.
Definition at line 40 of file RemoteUptimeClock.java.
final Log org.ros.time.RemoteUptimeClock.log = LogFactory.getLog(RemoteUptimeClock.class) [static, private] |
Definition at line 38 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.measuredRemoteUptime [private] |
Remote uptime is tracked as a pair of values: our previous measurement and our prediction based on estimated drift.
Definition at line 64 of file RemoteUptimeClock.java.
double org.ros.time.RemoteUptimeClock.predictedRemoteUptime [private] |
Definition at line 69 of file RemoteUptimeClock.java.