|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.DriverStation
public class DriverStation
Provide access to the network communication data to / from the Driver Station.
Nested Class Summary | |
---|---|
static class |
DriverStation.Alliance
The robot alliance that the robot is a part of |
Field Summary | |
---|---|
static int |
kBatteryChannel
Analog channel to read the battery |
static int |
kBatterySlot
Slot for the analog module to read the battery |
static double |
kDSAnalogInScaling
Convert from raw values to volts |
static int |
kJoystickAxes
Number of Joystick Axes |
static int |
kJoystickPorts
Number of Joystick Ports |
static int |
USER_CONTROL_DATA_SIZE
The size of the user control data |
static int |
USER_STATUS_DATA_SIZE
The size of the user status data |
Constructor Summary | |
---|---|
protected |
DriverStation()
DriverStation constructor. |
Method Summary | |
---|---|
DriverStation.Alliance |
getAlliance()
Get the current alliance from the FMS |
double |
getAnalogIn(int channel)
Get an analog voltage from the Driver Station. |
double |
getBatteryVoltage()
Read the battery voltage from the specified AnalogChannel. |
Dashboard |
getDashboardPackerHigh()
Gets the default dashboard packer for sending high priority user data to a dashboard receiver. |
IDashboard |
getDashboardPackerInUseHigh()
Gets the dashboard packer that's currently in use for sending high priority user data to a dashboard receiver. |
IDashboard |
getDashboardPackerInUseLow()
Gets the dashboard packer that's currently in use for sending low priority user data to a dashboard receiver. |
Dashboard |
getDashboardPackerLow()
Gets the default dashboard packer for sending low priority user data to a dashboard receiver. |
protected void |
getData()
Copy data from the DS task for the user. |
boolean |
getDigitalIn(int channel)
Get values from the digital inputs on the Driver Station. |
boolean |
getDigitalOut(int channel)
Get a value that was set for the digital outputs on the Driver Station. |
DriverStationEnhancedIO |
getEnhancedIO()
Get the interface to the enhanced IO of the new driver station. |
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 currently send the official match time to the robots This returns the time since the enable signal sent from the Driver Station At the beginning of autonomous, the time is reset to 0.0 seconds At the beginning of teleop, the time is reset to +15.0 seconds If the robot is disabled, this returns 0.0 seconds Warning: This is not an official time (so it cannot be used to argue with referees) |
int |
getPacketNumber()
Return the DS packet number. |
java.lang.Object |
getStatusDataMonitor()
Gets the status data monitor |
double |
getStickAxis(int stick,
int axis)
Get the value of the axis on a joystick. |
int |
getStickButtons(int stick)
The state of the buttons on the joystick. |
int |
getTeamNumber()
Return the team number that the Driver Station is configured for |
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 |
isDisabled()
Gets a value indicating whether the Driver Station requires the robot to be disabled. |
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 |
isTest()
Gets a value indicating whether the Driver Station requires the robot to be running in test mode. |
void |
release()
Kill the thread |
void |
setDashboardPackerToUseHigh(IDashboard dashboard)
Sets the dashboard packer to use for sending high priority user data to a dashboard receiver. |
void |
setDashboardPackerToUseLow(IDashboard dashboard)
Sets the dashboard packer to use for sending low priority user data to a dashboard receiver. |
protected void |
setData()
Copy status data from the DS task for the user. |
void |
setDigitalOut(int channel,
boolean value)
Set a value for the digital outputs on the 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int USER_CONTROL_DATA_SIZE
public static final int USER_STATUS_DATA_SIZE
public static final int kBatterySlot
public static final int kBatteryChannel
public static final int kJoystickPorts
public static final int kJoystickAxes
public static final double kDSAnalogInScaling
Constructor Detail |
---|
protected DriverStation()
Method Detail |
---|
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()
protected void setData()
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 getStickButtons(int stick)
stick
- The joystick to read.
public double getAnalogIn(int channel)
channel
- The analog input channel on the driver station to read from. Valid range is 1 - 4.
public boolean getDigitalIn(int channel)
channel
- The digital input to get. Valid range is 1 - 8.
public void setDigitalOut(int channel, boolean value)
channel
- The digital output to set. Valid range is 1 - 8.value
- The state to set the digital output.public boolean getDigitalOut(int channel)
channel
- The digital ouput to monitor. Valid range is 1 through 8.
public boolean isEnabled()
public boolean isDisabled()
public boolean isAutonomous()
public boolean isTest()
public boolean isOperatorControl()
public boolean isNewControlData()
public int getPacketNumber()
public DriverStation.Alliance getAlliance()
public int getLocation()
public int getTeamNumber()
public void setDashboardPackerToUseHigh(IDashboard dashboard)
setDashboardPackerToUseHigh(getDashboardPackerHigh())
.)
dashboard
- any kind of IDashboard objectpublic Dashboard getDashboardPackerHigh()
setDashboardPackerToUseHigh(edu.wpi.first.wpilibj.IDashboard)
changes which packer is in use.
public IDashboard getDashboardPackerInUseHigh()
public void setDashboardPackerToUseLow(IDashboard dashboard)
dashboard
- any kind of IDashboard objectpublic Dashboard getDashboardPackerLow()
setDashboardPackerToUseLow(edu.wpi.first.wpilibj.IDashboard)
changes which packer is in use.
public IDashboard getDashboardPackerInUseLow()
public java.lang.Object getStatusDataMonitor()
public boolean isFMSAttached()
public DriverStationEnhancedIO getEnhancedIO()
public double getMatchTime()
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 code
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |