LibDS
Qt-based library for controlling FRC robots
|
Implements the FRC 2015-2019 communication protocol. More...
#include <FRC_2015.h>
Public Member Functions | |
FRC_2015 () | |
virtual QString | name () |
virtual int | fmsFrequency () |
virtual int | robotFrequency () |
virtual int | fmsInputPort () |
virtual int | fmsOutputPort () |
virtual int | robotInputPort () |
virtual int | robotOutputPort () |
virtual int | netconsoleInputPort () |
virtual int | maxPOVCount () |
virtual int | maxAxisCount () |
virtual int | maxButtonCount () |
virtual int | maxJoystickCount () |
virtual void | rebootRobot () |
virtual void | restartRobotCode () |
virtual void | onRobotWatchdogExpired () |
virtual qreal | nominalBatteryVoltage () |
virtual qreal | nominalBatteryAmperage () |
virtual DS::SocketType | fmsSocketType () |
virtual DS::SocketType | robotSocketType () |
virtual QString | radioAddress () |
virtual QString | robotAddress () |
virtual QByteArray | getFMSPacket () |
virtual QByteArray | getRobotPacket () |
virtual bool | interpretFMSPacket (const QByteArray &data) |
virtual bool | interpretRobotPacket (const QByteArray &data) |
Public Member Functions inherited from Protocol | |
virtual int | radioFrequency () |
virtual int | radioInputPort () |
virtual int | radioOutputPort () |
virtual int | netconsoleOutputPort () |
virtual qreal | nominalBatteryVOltage () |
virtual void | onFMSWatchdogExpired () |
virtual void | onRadioWatchdogExpired () |
virtual DS::SocketType | radioSocketType () |
virtual QString | fmsAddress () |
QByteArray | generateFMSPacket () |
QByteArray | generateRadioPacket () |
QByteArray | generateRobotPacket () |
bool | readFMSPacket (const QByteArray &data) |
bool | readRadioPacket (const QByteArray &data) |
bool | readRobotPacket (const QByteArray &data) |
void | resetLossCounter () |
int | sentFMSPackets () |
int | sentRadioPackets () |
int | sentRobotPackets () |
int | receivedFMSPackets () |
int | receivedRadioPackets () |
int | receivedRobotPackets () |
int | recvRobotPacketsSinceConnect () |
int | sentRobotPacketsSinceConnect () |
Protected Member Functions | |
virtual QByteArray | getTimezoneData () |
virtual QByteArray | getJoystickData () |
virtual DS::Alliance | getAlliance (DS_UByte station) |
virtual DS::Position | getPosition (DS_UByte station) |
virtual void | readExtended (const QByteArray &data) |
virtual DS_UByte | getControlCode () |
virtual DS_UByte | getRequestCode () |
virtual DS_UByte | getFMSControlCode () |
virtual DS_UByte | getTeamStationCode () |
virtual DS_UByte | getJoystickSize (const DS::Joystick &joystick) |
Protected Member Functions inherited from Protocol | |
DS_Config * | config () |
DS_Joysticks * | joysticks () |
virtual QByteArray | getRadioPacket () |
virtual bool | interpretRadioPacket (const QByteArray &data) |
Private Attributes | |
bool | m_restartCode |
bool | m_rebootRobot |
bool | m_sendDateTime |
Implements the FRC 2015-2019 communication protocol.
|
explicit |
Implements the 2015 FRC Communication protocol
|
virtual |
Send 2 FMS packets every second
Reimplemented from Protocol.
|
virtual |
We receive data from FMS at local port 1120
Reimplemented from Protocol.
|
virtual |
We send data to the FMS to remote port 1160
Reimplemented from Protocol.
|
virtual |
FMS communications work with UDP datagrams
Reimplemented from Protocol.
References DS::kSocketTypeUDP.
|
protectedvirtual |
This function returns the alliance color referenced by the given station code. This function is used to follow the instructions outlined by the FMS packets.
References DS::kAllianceBlue, and DS::kAllianceRed.
|
protectedvirtual |
Returns the control code sent to the robot. This code contains the following information:
References DS::kControlAutonomous, DS::kControlTeleoperated, and DS::kControlTest.
|
protectedvirtual |
Returns the control code sent to the FMS. This code is very similar to the control code sent to the robot, however, it contains addional information regarding the robot radio.
This code contains the following information:
References DS::kControlAutonomous, DS::kControlTeleoperated, and DS::kControlTest.
|
virtual |
|
protectedvirtual |
Constructs a joystick information structure for every attached joystick. Unlike the 2014 protocol, the 2015 protocol only generates joystick data for the attached joysticks.
This information is separated with a joystick header code (specified at the top of this file).
|
protectedvirtual |
Returns the size of the given joystick. This function is used to generate joystick data (which is sent to the robot).
This information will help the robot decide where a information starts and ends for each attached joystick.
References DS::Joystick::numAxes, DS::Joystick::numButtons, and DS::Joystick::numPOVs.
|
protectedvirtual |
This function returns the position referenced by the given station code. This function is used to follow the instructions outlined by the FMS packets.
References DS::kPosition1, DS::kPosition2, and DS::kPosition3.
|
protectedvirtual |
Generates the request code sent to the robot, which may instruct it to:
|
virtual |
|
protectedvirtual |
Returns the team station code sent to the robot. This value may be used by the robot program to use specialized autonomous modes or adjust sensor input.
References DS::kAllianceRed, DS::kPosition1, DS::kPosition2, and DS::kPosition3.
|
protectedvirtual |
Returns information regarding the current date and time and the timezone of the client computer.
The robot may ask for this information in some cases (e.g. when initializing the robot code).
References DS::timezone().
|
virtual |
Interprets the packet and follows the instructions sent by the FMS. Possible instructions are:
Reimplemented from Protocol.
References DS::kControlAutonomous, DS::kControlTeleoperated, and DS::kControlTest.
|
virtual |
|
virtual |
FRC 2015 protocol supports a maximum of 6 axes. Remaining axes will be ignored.
Reimplemented from Protocol.
|
virtual |
FRC 2015 protocol supports a maximum of 12 buttons. Remaining buttons will be ignored.
Reimplemented from Protocol.
|
virtual |
|
virtual |
FRC 2015 protocol supports only 1 POV. Remaining POVs will be ignored.
Reimplemented from Protocol.
|
virtual |
|
virtual |
We received broadcasted messages from the robot in port 6666
Reimplemented from Protocol.
|
virtual |
Returns the nominal amperage given by the robot battery
Reimplemented from Protocol.
|
virtual |
Returns the nominal/maximum voltage given by the robot battery.
|
virtual |
Do not reboot robot or restart code when we re-establish communications with the robot.
Reimplemented from Protocol.
|
virtual |
|
protectedvirtual |
Sometimes, the roboRIO will send us additional information, such as CPU usage and CAN metrics. This function is in charge of extracting this information from the packet and updating DS values accordingly.
|
virtual |
Reboots the robot in the next packet cycle
Reimplemented from Protocol.
|
virtual |
Restarts the robot code in the next packet cycle
Reimplemented from Protocol.
|
virtual |
|
virtual |
Send 50 robot packets every second
Reimplemented from Protocol.
|
virtual |
We receive data from the robot at local port 1150
Reimplemented from Protocol.
|
virtual |
We send data to the robot at remote port 1110
Reimplemented from Protocol.
|
virtual |
Robot communications work with UDP datagrams
Reimplemented from Protocol.
References DS::kSocketTypeUDP.