Package com.ctre.phoenix6
Class Utils
java.lang.Object
com.ctre.phoenix6.Utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublefpgaToCurrentTime(double fpgaTimeSeconds) Converts an FPGA timestamp to the timebase reported bygetCurrentTimeSeconds().static doubleGet the current timestamp in seconds.static doubleGet the system timestamp in seconds.static booleanisReplay()Get whether the program is running in replay mode.static booleanGet whether the program is running in simulation.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getCurrentTimeSeconds
Get the current timestamp in seconds.This is the time source used for status signals.
This time source is typically continuous and monotonic. However, it may be overridden in simulation to use a non-monotonic, non-continuous source.
- Returns:
- Current time in seconds
-
getSystemTimeSeconds
Get the system timestamp in seconds.This is NOT the time source used for status signals. Use GetCurrentTImeSeconds instead when working with status signal timing.
This time source is guaranteed to be continuous and monotonic, making it useful for measuring time deltas in a robot program.
- Returns:
- System time in seconds
-
isSimulation
Get whether the program is running in simulation.- Returns:
trueif in simulation
-
isReplay
Get whether the program is running in replay mode.- Returns:
trueif in replay mode
-
fpgaToCurrentTime
Converts an FPGA timestamp to the timebase reported bygetCurrentTimeSeconds().- Parameters:
fpgaTimeSeconds- The FPGA timestamp in seconds- Returns:
- The equivalent
getCurrentTimeSeconds()timestamp in seconds
-