Now you can download a copy of these docs so you can use them offline! Download now

#include <DriverStation.h>

Inheritance diagram for DriverStation:
Collaboration diagram for DriverStation:

Public Types

enum  Alliance { kRed, kBlue, kInvalid }

Public Member Functions

float GetStickAxis (UINT32 stick, UINT32 axis)
short GetStickButtons (UINT32 stick)
float GetAnalogIn (UINT32 channel)
bool GetDigitalIn (UINT32 channel)
void SetDigitalOut (UINT32 channel, bool value)
bool GetDigitalOut (UINT32 channel)
bool IsEnabled ()
bool IsDisabled ()
bool IsAutonomous ()
bool IsOperatorControl ()
bool IsTest ()
bool IsNewControlData ()
bool IsFMSAttached ()
UINT32 GetPacketNumber ()
Alliance GetAlliance ()
UINT32 GetLocation ()
void WaitForData ()
double GetMatchTime ()
float GetBatteryVoltage ()
UINT16 GetTeamNumber ()
DashboardGetHighPriorityDashboardPacker ()
DashboardGetLowPriorityDashboardPacker ()
DashboardBaseGetHighPriorityDashboardPackerInUse ()
DashboardBaseGetLowPriorityDashboardPackerInUse ()
void SetHighPriorityDashboardPackerToUse (DashboardBase *db)
void SetLowPriorityDashboardPackerToUse (DashboardBase *db)
DriverStationEnhancedIOGetEnhancedIO ()
void IncrementUpdateNumber ()
SEM_ID GetUserStatusDataSem ()
void InDisabled (bool entering)
void InAutonomous (bool entering)
void InOperatorControl (bool entering)
void InTest (bool entering)
- Public Member Functions inherited from SensorBase
 SensorBase ()
virtual ~SensorBase ()
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
virtual const ErrorGetError () const
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable.
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated from the nivision Imaq API.
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void CloneError (ErrorBase *rhs) const
virtual void ClearError () const
 Clear the current error information associated with this sensor.
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error.

Static Public Member Functions

static DriverStationGetInstance ()
- Static Public Member Functions inherited from SensorBase
static void DeleteSingletons ()
static UINT32 GetDefaultAnalogModule ()
static UINT32 GetDefaultDigitalModule ()
static UINT32 GetDefaultSolenoidModule ()
static bool CheckAnalogModule (UINT8 moduleNumber)
static bool CheckDigitalModule (UINT8 moduleNumber)
static bool CheckPWMModule (UINT8 moduleNumber)
static bool CheckRelayModule (UINT8 moduleNumber)
static bool CheckSolenoidModule (UINT8 moduleNumber)
static bool CheckDigitalChannel (UINT32 channel)
static bool CheckRelayChannel (UINT32 channel)
static bool CheckPWMChannel (UINT32 channel)
static bool CheckAnalogChannel (UINT32 channel)
static bool CheckSolenoidChannel (UINT32 channel)
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static ErrorGetGlobalError ()

Static Public Attributes

static const UINT32 kBatteryModuleNumber = 1
static const UINT32 kBatteryChannel = 8
static const UINT32 kJoystickPorts = 4
static const UINT32 kJoystickAxes = 6
- Static Public Attributes inherited from SensorBase
static const UINT32 kSystemClockTicksPerMicrosecond = 40
static const UINT32 kDigitalChannels = 14
static const UINT32 kAnalogChannels = 8
static const UINT32 kAnalogModules = 2
static const UINT32 kDigitalModules = 2
static const UINT32 kSolenoidChannels = 8
static const UINT32 kSolenoidModules = 2
static const UINT32 kPwmChannels = 10
static const UINT32 kRelayChannels = 8
static const UINT32 kChassisSlots = 8

Protected Member Functions

 DriverStation ()
void GetData ()
void SetData ()
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.

Additional Inherited Members

- Protected Attributes inherited from ErrorBase
Error m_error
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
static Error _globalError

Detailed Description

Provide access to the network communication data to / from the Driver Station.

Definition at line 21 of file DriverStation.h.

Constructor & Destructor Documentation

DriverStation::DriverStation ( )
protected

DriverStation contructor.

This is only called once the first time GetInstance() is called

Definition at line 31 of file DriverStation.cpp.

Member Function Documentation

DriverStation::Alliance DriverStation::GetAlliance ( )

Return the alliance that the driver station says it is on. This could return kRed or kBlue

Returns
The Alliance enum

Definition at line 453 of file DriverStation.cpp.

float DriverStation::GetAnalogIn ( UINT32  channel)

Get an analog voltage from the Driver Station. The analog values are returned as voltage values for the Driver Station analog inputs. These inputs are typically used for advanced operator interfaces consisting of potentiometers or resistor networks representing values on a rotary switch.

Parameters
channelThe analog input channel on the driver station to read from. Valid range is 1 - 4.
Returns
The analog voltage on the input.

Definition at line 306 of file DriverStation.cpp.

float DriverStation::GetBatteryVoltage ( )

Read the battery voltage from the specified AnalogChannel.

