|
LibDS
Qt-based library for controlling FRC robots
|
Implements the FRC 2009-2010 communication protocol. More...
#include <FRC_2014.h>
Public Member Functions | |
| FRC_2014 () | |
| virtual QString | name () |
| virtual int | fmsFrequency () |
| virtual int | robotFrequency () |
| virtual int | fmsInputPort () |
| virtual int | fmsOutputPort () |
| virtual int | robotInputPort () |
| virtual int | robotOutputPort () |
| 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 | netconsoleInputPort () |
| 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 DS_UByte | getAlliance () |
| virtual DS_UByte | getPosition () |
| virtual DS_UByte | getDigitalInput () |
| virtual DS_UByte | getOperationCode () |
| virtual QByteArray | getJoystickData () |
| virtual DS::Alliance | getAlliance (DS_UByte byte) |
| virtual DS::Position | getPosition (DS_UByte byte) |
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_resync |
| bool | m_restartCode |
| bool | m_rebootRobot |
| CRC32 | m_crc32 |
Implements the FRC 2009-2010 communication protocol.
|
explicit |
Implements the 2009-2014 FRC communication protocol
|
virtual |
Send 10 FMS packets per 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 |
Returns the code that represents the current alliance color
References DriverStation::alliance(), Protocol::config(), and DS::kAllianceBlue.
Referenced by getRobotPacket(), and interpretFMSPacket().
|
protectedvirtual |
Gets the alliance from the received byte
References DS::kAllianceBlue, and DS::kAllianceRed.
|
protectedvirtual |
Referenced by getRobotPacket().
|
virtual |
Reimplemented from Protocol.
|
protectedvirtual |
Generates the joystick data. The FRC protocol defines joystick values for all joysticks, regardless if all joysticks are connected or not.
In the case that a joystick is not connected, the protocol will send a netrual value (e.g. 0 for each axis and false for each button).
References Protocol::joysticks(), maxAxisCount(), and maxJoystickCount().
Referenced by getRobotPacket().
|
protectedvirtual |
Returns the code used to identify the enable status, control mode, operation mode and operation flags.
References Protocol::config(), DriverStation::controlMode(), DriverStation::isEmergencyStopped(), DS_Config::isEnabled(), DS::kControlAutonomous, DS::kControlTeleoperated, and DS::kControlTest.
Referenced by getRobotPacket().
|
protectedvirtual |
Returns the code that represents the current team position
References Protocol::config(), DS::kPosition1, DS::kPosition2, DS::kPosition3, and DriverStation::position().
Referenced by getRobotPacket(), and interpretFMSPacket().
|
protectedvirtual |
Gets the position from the received byte
References DS::kPosition1, DS::kPosition2, and DS::kPosition3.
|
virtual |
Generates a packet that the DS will send to the robot
Reimplemented from Protocol.
References Protocol::config(), getAlliance(), getDigitalInput(), getJoystickData(), getOperationCode(), getPosition(), Protocol::joysticks(), Protocol::sentRobotPackets(), DS_Config::team(), CRC32::update(), and CRC32::value().
|
virtual |
Gets the team station and robot mode from the FMS
Reimplemented from Protocol.
References DriverStation::alliance(), Protocol::config(), getAlliance(), getPosition(), DS::kControlAutonomous, DS::kControlTeleoperated, DS::kDisabled, DS::kEnabled, name(), DriverStation::position(), DS_Config::updateAlliance(), DS_Config::updateControlMode(), DS_Config::updateEnabled(), and DS_Config::updatePosition().
|
virtual |
Reads the input data and extracts the robot voltage, the robot code status and the emergency stop status.
If the packet is read successfully, the function returns true.
0x37, it means that the robot code is not running Reimplemented from Protocol.
References Protocol::config(), DS_Config::isEmergencyStopped(), DS::kEmergencyStop, name(), Protocol::receivedRobotPackets(), DS_Config::setRobotCode(), DS_Config::updateOperationStatus(), DS_Config::updateSimulated(), and DS_Config::updateVoltage().
|
virtual |
FRC 2014 protocol supports a maximum of 6 axes. Remaining axes will be ignored.
Reimplemented from Protocol.
Referenced by getJoystickData().
|
virtual |
FRC 2014 protocol supports a maximum of 12 buttons. Remaining buttons will be ignored.
Reimplemented from Protocol.
|
virtual |
FRC 2014 Protocol supports a maximum of 4 joysticks. Remaining joysticks will be ignored.
Reimplemented from Protocol.
Referenced by getJoystickData().
|
virtual |
FRC 2014 protocol does not use POVs
Reimplemented from Protocol.
|
virtual |
Returns the display name of the protocol
Reimplemented from Protocol.
Referenced by interpretFMSPacket(), and interpretRobotPacket().
|
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 |
Be sure that we do not reboot the robot or restart its code when we re-establish communications with it.
Reimplemented from Protocol.
|
virtual |
Radio is located at 10.TE.AM.1
Reimplemented from Protocol.
References Protocol::config(), DS::getStaticIP(), and DriverStation::team().
|
virtual |
Configures the protocol to reboot the robot with the next sent packet.
Reimplemented from Protocol.
|
virtual |
Configures the protocol to restart the robot code with the next sent packet (not really, it does not work for the moment).
Reimplemented from Protocol.
|
virtual |
Robot is located at 10.TE.AM.2
Reimplemented from Protocol.
References Protocol::config(), DS::getStaticIP(), and DriverStation::team().
|
virtual |
Send 50 robot packets per 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.
1.8.11