[wpilib] Rename DriverStation::IsOperatorControl() to IsTeleop() (#3505)

This commit is contained in:
Tyler Veness
2021-08-11 23:04:43 -07:00
committed by GitHub
parent e80f09f849
commit 25f6f478a5
12 changed files with 162 additions and 18 deletions

View File

@@ -812,8 +812,20 @@ public class DriverStation {
* operator-controlled mode.
*
* @return True if operator-controlled mode should be enabled, false otherwise.
* @deprecated Use isTeleop() instead.
*/
@Deprecated(since = "2022", forRemoval = true)
public static boolean isOperatorControl() {
return isTeleop();
}
/**
* Gets a value indicating whether the Driver Station requires the robot to be running in
* operator-controlled mode.
*
* @return True if operator-controlled mode should be enabled, false otherwise.
*/
public static boolean isTeleop() {
return !(isAutonomous() || isTest());
}
@@ -822,8 +834,20 @@ public class DriverStation {
* operator-controller mode and enabled.
*
* @return True if operator-controlled mode should be set and the robot should be enabled.
* @deprecated Use isTeleopEnabled() instead.
*/
@Deprecated(since = "2022", forRemoval = true)
public static boolean isOperatorControlEnabled() {
return isTeleopEnabled();
}
/**
* Gets a value indicating whether the Driver Station requires the robot to be running in
* operator-controller mode and enabled.
*
* @return True if operator-controlled mode should be set and the robot should be enabled.
*/
public static boolean isTeleopEnabled() {
synchronized (m_controlWordMutex) {
updateControlWord(false);
return !m_controlWordCache.getAutonomous()
@@ -1124,11 +1148,23 @@ public class DriverStation {
* purposes only.
*
* @param entering If true, starting teleop code; if false, leaving teleop code
* @deprecated Use {@link #inTeleop(boolean)} instead.
*/
@Deprecated(since = "2022", forRemoval = true)
public static void inOperatorControl(boolean entering) {
m_userInTeleop = 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
*/
public static void inTeleop(boolean entering) {
m_userInTeleop = entering;
}
/**
* Only to be used to tell the Driver Station what code you claim to be executing for diagnostic
* purposes only.

View File

@@ -229,9 +229,33 @@ public abstract class RobotBase implements AutoCloseable {
* controls.
*
* @return True if the robot is currently operating in Tele-Op mode.
* @deprecated Use isTeleop() instead.
*/
@Deprecated(since = "2022", forRemoval = true)
public boolean isOperatorControl() {
return DriverStation.isOperatorControl();
return DriverStation.isTeleop();
}
/**
* Determine if the robot is currently in Operator Control mode as determined by the field
* controls.
*
* @return True if the robot is currently operating in Tele-Op mode.
*/
public boolean isTeleop() {
return DriverStation.isTeleop();
}
/**
* Determine if the robot is current in Operator Control mode and enabled as determined by the
* field controls.
*
* @return True if the robot is currently operating in Tele-Op mode while enabled.
* @deprecated Use isTeleopEnabled() instead.
*/
@Deprecated(since = "2022", forRemoval = true)
public boolean isOperatorControlEnabled() {
return DriverStation.isTeleopEnabled();
}
/**
@@ -240,8 +264,8 @@ public abstract class RobotBase implements AutoCloseable {
*
* @return True if the robot is currently operating in Tele-Op mode while enabled.
*/
public boolean isOperatorControlEnabled() {
return DriverStation.isOperatorControlEnabled();
public boolean isTeleopEnabled() {
return DriverStation.isTeleopEnabled();
}
/**

View File

@@ -18,8 +18,13 @@ public final class RobotState {
return DriverStation.isEStopped();
}
@Deprecated
public static boolean isOperatorControl() {
return DriverStation.isOperatorControl();
return isTeleop();
}
public static boolean isTeleop() {
return DriverStation.isTeleop();
}
public static boolean isAutonomous() {