WPILibC++
2018.4.1-20180825000225-1177-gc8482cd
|
Classes | |
struct | HAL_ControlWord |
struct | HAL_JoystickAxes |
struct | HAL_JoystickPOVs |
struct | HAL_JoystickButtons |
struct | HAL_JoystickDescriptor |
struct | HAL_MatchInfo |
Typedefs | |
typedef struct HAL_ControlWord | HAL_ControlWord |
typedef struct HAL_JoystickAxes | HAL_JoystickAxes |
typedef struct HAL_JoystickPOVs | HAL_JoystickPOVs |
typedef struct HAL_JoystickButtons | HAL_JoystickButtons |
typedef struct HAL_JoystickDescriptor | HAL_JoystickDescriptor |
typedef struct HAL_MatchInfo | HAL_MatchInfo |
Functions | |
HAL_ENUM (HAL_AllianceStationID) | |
HAL_ENUM (HAL_MatchType) | |
int32_t | HAL_SendError (HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode, const char *details, const char *location, const char *callStack, HAL_Bool printMsg) |
Sends an error to the driver station. More... | |
int32_t | HAL_GetControlWord (HAL_ControlWord *controlWord) |
Gets the current control word of the driver station. More... | |
HAL_AllianceStationID | HAL_GetAllianceStation (int32_t *status) |
Gets the current alliance station ID. More... | |
int32_t | HAL_GetJoystickAxes (int32_t joystickNum, HAL_JoystickAxes *axes) |
Gets the axes of a specific joystick. More... | |
int32_t | HAL_GetJoystickPOVs (int32_t joystickNum, HAL_JoystickPOVs *povs) |
Gets the POVs of a specific joystick. More... | |
int32_t | HAL_GetJoystickButtons (int32_t joystickNum, HAL_JoystickButtons *buttons) |
Gets the buttons of a specific joystick. More... | |
int32_t | HAL_GetJoystickDescriptor (int32_t joystickNum, HAL_JoystickDescriptor *desc) |
Retrieves the Joystick Descriptor for particular slot. More... | |
HAL_Bool | HAL_GetJoystickIsXbox (int32_t joystickNum) |
Gets is a specific joystick is considered to be an XBox controller. More... | |
int32_t | HAL_GetJoystickType (int32_t joystickNum) |
Gets the type of joystick connected. More... | |
char * | HAL_GetJoystickName (int32_t joystickNum) |
Gets the name of a joystick. More... | |
void | HAL_FreeJoystickName (char *name) |
Frees a joystick name received with HAL_GetJoystickName. More... | |
int32_t | HAL_GetJoystickAxisType (int32_t joystickNum, int32_t axis) |
Gets the type of a specific joystick axis. More... | |
int32_t | HAL_SetJoystickOutputs (int32_t joystickNum, int64_t outputs, int32_t leftRumble, int32_t rightRumble) |
Set joystick outputs. More... | |
double | HAL_GetMatchTime (int32_t *status) |
Returns the approximate match time. More... | |
int32_t | HAL_GetMatchInfo (HAL_MatchInfo *info) |
Gets info about a specific match. More... | |
void | HAL_ReleaseDSMutex (void) |
Releases the DS Mutex to allow proper shutdown of any threads that are waiting on it. | |
HAL_Bool | HAL_IsNewControlData (void) |
Has a new control packet from the driver station arrived since the last time this function was called? More... | |
void | HAL_WaitForDSData (void) |
Waits for the newest DS packet to arrive. More... | |
HAL_Bool | HAL_WaitForDSDataTimeout (double timeout) |
Waits for the newest DS packet to arrive. More... | |
void | HAL_InitializeDriverStation (void) |
Initializes the driver station communication. More... | |
void | HAL_ObserveUserProgramStarting (void) |
Sets the program starting flag in the DS. More... | |
void | HAL_ObserveUserProgramDisabled (void) |
Sets the disabled flag in the DS. More... | |
void | HAL_ObserveUserProgramAutonomous (void) |
Sets the autonomous enabled flag in the DS. More... | |
void | HAL_ObserveUserProgramTeleop (void) |
Sets the teleoperated enabled flag in the DS. More... | |
void | HAL_ObserveUserProgramTest (void) |
Sets the test mode flag in the DS. More... | |
void HAL_FreeJoystickName | ( | char * | name | ) |
Frees a joystick name received with HAL_GetJoystickName.
name | the name storage |
HAL_AllianceStationID HAL_GetAllianceStation | ( | int32_t * | status | ) |
Gets the current alliance station ID.
status | the error code, or 0 for success |
int32_t HAL_GetControlWord | ( | HAL_ControlWord * | controlWord | ) |
Gets the current control word of the driver station.
The control work contains the robot state.
controlWord | the control word (out) |
int32_t HAL_GetJoystickAxes | ( | int32_t | joystickNum, |
HAL_JoystickAxes * | axes | ||
) |
Gets the axes of a specific joystick.
joystickNum | the joystick number |
axes | the axes values (output) |
int32_t HAL_GetJoystickAxisType | ( | int32_t | joystickNum, |
int32_t | axis | ||
) |
Gets the type of a specific joystick axis.
This is device specific, and different depending on what system input type the joystick uses.
joystickNum | the joystick number |
axis | the axis number |
int32_t HAL_GetJoystickButtons | ( | int32_t | joystickNum, |
HAL_JoystickButtons * | buttons | ||
) |
Gets the buttons of a specific joystick.
joystickNum | the joystick number |
buttons | the button values (output) |
int32_t HAL_GetJoystickDescriptor | ( | int32_t | joystickNum, |
HAL_JoystickDescriptor * | desc | ||
) |
Retrieves the Joystick Descriptor for particular slot.
desc | [out] descriptor (data transfer object) to fill in. desc is filled in regardless of success. In other words, if descriptor is not available, desc is filled in with default values matching the init-values in Java and C++ Driverstation for when caller requests a too-large joystick index. |
HAL_Bool HAL_GetJoystickIsXbox | ( | int32_t | joystickNum | ) |
Gets is a specific joystick is considered to be an XBox controller.
joystickNum | the joystick number |
char* HAL_GetJoystickName | ( | int32_t | joystickNum | ) |
Gets the name of a joystick.
The returned array must be freed with HAL_FreeJoystickName.
Will be null terminated.
joystickNum | the joystick number |
int32_t HAL_GetJoystickPOVs | ( | int32_t | joystickNum, |
HAL_JoystickPOVs * | povs | ||
) |
Gets the POVs of a specific joystick.
joystickNum | the joystick number |
povs | the POV values (output) |
int32_t HAL_GetJoystickType | ( | int32_t | joystickNum | ) |
Gets the type of joystick connected.
This is device specific, and different depending on what system input type the joystick uses.
joystickNum | the joystick number |
int32_t HAL_GetMatchInfo | ( | HAL_MatchInfo * | info | ) |
Gets info about a specific match.
info | the match info (output) |
double HAL_GetMatchTime | ( | int32_t * | status | ) |
Returns the approximate match time.
The FMS does not send an official match time to the robots, but does send an approximate match time. The value will count down the time remaining in the current period (auto or teleop).
Warning: This is not an official time (so it cannot be used to dispute ref calls or guarantee that a function will trigger before the match ends).
The Practice Match function of the DS approximates the behaviour seen on the field.
status | the error code, or 0 for success |
void HAL_InitializeDriverStation | ( | void | ) |
Initializes the driver station communication.
This will properly handle multiple calls. However note that this CANNOT be called from a library that interfaces with LabVIEW.
HAL_Bool HAL_IsNewControlData | ( | void | ) |
Has a new control packet from the driver station arrived since the last time this function was called?
void HAL_ObserveUserProgramAutonomous | ( | void | ) |
Sets the autonomous enabled flag in the DS.
This is used for the DS to ensure the robot is properly responding to its state request. Ensure this get called about every 50ms, or the robot will be disabled by the DS.
void HAL_ObserveUserProgramDisabled | ( | void | ) |
Sets the disabled flag in the DS.
This is used for the DS to ensure the robot is properly responding to its state request. Ensure this get called about every 50ms, or the robot will be disabled by the DS.
void HAL_ObserveUserProgramStarting | ( | void | ) |
Sets the program starting flag in the DS.
This is what changes the DS to showing robot code ready.
void HAL_ObserveUserProgramTeleop | ( | void | ) |
Sets the teleoperated enabled flag in the DS.
This is used for the DS to ensure the robot is properly responding to its state request. Ensure this get called about every 50ms, or the robot will be disabled by the DS.
void HAL_ObserveUserProgramTest | ( | void | ) |
Sets the test mode flag in the DS.
This is used for the DS to ensure the robot is properly responding to its state request. Ensure this get called about every 50ms, or the robot will be disabled by the DS.
int32_t HAL_SendError | ( | HAL_Bool | isError, |
int32_t | errorCode, | ||
HAL_Bool | isLVCode, | ||
const char * | details, | ||
const char * | location, | ||
const char * | callStack, | ||
HAL_Bool | printMsg | ||
) |
Sends an error to the driver station.
isError | true for error, false for warning |
errorCode | the error code |
isLVCode | true for a LV error code, false for a standard error code |
details | the details of the error |
location | the file location of the errror |
callstack | the callstack of the error |
printMsg | true to print the error message to stdout as well as to the DS |
int32_t HAL_SetJoystickOutputs | ( | int32_t | joystickNum, |
int64_t | outputs, | ||
int32_t | leftRumble, | ||
int32_t | rightRumble | ||
) |
Set joystick outputs.
joystickNum | the joystick numer |
outputs | bitmask of outputs, 1 for on 0 for off |
leftRumble | the left rumble value (0-FFFF) |
rightRumble | the right rumble value (0-FFFF) |
void HAL_WaitForDSData | ( | void | ) |
Waits for the newest DS packet to arrive.
Note that this is a blocking call.
HAL_Bool HAL_WaitForDSDataTimeout | ( | double | timeout | ) |
Waits for the newest DS packet to arrive.
If timeout is <= 0, this will wait forever. Otherwise, it will wait until either a new packet, or the timeout time has passed.
timeout | timeout in seconds |