MCAP 文件格式
MCAP (pronounced "em-cap") is an open source container file format for multimodal log data. It supports multiple channels of timestamped pre-serialized data, and is ideal for use in pub/sub or robotics applications.
概述
MCAP is a modular container file format for recording timestamped pub/sub messages with arbitrary serialization formats.
MCAP files are designed to work well under various workloads, resource constraints, and durability requirements.
A Kaitai Struct description for the MCAP format is provided at mcap.ksy.
名词解释
MCAP organizes its data via messages, channels, and schemas.
Message
The unit of communication between nodes in the pub/sub system.
Channel
A stream of messages which have the same type, or schema. Often corresponds to a connection between a publisher and a subscriber.
Schema
A description of the structure and contents of messages on a channel, e.g. a Protobuf Schema or JSON Schema.
文件结构
A valid MCAP file is structured as follows. The Summary and Summary Offset sections are optional.
<Magic>
<Header>
<Data section>[<Summary section>][<Summary Offset section>]
<Footer>
<Magic>
The Data, Summary, and Summary Offset sections are structured as sequences of records:
[
<record type><record content length><record>
<record type><record content length><record>
...
]
Files not conforming to this structure are considered malformed.
Magic
An MCAP file must begin and end with the following magic bytes:
0x89, M, C, A, P, 0x30, \r, \n
The byte following "MCAP" is the major version byte. 0x30
is the ASCII character 0
. Any changes to this specification document (i.e. adding fields to records, introducing new records) will be binary backward-compatible within the major version.
Header
The first record after the leading magic bytes is the Header record.
<0x01><record content length><record>