C++: Add Watchdog to CommandScheduler (#2437)

C++ counterpart to #2319
This commit is contained in:
Prateek Machiraju
2020-03-28 12:29:51 -04:00
committed by GitHub
parent 6e6f28d1ac
commit b7a79c70cc
2 changed files with 33 additions and 1 deletions

View File

@@ -13,8 +13,10 @@
#include <frc/ErrorBase.h>
#include <frc/WPIErrors.h>
#include <frc/Watchdog.h>
#include <frc/smartdashboard/Sendable.h>
#include <frc/smartdashboard/SendableHelper.h>
#include <units/units.h>
#include <wpi/ArrayRef.h>
#include <wpi/FunctionExtras.h>
@@ -46,6 +48,12 @@ class CommandScheduler final : public frc::Sendable,
using Action = std::function<void(const Command&)>;
/**
* Changes the period of the loop overrun watchdog. This should be kept in
* sync with the TimedRobot period.
*/
void SetPeriod(units::second_t period);
/**
* Adds a button binding to the scheduler, which will be polled to schedule
* commands.
@@ -337,6 +345,8 @@ class CommandScheduler final : public frc::Sendable,
class Impl;
std::unique_ptr<Impl> m_impl;
frc::Watchdog m_watchdog;
friend class CommandTestBase;
};
} // namespace frc2