10#include "frc/simulation/DriverStationSim.h"
11#include "frc/Notifier.h"
23 return *replayAutoEnable;
28 frc::Notifier _enableNotifier;
29 uint32_t _startCount = 0;
35 if (enableSig.status.IsOK()) {
36 frc::sim::DriverStationSim::SetEnabled(enableSig.value);
40 if (robotModeSig.status.IsOK()) {
41 if (robotModeSig.value ==
"Autonomous") {
42 frc::sim::DriverStationSim::SetAutonomous(
true);
43 frc::sim::DriverStationSim::SetTest(
false);
44 }
else if (robotModeSig.value ==
"Test") {
45 frc::sim::DriverStationSim::SetAutonomous(
false);
46 frc::sim::DriverStationSim::SetTest(
true);
48 frc::sim::DriverStationSim::SetAutonomous(
false);
49 frc::sim::DriverStationSim::SetTest(
false);
53 frc::sim::DriverStationSim::NotifyNewData();
64 std::lock_guard<std::mutex> lock{_lck};
65 if (_startCount < UINT32_MAX) {
66 if (_startCount++ == 0) {
68 _enableNotifier.StartPeriodic(20_ms);
80 std::lock_guard<std::mutex> lock{_lck};
81 if (_startCount > 0) {
82 if (--_startCount == 0) {
84 _enableNotifier.Stop();
static SignalData< std::string > GetString(std::string_view name)
Gets a string user signal.
Definition HootReplay.hpp:266
static bool IsPlaying()
Gets whether hoot log replay is actively playing.
Definition HootReplay.hpp:114
static SignalData< bool > GetBoolean(std::string_view name)
Gets a boolean user signal.
Definition HootReplay.hpp:206
Definition ReplayAutoEnable.hpp:18
void Start()
Starts automatically enabling the robot in replay.
Definition ReplayAutoEnable.hpp:62
void Stop()
Stops automatically enabling the robot in replay.
Definition ReplayAutoEnable.hpp:78
static ReplayAutoEnable & GetInstance()
Definition ReplayAutoEnable.hpp:20
Definition StatusCodes.h:18