public class DriverStation extends 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 | Constructor and Description |
---|---|
protected |
DriverStation()
DriverStation constructor.
|
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 |
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() |
boolean |
isEnabled()
Gets a value indicating whether the Driver Station requires the
robot to be enabled.
|
boolean |
isFMSAttached()
Is the driver station attached to a Field Management System?
Note: This does not work with the Blue DS.
|
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(String error,
boolean printTrace)
Report error to Driver Station.
|
void |
waitForData()
Wait for new data from the driver station.
|
void |
waitForData(long timeout)
Wait for new data or for timeout, which ever comes first.
|
public static final int kJoystickPorts
protected DriverStation()
public static DriverStation getInstance()
public void release()
public void waitForData()
public void waitForData(long timeout)
timeout
- The maximum time in milliseconds to wait.protected void getData()
public double getBatteryVoltage()
public double getStickAxis(int stick, int axis)
stick
- The joystick to read.axis
- The analog axis value to read from the joystick.public int getStickAxisCount(int stick)
stick
- The joystick port numberpublic int getStickPOV(int stick, int pov)
public int getStickPOVCount(int stick)
stick
- The joystick port numberpublic 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 getStickButtonCount(int stick)
stick
- The joystick port numberpublic boolean isEnabled()
public boolean isDisabled()
public boolean isAutonomous()
public boolean isTest()
public boolean isOperatorControl()
public boolean isSysActive()
public boolean isBrownedOut()
public boolean isNewControlData()
public DriverStation.Alliance getAlliance()
public int getLocation()
public boolean isFMSAttached()
public boolean isDSAttached()
public double getMatchTime()
public static void reportError(String error, boolean printTrace)
printTrace
- If true, append stack trace to error stringpublic 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 codeCopyright © 2015. All rights reserved.