Skip to content

protocol definition

Tanner Mickelson edited this page Apr 27, 2016 · 34 revisions

RRDTP version 1a (alpha version - subject to change)

Overview

RRDTP version 1 is a data streaming protocol. One host acts as the server, and is the authoritative source for all data values. Multiple clients can connect to the server to send and receive updates to data values. Values can be stored hierarchically in categories. The design of RRDTP draws inspiration from WPI Network Tables, but is designed to be simpler and more easily portable to resource-limited platforms.

Events

Each packet will contain an event type. The currently defined event types are listed below.

  • Set value: sent to change a value. Either a client, or the server can send this type of packet.

  • Delete value: sent to indicate that a value should be deleted. Either a client, or the server can send this type of packet.

Data types

Data can be one of 7 types.

Type Size Format
int 4 bytes 2's complement
long 8 bytes 2's complement
float 4 bytes IEEE 754 binary32
double 8 bytes IEEE 754 binary64
boolean 1 byte raw binary
string n>2 bytes 2 byte unsigned integer size + n bytes ASCII/UTF8 text
unformatted n bytes 2 byte unsigned integer size + n bytes raw data

Value identifiers

Values are identified by an identifier string with a hierarchical format. An identifier begins with zero or more categories separated by periods '.' and ending with the name of the value. Identifiers are case sensitive ("Value1" != "VALUE1") and have a maximum length of 255 characters and can contain only upper and lowercase letters, numbers, dashes '-' and underscores '_'. Some examples of valid identifiers: sensor1 sensors.sensor_1 Arm.Motors.motor_1-power

Protocol

Header

All RRDTP packets begin with a header containing the protocol version and the event type (see Events section above). After the header, the packet format will be different depending on the event type.

Field Name Type Size
Protocol Version int 1 byte
Event Type int 1 byte

Set value

Sent to create or update a value entry. The system that creates the value (sends the set packet first) is considered to own the value, and is (by default) the only system allowed to update that value later. The data is encoded according to the format specified above in the data types section.

Field Name Type Size
Identifier Length int 1 byte
Identifier String string n<256 bytes
Data Type int 1 byte
Data variable n bytes

Delete value

Sent to indicate that a value entry can be deleted. A value deletion packet can only be sent by the owner of the value entry. If a host besides the owner sends a deletion packet, then it will be ignored.

Field Name Type Size
Identifier Length int 1 byte
Identifier String string n<256 bytes
Clone this wiki locally