|
RobotCore 1.0
WPILib port to raspberry Pi
|
Public Member Functions | |
| Timer () | |
| double | get () |
| final void | reset () |
| void | start () |
| void | restart () |
| void | stop () |
| boolean | hasElapsed (Time period) |
| boolean | hasElapsed (double seconds) |
| boolean | advanceIfElapsed (double seconds) |
| boolean | isRunning () |
Static Public Member Functions | |
| static double | getTimestamp () |
| static double | getMonotonicTimestamp () |
| static double | getMatchTime () |
| static void | delay (final Time period) |
| static void | delay (final double seconds) |
| static Timer | createStarted () |
A timer class.
Note that if the user calls SimHooks.restartTiming(), they should also reset the timer so get() won't return a negative duration.
Definition at line 18 of file Timer.java.
| org.wpilib.system.Timer.Timer | ( | ) |
Creates a new timer. The timer is initially not running and must be started with start() to start measuring time. Consider using createStarted() instead if the timer will be used immediately after creation.
Definition at line 96 of file Timer.java.
| boolean org.wpilib.system.Timer.advanceIfElapsed | ( | double | seconds | ) |
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.
| seconds | The period to check. |
Definition at line 218 of file Timer.java.
|
static |
Creates a new timer that begins started.
This is equivalent to
{
Timer timer = new Timer(); timer.start(); }
Definition at line 112 of file Timer.java.
|
static |
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 task containing the wait will pause until the wait time is expired.
| seconds | Length of time to pause |
Definition at line 78 of file Timer.java.
|
static |
Pause the execution of the thread for a specified period of time. Motors will continue to run at their last assigned values, and sensors will continue to update. Only the task containing the wait will pause until the wait time is expired.
| period | Length of time to pause |
Definition at line 67 of file Timer.java.
| double org.wpilib.system.Timer.get | ( | ) |
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.
Definition at line 137 of file Timer.java.
|
static |
Return the approximate match time. The FMS does not send an official match time to the robots, but does send an approximate match time. The value will count down the time remaining in the current period (auto or teleop). Warning: This is not an official time (so it cannot be used to dispute ref calls or guarantee that a function will trigger before the match ends).
When connected to the real field, this number only changes in full integer increments, and always counts down.
When the DS is in practice mode, this number is a floating point number, and counts down.
When the DS is in teleop or autonomous mode, this number returns -1.0.
Simulation matches DS behavior without an FMS connected.
Definition at line 56 of file Timer.java.
|
static |
Return the monotonic clock time in seconds.
Definition at line 35 of file Timer.java.
|
static |
Return the clock time in seconds. By default, the time is the time returned by getMonotonicTimestamp(). However, the return value of this method may be modified to use any time base, including non-monotonic time bases.
Definition at line 26 of file Timer.java.
| boolean org.wpilib.system.Timer.hasElapsed | ( | double | seconds | ) |
Check if the period specified has passed.
| seconds | The period to check in seconds. |
Definition at line 206 of file Timer.java.
| boolean org.wpilib.system.Timer.hasElapsed | ( | Time | period | ) |
Check if the period specified has passed.
| period | The period to check. |
Definition at line 196 of file Timer.java.
| boolean org.wpilib.system.Timer.isRunning | ( | ) |
Whether the timer is currently running.
Definition at line 239 of file Timer.java.
| final void org.wpilib.system.Timer.reset | ( | ) |
Reset the timer by setting the time to 0.
Make the timer startTime the current time so new requests will be relative now.
Definition at line 146 of file Timer.java.
| void org.wpilib.system.Timer.restart | ( | ) |
Restart the timer by stopping the timer, if it is not already stopped, resetting the accumulated time, then starting the timer again. If you want an event to periodically reoccur at some time interval from the start time, consider using advanceIfElapsed() instead.
Definition at line 170 of file Timer.java.
| void org.wpilib.system.Timer.start | ( | ) |
Start the timer running. Just set the running flag to true indicating that all time requests should be relative to the system clock. Note that this method is a no-op if the timer is already running.
Definition at line 157 of file Timer.java.
| void org.wpilib.system.Timer.stop | ( | ) |
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.
Definition at line 183 of file Timer.java.