mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
@@ -123,8 +123,6 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
});
|
||||
}
|
||||
|
||||
protected final DriverStation m_ds;
|
||||
|
||||
/**
|
||||
* Constructor for a generic robot program. User code should be placed in the constructor that
|
||||
* runs before the Autonomous or Operator Control period starts. The constructor will run to
|
||||
@@ -144,7 +142,6 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
} else {
|
||||
inst.startServer();
|
||||
}
|
||||
m_ds = DriverStation.getInstance();
|
||||
inst.getTable("LiveWindow").getSubTable(".status").getEntry("LW Enabled").setBoolean(false);
|
||||
|
||||
LiveWindow.setEnabled(false);
|
||||
@@ -182,7 +179,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the Robot is currently disabled by the field controls.
|
||||
*/
|
||||
public boolean isDisabled() {
|
||||
return m_ds.isDisabled();
|
||||
return DriverStation.isDisabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +188,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the Robot is currently enabled by the field controls.
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return m_ds.isEnabled();
|
||||
return DriverStation.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +197,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the robot is currently operating Autonomously.
|
||||
*/
|
||||
public boolean isAutonomous() {
|
||||
return m_ds.isAutonomous();
|
||||
return DriverStation.isAutonomous();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +207,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the robot is currently operating autonomously while enabled.
|
||||
*/
|
||||
public boolean isAutonomousEnabled() {
|
||||
return m_ds.isAutonomousEnabled();
|
||||
return DriverStation.isAutonomousEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +216,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the robot is currently operating in Test mode.
|
||||
*/
|
||||
public boolean isTest() {
|
||||
return m_ds.isTest();
|
||||
return DriverStation.isTest();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +226,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the robot is currently operating in Tele-Op mode.
|
||||
*/
|
||||
public boolean isOperatorControl() {
|
||||
return m_ds.isOperatorControl();
|
||||
return DriverStation.isOperatorControl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +236,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return True if the robot is currently operating in Tele-Op mode while enabled.
|
||||
*/
|
||||
public boolean isOperatorControlEnabled() {
|
||||
return m_ds.isOperatorControlEnabled();
|
||||
return DriverStation.isOperatorControlEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,7 +245,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
* @return Has new data arrived over the network since the last time this function was called?
|
||||
*/
|
||||
public boolean isNewDataAvailable() {
|
||||
return m_ds.isNewControlData();
|
||||
return DriverStation.isNewControlData();
|
||||
}
|
||||
|
||||
/** Provide an alternate "main loop" via startCompetition(). */
|
||||
|
||||
Reference in New Issue
Block a user