DriverStation Class Reference

#include <DriverStation.h>

Inheritance diagram for DriverStation:

Inheritance graph
[legend]
Collaboration diagram for DriverStation:

Collaboration graph
[legend]

List of all members.

Public Member Functions

float GetStickAxis (unsigned stick, unsigned axis)
short GetStickButtons (unsigned stick)
float GetAnalogIn (unsigned channel)
bool GetDigitalIn (unsigned channel)
void SetDigitalOut (unsigned channel, bool value)
bool GetDigitalOut (unsigned channel)
unsigned GetPacketNumber (void)
float GetBatteryVoltage (void)

Static Public Member Functions

static DriverStationGetInstance (void)

Protected Member Functions

 DriverStation (void)
void GetData (void)
void SetData (void)


Detailed Description

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

Constructor & Destructor Documentation

DriverStation::DriverStation ( void   )  [protected]

DriverStation contructor.

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


Member Function Documentation

DriverStation * DriverStation::GetInstance ( void   )  [static]

Return a pointer to the singleton DriverStation.

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

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

Parameters:
stick The joystick to read.
axis The analog axis value to read from the joystick.
Returns:
The value of the axis on the joystick.

short DriverStation::GetStickButtons ( unsigned  stick  ) 

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

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

float DriverStation::GetAnalogIn ( unsigned  channel  ) 

Get an analog voltage from the Driver Station. The analog values are returned as unsigned 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:
channel The analog input channel on the driver station to read from. Valid range is 1 - 4.
Returns:
The analog voltage on the input.

bool DriverStation::GetDigitalIn ( unsigned  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:
channel The digital input to get. Valid range is 1 - 8.

void DriverStation::SetDigitalOut ( unsigned  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:
channel The digital output to set. Valid range is 1 - 8.
value The state to set the digital output.

bool DriverStation::GetDigitalOut ( unsigned  channel  ) 

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

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

unsigned DriverStation::GetPacketNumber ( void   ) 

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.

float DriverStation::GetBatteryVoltage ( void   ) 

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.

void DriverStation::GetData ( void   )  [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.

void DriverStation::SetData ( void   )  [protected]

Copy status data from the DS task for the user. This is used primarily to set digital outputs on the DS.


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

Generated on Thu Oct 2 14:01:25 2008 for WPI Robotics Library by  doxygen 1.5.5