2021-08-11 18:05:07 -07:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/driverstation/DSControlWord.hpp"
|
2021-08-11 18:05:07 -07:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/DriverStation.h"
|
2021-08-11 18:05:07 -07:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
using namespace wpi;
|
2021-08-11 18:05:07 -07:00
|
|
|
|
|
|
|
|
DSControlWord::DSControlWord() {
|
|
|
|
|
HAL_GetControlWord(&m_controlWord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsEnabled() const {
|
|
|
|
|
return m_controlWord.enabled && m_controlWord.dsAttached;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsDisabled() const {
|
|
|
|
|
return !(m_controlWord.enabled && m_controlWord.dsAttached);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsEStopped() const {
|
|
|
|
|
return m_controlWord.eStop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsAutonomous() const {
|
|
|
|
|
return m_controlWord.autonomous;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsAutonomousEnabled() const {
|
|
|
|
|
return m_controlWord.autonomous && m_controlWord.enabled &&
|
|
|
|
|
m_controlWord.dsAttached;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsTeleop() const {
|
|
|
|
|
return !(m_controlWord.autonomous || m_controlWord.test);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsTeleopEnabled() const {
|
|
|
|
|
return !m_controlWord.autonomous && !m_controlWord.test &&
|
|
|
|
|
m_controlWord.enabled && m_controlWord.dsAttached;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsTest() const {
|
|
|
|
|
return m_controlWord.test;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsDSAttached() const {
|
|
|
|
|
return m_controlWord.dsAttached;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DSControlWord::IsFMSAttached() const {
|
|
|
|
|
return m_controlWord.fmsAttached;
|
|
|
|
|
}
|