LibDS
Qt-based library for controlling FRC robots
|
Base class for implementing communication protocols. More...
#include <Protocol.h>
Protected Member Functions | |
DS_Config * | config () |
DS_Joysticks * | joysticks () |
virtual QByteArray | getFMSPacket () |
virtual QByteArray | getRadioPacket () |
virtual QByteArray | getRobotPacket () |
virtual bool | interpretFMSPacket (const QByteArray &data) |
virtual bool | interpretRadioPacket (const QByteArray &data) |
virtual bool | interpretRobotPacket (const QByteArray &data) |
Base class for implementing communication protocols.
The protocol class allows developers to create their own communication protocols for use with applications that support the LibDS.
|
inlineprotected |
Gives direct access to the Driver Station variables/configs
References DS_Config::getInstance().
Referenced by FRC_2014::getAlliance(), FRC_2014::getOperationCode(), FRC_2014::getPosition(), FRC_2014::getRobotPacket(), FRC_2014::interpretFMSPacket(), FRC_2014::interpretRobotPacket(), FRC_2014::radioAddress(), radioAddress(), readFMSPacket(), readRadioPacket(), readRobotPacket(), FRC_2016::robotAddress(), FRC_2014::robotAddress(), and robotAddress().
|
inlinevirtual |
Returns the IP address in which we should be able to find the FMS. Contrary to how the radio and the robot protocols work, we will not send FMS packets until we have received a packet from the FMS.
The address is set to empty by default, the DS will set the appropriate FMS IP once it receives a packet from it.
Referenced by DriverStation::defaultFMSAddress().
|
inlinevirtual |
Returns the number of packets that we send to the FMS per second. For example, if we want to send 50 packets/second, the frequency should be set to 50.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we receive data from the FMS.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we send data to the FMS.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the socket type (UDP or TCP) used for client/FMS interacion.
Reimplemented in FRC_2015, and FRC_2014.
References DS::kSocketTypeUDP.
Referenced by DriverStation::setProtocol().
|
inline |
Updates the sent FMS packets counter and generates a client-to-FMS packet using the protocol implementation code.
References getFMSPacket().
|
inline |
Updates the sent radio packets counter and generates a client-to-radio packet using the protocol implementation code.
References getRadioPacket().
|
inline |
Updates the sent robot packets counter and generates a client-to-robot packet using the protocol implementation code.
References getRobotPacket().
|
inlineprotectedvirtual |
Returns a packet that is sent to the FMS.
Reimplemented in FRC_2015, and FRC_2014.
Referenced by generateFMSPacket().
|
inlineprotectedvirtual |
Returns a packet that is sent to the robot radio.
Referenced by generateRadioPacket().
|
inlineprotectedvirtual |
Returns a packet that is sent to the robot.
Reimplemented in FRC_2015, and FRC_2014.
Referenced by generateRobotPacket().
|
inlineprotectedvirtual |
Interprets the data received from the FMS and adjusts the Driver Station properties accordingly.
Reimplemented in FRC_2015, and FRC_2014.
Referenced by readFMSPacket().
|
inlineprotectedvirtual |
Interprets the data received from the radio and adjusts the Driver Station properties accordingly.
Referenced by readRadioPacket().
|
inlineprotectedvirtual |
Interprets the data received from the robot and adjusts the Driver Station properties accordingly.
Reimplemented in FRC_2015, and FRC_2014.
Referenced by readRobotPacket().
|
inlineprotected |
Gives direct access to the registered joysticks of the DS
References DriverStation::getInstance(), and DriverStation::joysticks().
Referenced by FRC_2014::getJoystickData(), and FRC_2014::getRobotPacket().
|
inlinevirtual |
Returns the maximum ammount of axes supported by the protocol
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::maxAxisCount().
|
inlinevirtual |
Returns the maximum ammount of buttons supported by the protocol
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::maxButtonCount().
|
inlinevirtual |
Returns the maximum number of joysticks supported
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::maxJoystickCount().
|
inlinevirtual |
Returns the maximum ammount of POVs supported by the protocol
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::maxPOVCount().
|
inlinevirtual |
Returns the name of the protocol. This is used by the DriverStation
to notify the user when the protocol is loaded.
Reimplemented in FRC_2014, FRC_2015, and FRC_2016.
Referenced by DriverStation::reconfigureJoysticks(), and DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we receive broadcasted messages from the robot.
Reimplemented in FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we send broadcasted messages to the robot.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the maximum amperage given by the battery. This value can be used by the client to draw graphs, calculate current power output (in watts), do car-like dashboards and other cool things.
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::nominalBatteryAmperage().
|
inlinevirtual |
Returns the nominal voltage given by the battery. This value can be used by the client to draw graphs, create car-like dashboards and other cool things.
It is also used to avoid reporting 37.00 V or 16'674'591 V. Trust me, it happened: http://imgur.com/a/6ibog
Referenced by DriverStation::maxBatteryVoltage().
|
inlinevirtual |
Called when the FMS watchdog expires
Referenced by DriverStation::resetFMS().
|
inlinevirtual |
Called when the radio watchdog expires
Referenced by DriverStation::resetRadio().
|
inlinevirtual |
Called when the robot watchdog expires
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::resetRobot().
|
inlinevirtual |
Returns the IP address in which we should be able to find the radio.
If the returned address is invalid, unresolved (e.g. mDNS) or empty, the Driver Station will lookup the address, while broadcasting the generated radio packages until the lookup receives a response.
The default value that this function returns is 10.xx.yy.1
Reimplemented in FRC_2015, and FRC_2014.
References config(), and DS::getStaticIP().
Referenced by DriverStation::defaultRadioAddress().
|
inlinevirtual |
Returns the number of packets that we send to the robot per second. For example, if we want to send 50 packets/second, the frequency should be set to 50.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we receive data from the radio.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we send data to the radio.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the socket type (UDP or TCP) used for client/radio interaction.
References DS::kSocketTypeUDP.
Referenced by DriverStation::setProtocol().
|
inline |
Lets the protocol implementation interpret the given data and updates the received FMS packets counter.
References config(), interpretFMSPacket(), DS::kCommsWorking, and DS_Config::updateFMSCommStatus().
|
inline |
Lets the protocol implementation interpret the given data and updates the received radio packets counter.
References config(), interpretRadioPacket(), DS::kCommsWorking, and DS_Config::updateRadioCommStatus().
|
inline |
Lets the protocol implementation interpret the given data and updates the received robot packets counter.
References config(), interpretRobotPacket(), DS::kCommsWorking, resetLossCounter(), and DS_Config::updateRobotCommStatus().
|
inlinevirtual |
Reboots the robot controller
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::rebootRobot().
|
inline |
Returns the number of packets received from the FMS
|
inline |
Returns the number of packets received from the radio
|
inline |
Returns the number of packets received from the robot
Referenced by FRC_2014::interpretRobotPacket().
|
inline |
Returns the number of packets received since robot connection. This is used to get an real-time packet loss percentage. If we use the receivedRobotPackets()
to do that, we risk having an unreal packet-loss ratio, since we would take into account the number of packets received before a reset or something.
Referenced by DriverStation::updatePacketLoss().
|
inline |
Ensures that the packet loss is calculated based on current values and not on previous robot packet loss data.
Referenced by readRobotPacket(), and DriverStation::resetRobot().
|
inlinevirtual |
Restarts the robot code
Reimplemented in FRC_2015, and FRC_2014.
Referenced by DriverStation::restartRobotCode().
|
inlinevirtual |
Returns the IP address in which we should be able to find the robot.
If the returned address is invalid, unresolved (e.g. mDNS) or empty, the Driver Station will lookup the address, while broadcasting the generated robot packages until the lookup receives a response.
The default value that this function returns is 10.xx.yy.2
Reimplemented in FRC_2015, FRC_2014, and FRC_2016.
References config(), and DS::getStaticIP().
Referenced by DriverStation::defaultRobotAddress().
|
inlinevirtual |
Returns the number of packets that we send to the robot per second. For example, if we want to send 50 packets/second, the frequency should be set to 50.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we receive data from the robot.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the port in which we send data to the robot.
Reimplemented in FRC_2014, and FRC_2015.
Referenced by DriverStation::setProtocol().
|
inlinevirtual |
Returns the socket type (UDP or TCP) used for client/robot interacion.
Reimplemented in FRC_2015, and FRC_2014.
References DS::kSocketTypeUDP.
Referenced by DriverStation::setProtocol().
|
inline |
Returns the number of packets sent to the FMS
|
inline |
Returns the number of packets sent to the radio
|
inline |
Returns the number of packets sent to the robot
Referenced by FRC_2014::getRobotPacket().
|
inline |
Returns the number of packets sent since robot connection. This is used to get an real-time packet loss percentage. If we use the sentRobotPackets()
to do that, we risk having an unreal packet-loss ratio, since we would take into account the number of packets sent before robot connection (which can be a lot).
Referenced by DriverStation::updatePacketLoss().