Driver Station to RoboRIO ========================= .. _ds_rio_udp: UDP --- Sent every 20ms to the RoboRIO, UDP port 1110 (port 1115 when connected to FMS) .. table:: :widths: auto +--------------+--------+-----------------------------------+-----------------------------------------------+ | Field | Length | Type | Comment | +==============+========+===================================+===============================================+ | Sequence Num | 2 | uint16 | | +--------------+--------+-----------------------------------+-----------------------------------------------+ | Comm Version | 1 | uint8 | ``0x01`` is currently the only observed value | +--------------+--------+-----------------------------------+-----------------------------------------------+ | Control | 1 | :ref:`Control ` | | +--------------+--------+-----------------------------------+-----------------------------------------------+ | Request | 1 | :ref:`Request ` | | +--------------+--------+-----------------------------------+-----------------------------------------------+ | Alliance | 1 | :ref:`Alliance ` | | +--------------+--------+-----------------------------------+-----------------------------------------------+ | Tags | n | :ref:`Tags ` | | +--------------+--------+-----------------------------------+-----------------------------------------------+ .. _ds_rio_control: Control ^^^^^^^ .. table:: :widths: auto +----------------+--------------+-----------------------------------+ | Field | Mask | Comment | +================+==============+===================================+ | E-Stop | ``x.......`` | | +----------------+--------------+-----------------------------------+ | FMS Connected | ``....x...`` | | +----------------+--------------+-----------------------------------+ | Enabled | ``.....x..`` | | +----------------+--------------+-----------------------------------+ | Mode | ``......xx`` | 0: Teleop, 1: Test, 2: Autonomous | +----------------+--------------+-----------------------------------+ .. _ds_rio_request: Request ^^^^^^^ .. table:: :widths: auto +----------------+--------------+-----------------------------------------------+ | Field | Mask | Comment | +================+==============+===============================================+ | Reboot RoboRIO | ``....x...`` | | +----------------+--------------+-----------------------------------------------+ | Restart Code | ``.....x..`` | | +----------------+--------------+-----------------------------------------------+ .. _ds_rio_alliance: Alliance ^^^^^^^^ Color is Red if ``value < 3``, else Blue. Position is ``value % 3 + 1`` .. _ds_rio_udp_tags: Tags ^^^^ .. table:: :widths: auto +-------+--------+-------+-----------------------------------------------+ | Field | Length | Type | Comment | +=======+========+=======+===============================================+ | Size | 1 | uint8 | | +-------+--------+-------+-----------------------------------------------+ | ID | 1 | uint8 | See table below | +-------+--------+-------+-----------------------------------------------+ | Data | n | | Depends on tag type | +-------+--------+-------+-----------------------------------------------+ .. table:: :widths: auto +----------+------------+ | ID | Tag | +==========+============+ | ``0x07`` | Countdown_ | +----------+------------+ | ``0x0c`` | Joystick_ | +----------+------------+ | ``0x0f`` | Date_ | +----------+------------+ | ``0x10`` | Timezone_ | +----------+------------+ .. _countdown: Countdown ``0x07`` """""""""""""""""" .. table:: :widths: auto +-----------+--------+--------+-----------------------------------------------+ | Field | Length | Type | Comment | +===========+========+========+===============================================+ | Countdown | 4 | float | In seconds | +-----------+--------+--------+-----------------------------------------------+ .. _joystick: Joystick ``0x0c`` """""""""""""""""" .. table:: :widths: auto +--------------+--------+---------+-----------------------------------------------+ | Field | Length | Type | Comment | +==============+========+=========+===============================================+ | Axis Count | 1 | uint8 | Number of axis bytes to follow | +--------------+--------+---------+-----------------------------------------------+ | Axes | n | int8 | -128 to 127, for each axis | +--------------+--------+---------+-----------------------------------------------+ | Button Count | 1 | uint8 | Number of buttons | +--------------+--------+---------+-----------------------------------------------+ | Buttons | n | Button_ | Bytes containing button data | +--------------+--------+---------+-----------------------------------------------+ | POV Count | 1 | uint8 | Number of POVs | +--------------+--------+---------+-----------------------------------------------+ | POVs | 2 * n | int16 | 0 to 360, -1 if not pressed | +--------------+--------+---------+-----------------------------------------------+ .. _button: Button ...... 1 bit per button, so the number of bytes is ``count / 8 + ((count == 0) ? 0 : 1)`` Stored `LSB 0 `_. All bits after the specified number of buttons are 0. .. _date: Date ``0x0f`` """""""""""""" This and Timezone_ below are sent once when the DS first connects. .. table:: :widths: auto +--------------+--------+--------+-------------------------+ | Field | Length | Type | Comment | +--------------+--------+--------+-------------------------+ | Microseconds | 4 | uint32 | | +--------------+--------+--------+-------------------------+ | Second | 1 | uint8 | | +--------------+--------+--------+-------------------------+ | Minute | 1 | uint8 | | +--------------+--------+--------+-------------------------+ | Hour | 1 | uint8 | In UTC | +--------------+--------+--------+-------------------------+ | Day | 1 | uint8 | | +--------------+--------+--------+-------------------------+ | Month | 1 | uint8 | 0 is January | +--------------+--------+--------+-------------------------+ | Year | 1 | uint8 | Year (starting at 1900) | +--------------+--------+--------+-------------------------+ .. _timezone: Timezone ``0x10`` """""""""""""""""" .. table:: :widths: auto +----------+--------+--------+----------+ | Field | Length | Type | Comment | +----------+--------+--------+----------+ | Timezone | n | string | Timezone | +----------+--------+--------+----------+ .. _ds_rio_tcp: TCP --- Sent over TCP port 1740. Strings are either prefixed with a length (specified) or implied. .. table:: :widths: auto +-------+--------+-------------------------------+------------------------------------+ | Field | Length | Type | Comment | +-------+--------+-------------------------------+------------------------------------+ | Size | 2 | uint16 | Including ID | +-------+--------+-------------------------------+------------------------------------+ | ID | 1 | uint8 | See table below (only if Size > 0) | +-------+--------+-------------------------------+------------------------------------+ | Tags | n | :ref:`Tags ` | | +-------+--------+-------------------------------+------------------------------------+ .. _ds_rio_tcp_tags: Tags ^^^^ .. table:: :widths: auto +----------+---------------------------------------------------------+ | ID | Tag | +----------+---------------------------------------------------------+ | ``0x02`` | :ref:`Joystick Descriptor ` | +----------+---------------------------------------------------------+ | ``0x07`` | :ref:`Match Info ` | +----------+---------------------------------------------------------+ | ``0x0e`` | :ref:`Game Data ` | +----------+---------------------------------------------------------+ .. _ds_rio_joystick_descriptor: Joystick Descriptor ``0x02`` """""""""""""""""""""""""""" Sends everything on the USB Devices tab of the DS, whether connected or not. Sent when joystick is plugged in, unplugged, or reordered. .. table:: :widths: auto +--------------+--------+--------+----------------------------------------------------+ | Field | Length | Type | Comment | +==============+========+========+====================================================+ | Index | 1 | uint8 | | +--------------+--------+--------+----------------------------------------------------+ | Is Xbox | 1 | bool | True if XBox controller | +--------------+--------+--------+----------------------------------------------------+ | Type | 1 | int8 | :ref:`See below ` | +--------------+--------+--------+----------------------------------------------------+ | Name | 1 + n | string | | +--------------+--------+--------+----------------------------------------------------+ | Axis Count | 1 | uint8 | | +--------------+--------+--------+----------------------------------------------------+ | Axis Types | n | bytes | :ref:`See below ` (one per axis) | +--------------+--------+--------+----------------------------------------------------+ | Button Count | 1 | uint8 | | +--------------+--------+--------+----------------------------------------------------+ | POV Count | 1 | uint8 | | +--------------+--------+--------+----------------------------------------------------+ .. _ds_rio_joystick_type: Joystick Type ............. .. table:: :widths: auto +-----+---------------------+-----+-------------------+ | Num | Type | Num | Type | +-----+---------------------+-----+-------------------+ | -1 | Unknown | 8 | XInput Drum Kit | +-----+---------------------+-----+-------------------+ | 0 | XInput Unknown | 11 | XInput Guitar 3 | +-----+---------------------+-----+-------------------+ | 1 | XInput Gamepad | 19 | XINput Arcade Pad | +-----+---------------------+-----+-------------------+ | 2 | XInput Wheel | 20 | HID Joystick | +-----+---------------------+-----+-------------------+ | 3 | XInput Arcade | 21 | HID Gamepad | +-----+---------------------+-----+-------------------+ | 4 | XInput Flight Stick | 22 | HID Driving | +-----+---------------------+-----+-------------------+ | 5 | XInput Dance Pad | 23 | HID Flight | +-----+---------------------+-----+-------------------+ | 6 | XInput Guitar | 24 | HID 1st Person | +-----+---------------------+-----+-------------------+ | 7 | XInput Guitar 2 | | | +-----+---------------------+-----+-------------------+ .. _ds_rio_axis_type: Axis Type ......... .. table:: :widths: auto +-----+--------+-----+---------------+ | Num | Type | Num | Type | +=====+========+=====+===============+ | 0 | X Axis | 3 | Twist Axis | +-----+--------+-----+---------------+ | 1 | Y Axis | 4 | Throttle Axis | +-----+--------+-----+---------------+ | 2 | Z Axis | | | +-----+--------+-----+---------------+ .. _ds_rio_match_info: Match Info ``0x07`` """"""""""""""""""" .. table:: :widths: auto +--------------+--------+--------+---------------------------------------------+ | Field | Length | Type | Comment | +==============+========+========+=============================================+ | Competition | 1 + n | string | | +--------------+--------+--------+---------------------------------------------+ | Match Type | 1 | enum | 0:"None", 1:Practice, 2:Qualifications, | | | | | 3:Eliminations | +--------------+--------+--------+---------------------------------------------+ .. _ds_rio_game_data: Game Data ``0x0e`` """""""""""""""""" .. table:: :widths: auto +--------------+--------+--------+---------------------------------------------+ | Field | Length | Type | Comment | +==============+========+========+=============================================+ | Game Data | n | string | | +--------------+--------+--------+---------------------------------------------+