mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Reflowed comments and removed commented out code (#735)
This commit is contained in:
committed by
Peter Johnson
parent
1e8d18b328
commit
c663d7cd16
@@ -22,8 +22,8 @@ namespace frc {
|
||||
*
|
||||
* Pause the execution of the program 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.
|
||||
* sensors will continue to update. Only the task containing the wait will pause
|
||||
* until the wait time is expired.
|
||||
*
|
||||
* @param seconds Length of time to pause, in seconds.
|
||||
*/
|
||||
@@ -34,13 +34,15 @@ void Wait(double seconds) {
|
||||
|
||||
/**
|
||||
* Return the FPGA system clock time in seconds.
|
||||
*
|
||||
* This is deprecated and just forwards to Timer::GetFPGATimestamp().
|
||||
*
|
||||
* @return Robot running time in seconds.
|
||||
*/
|
||||
double GetClock() { return Timer::GetFPGATimestamp(); }
|
||||
|
||||
/**
|
||||
* @brief Gives real-time clock system time with nanosecond resolution
|
||||
* @brief Gives real-time clock system time with nanosecond resolution
|
||||
* @return The time, just in case you want the robot to start autonomous at 8pm
|
||||
* on Saturday.
|
||||
*/
|
||||
@@ -63,14 +65,9 @@ const double Timer::kRolloverTime = (1ll << 32) / 1e6;
|
||||
* Create a new timer object.
|
||||
*
|
||||
* Create a new timer object and reset the time to zero. The timer is initially
|
||||
* not running and
|
||||
* must be started.
|
||||
* not running and must be started.
|
||||
*/
|
||||
Timer::Timer() {
|
||||
// Creates a semaphore to control access to critical regions.
|
||||
// Initially 'open'
|
||||
Reset();
|
||||
}
|
||||
Timer::Timer() { Reset(); }
|
||||
|
||||
/**
|
||||
* Get the current time from the timer. If the clock is running it is derived
|
||||
@@ -85,9 +82,9 @@ double Timer::Get() const {
|
||||
|
||||
std::lock_guard<wpi::mutex> sync(m_mutex);
|
||||
if (m_running) {
|
||||
// If the current time is before the start time, then the FPGA clock
|
||||
// rolled over. Compensate by adding the ~71 minutes that it takes
|
||||
// to roll over to the current time.
|
||||
// If the current time is before the start time, then the FPGA clock rolled
|
||||
// over. Compensate by adding the ~71 minutes that it takes to roll over to
|
||||
// the current time.
|
||||
if (currentTime < m_startTime) {
|
||||
currentTime += kRolloverTime;
|
||||
}
|
||||
@@ -149,7 +146,7 @@ void Timer::Stop() {
|
||||
* work without drifting later by the time it took to get around to checking.
|
||||
*
|
||||
* @param period The period to check for (in seconds).
|
||||
* @return True if the period has passed.
|
||||
* @return True if the period has passed.
|
||||
*/
|
||||
bool Timer::HasPeriodPassed(double period) {
|
||||
if (Get() > period) {
|
||||
@@ -178,14 +175,13 @@ double Timer::GetFPGATimestamp() {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Warning: This is
|
||||
* not an official time (so it cannot be used to argue with referees).
|
||||
* 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.
|
||||
*
|
||||
* Warning: This is not an official time (so it cannot be used to argue with
|
||||
* referees).
|
||||
*
|
||||
* @return Match time in seconds since the beginning of autonomous
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user