Provides time-related functionality for the robot
Prefer to use this module for time functions, instead of the
timemodule in the standard library. This will make it easier for your code to work properly in simulation.
Pause the thread for a specified time. Pause the execution of the thread for a specified period of time given in seconds. Motors will continue to run at their last assigned values, and sensors will continue to update. Only the thread containing the wait will pause until the wait time is expired.
Parameters: seconds (float) – Length of time to pause
If you’re tempted to use this function for autonomous mode to time transitions between actions, don’t do it!
Delaying the main robot thread for more than a few milliseconds is generally discouraged, and will cause problems and possibly leave the robot unresponsive.
Get the current time from the timer. If the clock is running it is derived from the current system clock the start time stored in the timer class. If the clock is not running, then return the time when it was last stopped.
Returns: Current time value for this timer in seconds Return type: float
Return the system clock time in seconds. Return the time from the FPGA hardware clock in seconds since the FPGA started.
Returns: Robot running time in seconds. Return type: float
Return the approximate match time. The FMS does not currently send the official match time to the robots. This returns the time since the enable signal sent from the Driver Station. At the beginning of autonomous, the time is reset to 0.0 seconds. At the beginning of teleop, the time is reset to +15.0 seconds. If the robot is disabled, this returns 0.0 seconds.
This is not an official time (so it cannot be used to argue with referees).
Returns: Match time in seconds since the beginning of autonomous Return type: float
Returns: the system clock time in milliseconds. Return type: int
Check if the period specified has passed and if it has, advance the start time by that period. This is useful to decide if it’s time to do periodic work without drifting later by the time it took to get around to checking.
Parameters: period – The period to check for (in seconds). Returns: If the period has passed. Return type: bool
Reset the timer by setting the time to 0. Make the timer startTime the current time so new requests will be relative now.
Start the timer running. Just set the running flag to true indicating that all time requests should be relative to the system clock.
Stop the timer. This computes the time as of now and clears the running flag, causing all subsequent time requests to be read from the accumulated time rather than looking at the system clock.