mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
[wpilib] Rename DriverStation::IsOperatorControl() to IsTeleop() (#3505)
This commit is contained in:
@@ -462,12 +462,20 @@ bool DriverStation::IsAutonomousEnabled() {
|
||||
}
|
||||
|
||||
bool DriverStation::IsOperatorControl() {
|
||||
return IsTeleop();
|
||||
}
|
||||
|
||||
bool DriverStation::IsTeleop() {
|
||||
HAL_ControlWord controlWord;
|
||||
HAL_GetControlWord(&controlWord);
|
||||
return !(controlWord.autonomous || controlWord.test);
|
||||
}
|
||||
|
||||
bool DriverStation::IsOperatorControlEnabled() {
|
||||
return IsTeleopEnabled();
|
||||
}
|
||||
|
||||
bool DriverStation::IsTeleopEnabled() {
|
||||
HAL_ControlWord controlWord;
|
||||
HAL_GetControlWord(&controlWord);
|
||||
return !controlWord.autonomous && !controlWord.test && controlWord.enabled;
|
||||
@@ -621,6 +629,10 @@ void DriverStation::InAutonomous(bool entering) {
|
||||
}
|
||||
|
||||
void DriverStation::InOperatorControl(bool entering) {
|
||||
InTeleop(entering);
|
||||
}
|
||||
|
||||
void DriverStation::InTeleop(bool entering) {
|
||||
::GetInstance().userInTeleop = entering;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,11 @@ bool RobotState::IsEStopped() {
|
||||
}
|
||||
|
||||
bool RobotState::IsOperatorControl() {
|
||||
return DriverStation::IsOperatorControl();
|
||||
return IsTeleop();
|
||||
}
|
||||
|
||||
bool RobotState::IsTeleop() {
|
||||
return DriverStation::IsTeleop();
|
||||
}
|
||||
|
||||
bool RobotState::IsAutonomous() {
|
||||
|
||||
@@ -179,11 +179,19 @@ bool RobotBase::IsAutonomousEnabled() const {
|
||||
}
|
||||
|
||||
bool RobotBase::IsOperatorControl() const {
|
||||
return DriverStation::IsOperatorControl();
|
||||
return DriverStation::IsTeleop();
|
||||
}
|
||||
|
||||
bool RobotBase::IsTeleop() const {
|
||||
return DriverStation::IsTeleop();
|
||||
}
|
||||
|
||||
bool RobotBase::IsOperatorControlEnabled() const {
|
||||
return DriverStation::IsOperatorControlEnabled();
|
||||
return DriverStation::IsTeleopEnabled();
|
||||
}
|
||||
|
||||
bool RobotBase::IsTeleopEnabled() const {
|
||||
return DriverStation::IsTeleopEnabled();
|
||||
}
|
||||
|
||||
bool RobotBase::IsTest() const {
|
||||
|
||||
@@ -195,16 +195,35 @@ class DriverStation {
|
||||
* Check if the DS is commanding teleop mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in teleop mode
|
||||
* @deprecated Use IsTeleop() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use IsTeleop() instead")
|
||||
static bool IsOperatorControl();
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding teleop mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in teleop mode
|
||||
*/
|
||||
static bool IsTeleop();
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding teleop mode and if it has enabled the robot.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in teleop mode and
|
||||
* enabled.
|
||||
* @deprecated Use IsTeleopEnabled() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use IsTeleopEnabled() instead")
|
||||
static bool IsOperatorControlEnabled();
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding teleop mode and if it has enabled the robot.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in teleop mode and
|
||||
* enabled.
|
||||
*/
|
||||
static bool IsOperatorControlEnabled();
|
||||
static bool IsTeleopEnabled();
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding test mode.
|
||||
@@ -377,9 +396,20 @@ class DriverStation {
|
||||
*
|
||||
* @param entering If true, starting teleop code; if false, leaving teleop
|
||||
* code.
|
||||
* @deprecated Use InTeleop() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use InTeleop() instead")
|
||||
static void InOperatorControl(bool entering);
|
||||
|
||||
/**
|
||||
* Only to be used to tell the Driver Station what code you claim to be
|
||||
* executing for diagnostic purposes only.
|
||||
*
|
||||
* @param entering If true, starting teleop code; if false, leaving teleop
|
||||
* code.
|
||||
*/
|
||||
static void InTeleop(bool entering);
|
||||
|
||||
/**
|
||||
* Only to be used to tell the Driver Station what code you claim to be
|
||||
* executing for diagnostic purposes only.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Main.h>
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
@@ -154,16 +155,36 @@ class RobotBase {
|
||||
*
|
||||
* @return True if the robot is currently operating in Tele-Op mode as
|
||||
* determined by the field controls.
|
||||
* @deprecated Use IsTeleop() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use IsTeleop() instead")
|
||||
bool IsOperatorControl() const;
|
||||
|
||||
/**
|
||||
* Determine if the robot is currently in Operator Control mode.
|
||||
*
|
||||
* @return True if the robot is currently operating in Tele-Op mode as
|
||||
* determined by the field controls.
|
||||
*/
|
||||
bool IsTeleop() const;
|
||||
|
||||
/**
|
||||
* Determine if the robot is current in Operator Control mode and enabled.
|
||||
*
|
||||
* @return True if the robot is currently operating in Tele-Op mode while
|
||||
* enabled as determined by the field-controls.
|
||||
* @deprecated Use IsTeleopEnabled() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use IsTeleopEnabled() instead")
|
||||
bool IsOperatorControlEnabled() const;
|
||||
|
||||
/**
|
||||
* Determine if the robot is current in Operator Control mode and enabled.
|
||||
*
|
||||
* @return True if the robot is currently operating in Tele-Op mode while
|
||||
* wnabled as determined by the field-controls.
|
||||
*/
|
||||
bool IsOperatorControlEnabled() const;
|
||||
bool IsTeleopEnabled() const;
|
||||
|
||||
/**
|
||||
* Determine if the robot is currently in Test mode.
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
class RobotState {
|
||||
@@ -13,7 +15,9 @@ class RobotState {
|
||||
static bool IsDisabled();
|
||||
static bool IsEnabled();
|
||||
static bool IsEStopped();
|
||||
WPI_DEPRECATED("Use IsTeleop() instead")
|
||||
static bool IsOperatorControl();
|
||||
static bool IsTeleop();
|
||||
static bool IsAutonomous();
|
||||
static bool IsTest();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user