11#include "frc/DriverStation.h"
12#include "frc/Notifier.h"
24 return *autoFeedEnable;
29 frc::Notifier _enableNotifier;
30 uint32_t _startCount = 0;
34 std::string_view robotMode;
35 if (frc::DriverStation::IsEnabled()) {
38 if (frc::DriverStation::IsAutonomous()) {
39 robotMode =
"Autonomous";
40 }
else if (frc::DriverStation::IsTest()) {
46 robotMode =
"Disabled";
58 std::lock_guard<std::mutex> lock{_lck};
59 if (_startCount < UINT32_MAX) {
60 if (_startCount++ == 0) {
62 _enableNotifier.StartPeriodic(20_ms);
74 std::lock_guard<std::mutex> lock{_lck};
75 if (_startCount > 0) {
76 if (--_startCount == 0) {
78 _enableNotifier.Stop();
static ctre::phoenix::StatusCode WriteString(std::string_view name, std::string_view value, units::time::second_t latencySeconds=0_s)
Writes the string to the log file.
Definition SignalLogger.hpp:151
Definition AutoFeedEnable.hpp:19
void Start()
Starts feeding the enable signal to CTRE actuators.
Definition AutoFeedEnable.hpp:56
static AutoFeedEnable & GetInstance()
Definition AutoFeedEnable.hpp:21
void Stop()
Stops feeding the enable signal to CTRE actuators.
Definition AutoFeedEnable.hpp:72
CTREXPORT void FeedEnable(int timeoutMs)
Feed the robot enable.
Definition StatusCodes.h:18