A class that's a wrapper around a watchdog timer.
More...
#include <frc/Watchdog.h>
|
| Watchdog (units::second_t timeout, std::function< void()> callback) |
| Watchdog constructor.
|
|
template<typename Callable , typename Arg , typename... Args> |
| Watchdog (units::second_t timeout, Callable &&f, Arg &&arg, Args &&... args) |
|
| ~Watchdog () |
|
| Watchdog (Watchdog &&rhs) |
|
Watchdog & | operator= (Watchdog &&rhs) |
|
units::second_t | GetTime () const |
| Returns the time since the watchdog was last fed.
|
|
void | SetTimeout (units::second_t timeout) |
| Sets the watchdog's timeout.
|
|
units::second_t | GetTimeout () const |
| Returns the watchdog's timeout.
|
|
bool | IsExpired () const |
| Returns true if the watchdog timer has expired.
|
|
void | AddEpoch (std::string_view epochName) |
| Adds time since last epoch to the list printed by PrintEpochs().
|
|
void | PrintEpochs () |
| Prints list of epochs added so far and their times.
|
|
void | Reset () |
| Resets the watchdog timer.
|
|
void | Enable () |
| Enables the watchdog timer.
|
|
void | Disable () |
| Disables the watchdog timer.
|
|
void | SuppressTimeoutMessage (bool suppress) |
| Enable or disable suppression of the generic timeout message.
|
|
A class that's a wrapper around a watchdog timer.
When the timer expires, a message is printed to the console and an optional user-provided callback is invoked.
The watchdog is initialized disabled, so the user needs to call Enable() before use.
◆ Watchdog() [1/3]
frc::Watchdog::Watchdog |
( |
units::second_t | timeout, |
|
|
std::function< void()> | callback ) |
Watchdog constructor.
- Parameters
-
timeout | The watchdog's timeout in seconds with microsecond resolution. |
callback | This function is called when the timeout expires. |
◆ Watchdog() [2/3]
template<typename Callable , typename Arg , typename... Args>
frc::Watchdog::Watchdog |
( |
units::second_t | timeout, |
|
|
Callable && | f, |
|
|
Arg && | arg, |
|
|
Args &&... | args ) |
|
inline |
◆ ~Watchdog()
frc::Watchdog::~Watchdog |
( |
| ) |
|
◆ Watchdog() [3/3]
frc::Watchdog::Watchdog |
( |
Watchdog && | rhs | ) |
|
◆ AddEpoch()
void frc::Watchdog::AddEpoch |
( |
std::string_view | epochName | ) |
|
Adds time since last epoch to the list printed by PrintEpochs().
Epochs are a way to partition the time elapsed so that when overruns occur, one can determine which parts of an operation consumed the most time.
- Parameters
-
epochName | The name to associate with the epoch. |
◆ Disable()
void frc::Watchdog::Disable |
( |
| ) |
|
Disables the watchdog timer.
◆ Enable()
void frc::Watchdog::Enable |
( |
| ) |
|
Enables the watchdog timer.
◆ GetTime()
units::second_t frc::Watchdog::GetTime |
( |
| ) |
const |
Returns the time since the watchdog was last fed.
◆ GetTimeout()
units::second_t frc::Watchdog::GetTimeout |
( |
| ) |
const |
Returns the watchdog's timeout.
◆ IsExpired()
bool frc::Watchdog::IsExpired |
( |
| ) |
const |
Returns true if the watchdog timer has expired.
◆ operator=()
◆ PrintEpochs()
void frc::Watchdog::PrintEpochs |
( |
| ) |
|
Prints list of epochs added so far and their times.
◆ Reset()
void frc::Watchdog::Reset |
( |
| ) |
|
Resets the watchdog timer.
This also enables the timer if it was previously disabled.
◆ SetTimeout()
void frc::Watchdog::SetTimeout |
( |
units::second_t | timeout | ) |
|
Sets the watchdog's timeout.
- Parameters
-
timeout | The watchdog's timeout in seconds with microsecond resolution. |
◆ SuppressTimeoutMessage()
void frc::Watchdog::SuppressTimeoutMessage |
( |
bool | suppress | ) |
|
Enable or disable suppression of the generic timeout message.
This may be desirable if the user-provided callback already prints a more specific message.
- Parameters
-
suppress | Whether to suppress generic timeout message. |
The documentation for this class was generated from the following file: