#include <DriverStation.h>
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 DriverStation * | GetInstance (void) |
Protected Member Functions | |
DriverStation (void) | |
void | GetData (void) |
void | SetData (void) |
DriverStation::DriverStation | ( | void | ) | [protected] |
DriverStation contructor.
This is only called once the first time GetInstance() is called
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.
stick | The joystick to read. | |
axis | The analog axis value to read from the joystick. |
short DriverStation::GetStickButtons | ( | unsigned | stick | ) |
The state of the buttons on the joystick. 12 buttons (4 msb are unused) from the joystick.
stick | The joystick to read. |
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.
channel | The analog input channel on the driver station to read from. Valid range is 1 - 4. |
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.
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.
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.
channel | The digital ouput to monitor. Valid range is 1 through 8. |
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.
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.