This accessor assumes that the battery voltage is being measured through the voltage divider on an analog breakout.

Returns
The battery voltage.

Definition at line 208 of file DriverStation.cpp.

void DriverStation::GetData ( )
protected

Copy data from the DS task for the user. If no new data exists, it will just be returned, otherwise the data will be copied from the DS polling loop.

Definition at line 159 of file DriverStation.cpp.

bool DriverStation::GetDigitalIn ( UINT32  channel)

Get values from the digital inputs on the Driver Station. Return digital values from the Drivers Station. These values are typically used for buttons and switches on advanced operator interfaces.

Parameters
channelThe digital input to get. Valid range is 1 - 8.

Definition at line 338 of file DriverStation.cpp.

bool DriverStation::GetDigitalOut ( UINT32  channel)

Get a value that was set for the digital outputs on the Driver Station.

Parameters
channelThe digital ouput to monitor. Valid range is 1 through 8.
Returns
A digital value being output on the Drivers Station.

Definition at line 383 of file DriverStation.cpp.

DriverStation * DriverStation::GetInstance ( )
static

Return a pointer to the singleton DriverStation.

Definition at line 145 of file DriverStation.cpp.

UINT32 DriverStation::GetLocation ( )

Return the driver station location on the field This could return 1, 2, or 3

Returns
The location of the driver station

Definition at line 466 of file DriverStation.cpp.

double DriverStation::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)

Returns
Match time in seconds since the beginning of autonomous

Definition at line 492 of file DriverStation.cpp.

UINT32 DriverStation::GetPacketNumber ( )

Return the DS packet number. The packet number is the index of this set of data returned by the driver station. Each time new data is received, the packet number (included with the sent data) is returned.

Returns
The driver station packet number

Definition at line 443 of file DriverStation.cpp.

float DriverStation::GetStickAxis ( UINT32  stick,
UINT32  axis 
)

Get the value of the axis on a joystick. This depends on the mapping of the joystick connected to the specified port.

Parameters
stickThe joystick to read.
axisThe analog axis value to read from the joystick.
Returns
The value of the axis on the joystick.

Definition at line 227 of file DriverStation.cpp.

short DriverStation::GetStickButtons ( UINT32  stick)

The state of the buttons on the joystick. 12 buttons (4 msb are unused) from the joystick.

Parameters
stickThe joystick to read.
Returns
The state of the buttons on the joystick.

Definition at line 275 of file DriverStation.cpp.

UINT16 DriverStation::GetTeamNumber ( )

Return the team number that the Driver Station is configured for

Returns
The team number

Definition at line 503 of file DriverStation.cpp.

void DriverStation::InAutonomous ( bool  entering)
inline

Only to be used to tell the Driver Station what code you claim to be executing for diagnostic purposes only

Parameters
enteringIf true, starting autonomous code; if false, leaving autonomous code

Definition at line 87 of file DriverStation.h.

void DriverStation::InDisabled ( bool  entering)
inline

Only to be used to tell the Driver Station what code you claim to be executing for diagnostic purposes only

Parameters
enteringIf true, starting disabled code; if false, leaving disabled code

Definition at line 83 of file DriverStation.h.

void DriverStation::InOperatorControl ( bool  entering)
inline

Only to be used to tell the Driver Station what code you claim to be executing for diagnostic purposes only

Parameters
enteringIf true, starting teleop code; if false, leaving teleop code

Definition at line 91 of file DriverStation.h.

void DriverStation::InTest ( bool  entering)
inline

Only to be used to tell the Driver Station what code you claim to be executing for diagnostic purposes only

Parameters
enteringIf true, starting test code; if false, leaving test code

Definition at line 95 of file DriverStation.h.

bool DriverStation::IsFMSAttached ( )

Is the driver station attached to a Field Management System? Note: This does not work with the Blue DS.

Returns
True if the robot is competing on a field being controlled by a Field Management System

Definition at line 432 of file DriverStation.cpp.

bool DriverStation::IsNewControlData ( )

Has a new control packet from the driver station arrived since the last time this function was called? Warning: If you call this function from more than one place at the same time, you will not get the get the intended behavior

Returns
True if the control data has been updated since the last call.

Definition at line 422 of file DriverStation.cpp.

void DriverStation::SetData ( )
protected

Copy status data from the DS task for the user.

Definition at line 182 of file DriverStation.cpp.

void DriverStation::SetDigitalOut ( UINT32  channel,
bool  value 
)

Set a value for the digital outputs on the Driver Station.

Control digital outputs on the Drivers Station. These values are typically used for giving feedback on a custom operator station such as LEDs.

Parameters
channelThe digital output to set. Valid range is 1 - 8.
valueThe state to set the digital output.

Definition at line 362 of file DriverStation.cpp.

void DriverStation::WaitForData ( )

Wait until a new packet comes from the driver station This blocks on a semaphore, so the waiting is efficient. This is a good way to delay processing until there is new driver station data to act on

Definition at line 477 of file DriverStation.cpp.


The documentation for this class was generated from the following files:

Generated on Tue Feb 5 2013 00:55:10 for WPILibC++ by doxygen 1.8.1.2