This website can be used to understand or validate the data saved in the Baidu Apollo's recording files (produced by cyber_recorder command).
The recording file is a binary file of a fixed format. It consists of 1 Header section, 1 Index section and 1+ Channel sections and 1+ Chunk HEADER + Chunk Body sections, saved in the following order
[Header Section] [empty padding] [Channel Section 1] [Channel Section 2] ... [Chunk Header 1] [Chunk Body 1] [Chunk Header 2] [Chunk Body 2] ... [Index Section]
Each section has a fixed length section head (16 bytes) followed by flexible length section body. Sections have the following structure:
position | data | Description |
---|---|---|
0 - 3 | XX XX XX XX | The first four bytes records signed 32 bit integer (little endian) whose value is the section type. The section types are defined in the file: cyber/proto/record.proto
|
4 - 7 | 00 00 00 00 | These four bytes are empty for padding purpose. |
8 - 15 | XX XX XX XX XX XX XX XX | The next 8 bytes records signed 64 bit integer (little endian) whose value is the number of bytes of the section body (which follows the section head), a.k.a. section body size. |
16 - (16 + section body size - 1) | XX XX XX XX ... | The section body is parsed according to the section type defined in the section head. Section body are the encoded messages using protobuf libraries and thus can be decoded using corresponding libraries generated by protoc .For example, the first section is usually the Header Section, and the section body can be decoded by: Header.deserializeBinary(buf).toObject() , where Header is imported from protobuf libraries generated by protoc . |
Section Type | Description |
---|---|
SECTION_HEADER | Header section records the following information:
|
SECTION_CHANNEL | Channel Section records the channel name and message type. e.g. name: "/apollo/perception/obstacles" and type: "apollo.perception.PerceptionObstacles" |
SECTION_CHUNK_HEADER | The chunk header section indicates the start of a message chunk. It records the chunk's start timestamp and end timestamp as well as total number of messages saved in the chunk body section. |
SECTION_CHUNK_BODY | The chunk body section follows its chunk header section. It contains a message list which consists of all the cyber messages recorded during the period of the current chunk, ordered by message time. Each message in the list contains the following fields:
|
SECTION_INDEX | The index section is located at the end of each recording file. Its starting position is saved in the Header section. It saves the index list which records the starting positions and other information (e.g. number of messages, begin time, end time etc.) of all the Channel sections, Chunk Header sections and Chunk Body sections. |
protoc
./apollo/protobuf_out
protobuf_out
folder find modules/ cyber/ -name "*.proto" | grep -v node_modules | xargs protoc --js_out=import_style=library,binary:protobuf_out
protobuf_out
folder and select all the .js
filesApollo's 社区布道师 Tang Yun (ntutangyun [at] gmail [dot] com)
My current research interest is software testing of Autonomous vehicles. Feel free to drop me an email for research collaborations. :)
The repository address is https://github.com/ntutangyun/cyber-recorder-viewer. Feel free to create forks and pull requests.
Kindly acknowledge if you use any code from this repository :)