35 Watchdog(units::second_t timeout, std::function<
void()> callback);
37 template <
typename Callable,
typename Arg,
typename... Args>
38 Watchdog(units::second_t timeout, Callable&& f, Arg&&
arg, Args&&... args)
40 std::bind(
std::forward<Callable>(f),
std::forward<Arg>(
arg),
41 std::forward<Args>(args)...)) {}
115 static constexpr auto kMinPrintPeriod = 1_s;
117 units::second_t m_startTime = 0_s;
118 units::second_t m_timeout;
119 units::second_t m_expirationTime = 0_s;
120 std::function<void()> m_callback;
121 units::second_t m_lastTimeoutPrintTime = 0_s;
124 bool m_isExpired =
false;
126 bool m_suppressTimeoutMessage =
false;
133 static Impl* GetImpl();
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
A class for keeping track of how much time it takes for different parts of code to execute.
Definition: Tracer.h:26
A class that's a wrapper around a watchdog timer.
Definition: Watchdog.h:26
Watchdog & operator=(Watchdog &&rhs)
bool IsExpired() const
Returns true if the watchdog timer has expired.
units::second_t GetTime() const
Returns the time since the watchdog was last fed.
void Disable()
Disables the watchdog timer.
void AddEpoch(std::string_view epochName)
Adds time since last epoch to the list printed by PrintEpochs().
void SuppressTimeoutMessage(bool suppress)
Enable or disable suppression of the generic timeout message.
Watchdog(units::second_t timeout, Callable &&f, Arg &&arg, Args &&... args)
Definition: Watchdog.h:38
void Reset()
Resets the watchdog timer.
units::second_t GetTimeout() const
Returns the watchdog's timeout.
void Enable()
Enables the watchdog timer.
void SetTimeout(units::second_t timeout)
Sets the watchdog's timeout.
Watchdog(units::second_t timeout, std::function< void()> callback)
Watchdog constructor.
void PrintEpochs()
Prints list of epochs added so far and their times.
basic_string_view< char > string_view
Definition: core.h:520
Definition: AprilTagFieldLayout.h:22
Definition: StdDeque.h:50
constexpr bool operator>(const UNIT_LIB_DEFAULT_TYPE lhs, const Units &rhs) noexcept
Definition: base.h:2740