BaseStatusSignalGetLatencyCompensatedValue Method

Performs latency compensation on signal using the signalSlope and signal's latency to determine the magnitude of compensation.The caller must refresh these StatusSignals beforehand; this function only does the math required for latency compensation.

Important: The signalSlope must be the rate of change of the signal. If it is not, the latency compensation may not perform as expected.

Example

For example:
C#
double compensatedTurns = BaseStatusSignal.GetLatencyCompensatedValue(fx.GetPosition(), fx.GetVelocity());

Definition

Namespace: CTRE.Phoenix6
Assembly: Phoenix6 (in Phoenix6.dll) Version: 1.0.0
C#
public static double GetLatencyCompensatedValue(
	StatusSignal<double> signal,
	StatusSignal<double> signalSlope
)

Parameters

signal  StatusSignalDouble
Signal to be latency compensated. Caller must make sure this signal is up to date either by calling Refresh(Boolean) or WaitForUpdate(Double, Boolean)
signalSlope  StatusSignalDouble
Derivative of the signal that informs compensation magnitude. Caller must make sure this signal is up to date either by calling Refresh(Boolean) or WaitForUpdate(Double, Boolean)

Return Value

Double
Latency compensated value from the signal StatusSignal

See Also