mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Add RobotState#IsEStopped and DriverStation#IsEStopped (#952)
This commit is contained in:
@@ -336,6 +336,12 @@ bool DriverStation::IsDisabled() const {
|
||||
return !(controlWord.enabled && controlWord.dsAttached);
|
||||
}
|
||||
|
||||
bool DriverStation::IsEStopped() const {
|
||||
HAL_ControlWord controlWord;
|
||||
HAL_GetControlWord(&controlWord);
|
||||
return controlWord.eStop;
|
||||
}
|
||||
|
||||
bool DriverStation::IsAutonomous() const {
|
||||
HAL_ControlWord controlWord;
|
||||
HAL_GetControlWord(&controlWord);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -19,6 +19,10 @@ bool RobotState::IsEnabled() {
|
||||
return DriverStation::GetInstance().IsEnabled();
|
||||
}
|
||||
|
||||
bool RobotState::IsEStopped() {
|
||||
return DriverStation::GetInstance().IsEStopped();
|
||||
}
|
||||
|
||||
bool RobotState::IsOperatorControl() {
|
||||
return DriverStation::GetInstance().IsOperatorControl();
|
||||
}
|
||||
|
||||
@@ -197,6 +197,13 @@ class DriverStation : public ErrorBase {
|
||||
*/
|
||||
bool IsDisabled() const;
|
||||
|
||||
/**
|
||||
* Check if the robot is e-stopped.
|
||||
*
|
||||
* @return True if the robot is e-stopped
|
||||
*/
|
||||
bool IsEStopped() const;
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding autonomous mode.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -15,6 +15,7 @@ class RobotState {
|
||||
public:
|
||||
static bool IsDisabled();
|
||||
static bool IsEnabled();
|
||||
static bool IsEStopped();
|
||||
static bool IsOperatorControl();
|
||||
static bool IsAutonomous();
|
||||
static bool IsTest();
|
||||
|
||||
Reference in New Issue
Block a user