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.
|
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()
Read the battery voltage.
|
protected void |
getData()
Copy data from the DS task for the user.
|
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.
|
double |
getMatchTime()
Return the approximate match time The FMS does not send an official match time to the robots,
but does send an approximate match time.
|
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,
byte 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()
Check if the system is browned out.
|
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() |
boolean |
isNewControlData()
Has 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()
Gets a value indicating whether the FPGA outputs are enabled.
|
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 |
reportWarning(java.lang.String error,
boolean printTrace)
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 reportWarning(java.lang.String error, boolean printTrace)
printTrace
- If true, append stack trace to warning stringpublic 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 boolean getStickButton(int stick, byte button)
stick
- The joystick to read.button
- The button index, beginning at 1.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()
public boolean isSysActive()
public boolean isBrownedOut()
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()
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()