The data stream transmitted over Robolink (from the robot to the robolink and from robolink to its clients) and stored in rlog files is simple and extensible, allowing hetrogenous streams to be logged simultaneously. The stream consists of a series of chunks, each of which contains a standard robolink header followed by data of a type and size specified in the header.
The robolink header (share/robolink.h) contains:
{{{
typedef struct {
char magic[4]; // magic header = "RLNK"
unsigned int team_num; // robot team ID
unsigned int player_num; // robot player number
long frame_num; // robot frame when data was collected, 4 bytes
unsigned int data_type; // enum data_type
unsigned int data_len; // num bytes in data section
} robolink_header;
const char ROBOLINK_MAGIC[4] = {'R', 'L', 'N', 'K'};
}}}
team_num is the robot's team number as used by the RobocupGameController. frame_num is the last camera frame index as returned by OpenR when the data was captured. data_len is the number of bytes in the following data section (after which there must be another header). data_type is an identifier for the type of the data following, which is used by client programs to recognise data chunks they should (and shouldn't) parse. As of writing these are:
{{{
enum data_type {
RLNK_ALL = 0,
RLNK_DEBUG,
RLNK_CPLANE,
RLNK_YUVPLANE,
RLNK_CAM_ORIENT, // camera orientation, horizon etc
RLNK_SENSOR,
RLNK_NUM_DATA_TYPES, // must be the last entry
};
}}}
The format of the data chunk following each header depends on the type of data and the client program interpreting it, but some simple formats are defined in robolink.h alongside the header definition.
See [wiki:Robolink Robolink] for an overview of how it works.