public class DriverStation extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DriverStation.Alliance
The robot alliance that the robot is a part of.
|
static class |
DriverStation.MatchType |
Modifier and Type | Field and Description |
---|---|
static int |
kJoystickPorts
Number of Joystick Ports.
|
Modifier and Type | Method and Description |
---|---|
DriverStation.Alliance |
getAlliance()
Get the current alliance from the FMS.
|
double |
getBatteryVoltage()
Deprecated.
Use RobotController.getBatteryVoltage
|
protected void |
getData()
Copy data from the DS task for the user.
|
java.lang.String |
getEventName()
Get the event name.
|
java.lang.String |
getGameSpecificMessage()
Get the game specific message.
|
static DriverStation |
getInstance()
Gets an instance of the DriverStation.
|
int |
getJoystickAxisType(int stick,
int axis)
Returns the types of Axes on a given joystick port.
|
boolean |
getJoystickIsXbox(int stick)
Gets the value of isXbox on a joystick.
|
java.lang.String |
getJoystickName(int stick)
Gets the name of the joystick at a port.
|
int |
getJoystickType(int stick)
Gets the value of type on a joystick.
|
int |
getLocation()
Gets the location of the team's driver station controls.
|
int |
getMatchNumber()
Get the match number.
|
double |
getMatchTime()
Return the approximate match time.
|
DriverStation.MatchType |
getMatchType()
Get the match type.
|
int |
getReplayNumber()
Get the replay number.
|
double |
getStickAxis(int stick,
int axis)
Get the value of the axis on a joystick.
|
int |
getStickAxisCount(int stick)
Returns the number of axes on a given joystick port.
|
boolean |
getStickButton(int stick,
int button)
The state of one joystick button.
|
int |
getStickButtonCount(int stick)
Gets the number of buttons on a joystick.
|
int |
getStickButtons(int stick)
The state of the buttons on the joystick.
|
int |
getStickPOV(int stick,
int pov)
Get the state of a POV on the joystick.
|
int |
getStickPOVCount(int stick)
Returns the number of POVs on a given joystick port.
|
void |
InAutonomous(boolean entering)
Only to be used to tell the Driver Station what code you claim to be executing for diagnostic
purposes only.
|
void |
InDisabled(boolean entering)
Only to be used to tell the Driver Station what code you claim to be executing for diagnostic
purposes only.
|
void |
InOperatorControl(boolean entering)
Only to be used to tell the Driver Station what code you claim to be executing for diagnostic
purposes only.
|
void |
InTest(boolean entering)
Only to be used to tell the Driver Station what code you claim to be executing for diagnostic
purposes only.
|
boolean |
isAutonomous()
Gets a value indicating whether the Driver Station requires the robot to be running in
autonomous mode.
|
boolean |
isBrownedOut()
Deprecated.
Use RobotController.isBrownedOut()
|
boolean |
isDisabled()
Gets a value indicating whether the Driver Station requires the robot to be disabled.
|
boolean |
isDSAttached()
Gets a value indicating whether the Driver Station is attached.
|
boolean |
isEnabled()
Gets a value indicating whether the Driver Station requires the robot to be enabled.
|
boolean |
isFMSAttached()
Gets if the driver station attached to a Field Management System.
|
boolean |
isNewControlData()
Gets if a new control packet from the driver station arrived since the last time this function
was called.
|
boolean |
isOperatorControl()
Gets a value indicating whether the Driver Station requires the robot to be running in
operator-controlled mode.
|
boolean |
isSysActive()
Deprecated.
Use RobotController.isSysActive()
|
boolean |
isTest()
Gets a value indicating whether the Driver Station requires the robot to be running in test
mode.
|
void |
release()
Kill the thread.
|
static void |
reportError(java.lang.String error,
boolean printTrace)
Report error to Driver Station.
|
static void |
reportError(java.lang.String error,
java.lang.StackTraceElement[] stackTrace)
Report error to Driver Station.
|
static void |
reportWarning(java.lang.String error,
boolean printTrace)
Report warning to Driver Station.
|
static void |
reportWarning(java.lang.String error,
java.lang.StackTraceElement[] stackTrace)
Report warning to Driver Station.
|
void |
waitForData()
Wait for new data from the driver station.
|
boolean |
waitForData(double timeout)
Wait for new data or for timeout, which ever comes first.
|
public static final int kJoystickPorts
public static DriverStation getInstance()
public void release()
public static void reportError(java.lang.String error, boolean printTrace)
printTrace
- If true, append stack trace to error stringpublic static void reportError(java.lang.String error, java.lang.StackTraceElement[] stackTrace)
stackTrace
- The stack trace to appendpublic static void reportWarning(java.lang.String error, boolean printTrace)
printTrace
- If true, append stack trace to warning stringpublic static void reportWarning(java.lang.String error, java.lang.StackTraceElement[] stackTrace)
stackTrace
- The stack trace to appendpublic boolean getStickButton(int stick, int button)
stick
- The joystick to read.button
- The button index, beginning at 1.public double getStickAxis(int stick, int axis)
stick
- The joystick to read.axis
- The analog axis value to read from the joystick.public int getStickPOV(int stick, int pov)
public int getStickButtons(int stick)
stick
- The joystick to read.public int getStickAxisCount(int stick)
stick
- The joystick port numberpublic int getStickPOVCount(int stick)
stick
- The joystick port numberpublic int getStickButtonCount(int stick)
stick
- The joystick port numberpublic boolean getJoystickIsXbox(int stick)
stick
- The joystick port numberpublic int getJoystickType(int stick)
stick
- The joystick port numberpublic java.lang.String getJoystickName(int stick)
stick
- The joystick port numberpublic int getJoystickAxisType(int stick, int axis)
stick
- The joystick port numberaxis
- The target axispublic boolean isEnabled()
public boolean isDisabled()
public boolean isAutonomous()
public boolean isOperatorControl()
public boolean isTest()
public boolean isDSAttached()
public boolean isNewControlData()
public boolean isFMSAttached()
@Deprecated public boolean isSysActive()
@Deprecated public boolean isBrownedOut()
public java.lang.String getGameSpecificMessage()
public java.lang.String getEventName()
public DriverStation.MatchType getMatchType()
public int getMatchNumber()
public int getReplayNumber()
public DriverStation.Alliance getAlliance()
public int getLocation()
public void waitForData()
public boolean waitForData(double timeout)
timeout
- The maximum time in seconds to wait.public double getMatchTime()
@Deprecated public double getBatteryVoltage()
public void InDisabled(boolean entering)
entering
- If true, starting disabled code; if false, leaving disabled codepublic void InAutonomous(boolean entering)
entering
- If true, starting autonomous code; if false, leaving autonomous codepublic void InOperatorControl(boolean entering)
entering
- If true, starting teleop code; if false, leaving teleop codepublic void InTest(boolean entering)
entering
- If true, starting test code; if false, leaving test codeprotected void getData()