Skip to content

Commit 38249ce

Browse files
committed
MCAP spec proposal added
Signed-off-by: Timm Ruppert <[email protected]>
1 parent b00ad2b commit 38249ce

6 files changed

+62
-128
lines changed

doc/architecture/formatting_script.adoc

-29
This file was deleted.

doc/architecture/trace_file_naming.adoc doc/architecture/trace_file_binary_and_human_readable_formats.adoc

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ ifndef::include-only-once[]
22
:root-path: ../
33
include::{root-path}_config.adoc[]
44
endif::[]
5-
= OSI trace file naming conventions
5+
= Native binary and Human-readable Formats
66

7-
**Name format**
7+
== Binary .osi Format
8+
Messages are separated by a four-byte, little-endian, unsigned integer specifying the length of each message.
89

9-
The names of OSI trace files should have the following format:
10+
== Human-readable .txth Format
11+
Messages are stored as plain text, separated by newlines.
12+
13+
== Naming Convention
14+
Binary .osi and human-readable .txth files should follow this naming convention:
1015

1116
----
1217
<timestamp>_<type>_<osi-version>_<protobuf-version>_<number-of-frames>_<custom-trace-name>.osi
@@ -76,3 +81,5 @@ The recommended file name is:
7681
----
7782
20210818T150542Z_sv_312_300_1523_highway.osi
7883
----
84+
85+
NOTE: This naming convention does not apply to .mcap files.

doc/architecture/trace_file_example.adoc

-78
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
= MCAP Format
2+
3+
== General Requirements
4+
- Must comply with the https://mcap.dev/spec[MCAP format specification] version `0x30`
5+
- Must allow other non-OSI data to be present in the MCAP file
6+
- Message records must be written into `chunk records` for indexed files
7+
8+
== Schema
9+
- `name` field: Full message type name, including package (e.g., `osi3.SensorData`)
10+
- `encoding` field: Must be `protobuf`
11+
- `data` field: String-encoded `google::protobuf::FileDescriptorSet` for the OSI top-level message
12+
13+
== Channel
14+
- `message_encoding` field: Must be "protobuf"
15+
- `metadata` field: Should include a brief description of data origin and purpose
16+
17+
== Message
18+
- `publish_time` field:
19+
- Must reflect the timestamp of the stored OSI top-level message if it contains a timestamp field
20+
- Should represent a plausible value to express message order in relation to timestamps of other top-level messages if the message doesn't contain a timestamp (e.g. SensorViewConfiguration)
21+
- Must be in nanoseconds
22+
- `log_time` field: Must reflect the time when the message was enqueued for MCAP file addition
23+
- Must reflect the time when the top-level OSI message was enqueued for addition to the MCAP file
24+
- Zero time doesn't need to coincide with the Unix epoch, but it is recommended
25+
- Must be in nanoseconds
26+
27+
== Metadata
28+
- Must include metadata with the name `versions` containing at least the following key-value pairs:
29+
* `osi`: SemVer version of OSI specification
30+
* `protobuf`: SemVer version of protobuf library
31+
- Must include metadata with the name `creation_date` containing at least the following key-value pairs:
32+
* `timestamp`: ISO 8601 formatted creation time
33+
- Must include metadata with the name `description` containing at least the following key-value pairs:
34+
* `text`: Scenario description
35+
- Additional custom metadata may be added
36+
37+
== Compression
38+
- OSI-compliant tooling must support compression types: `none`, `lz4`, and `zstd`
39+
- Recommended compression in use should be either `lz4` or `zstd`

doc/architecture/trace_file_formats.adoc doc/architecture/trace_file_overview_file_formats.adoc

+10-7
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@ ifndef::include-only-once[]
33
include::{root-path}_config.adoc[]
44
endif::[]
55
[#top-osi_trace_file_formats]
6-
= OSI trace file formats
6+
= Overview file formats
77

8-
There are two formats for storing multiple serialized OSI messages in one trace file.
8+
There are three formats for storing OSI messages in trace files:
99

1010
*.osi::
11-
Binary trace file.
12-
Messages are separated by a length specification before each message.
13-
The length is represented by a four-byte, little-endian, unsigned integer.
14-
The length does not include the integer itself.
11+
Native binary trace file.
1512
1613
*.txth::
1714
Human-readable plain-text trace file.
18-
Messages are separated by newlines.
15+
16+
*.mcap::
17+
Binary trace file supporting more advanced features like indexed data, additional metadata and more.
1918
2019
NOTE: Previous releases of OSI also supported a so-called plain-text trace file format, with file extension `.txt`.
2120
This legacy format did not contain plain-text, but rather binary protobuf messages separated by a special separator.
2221
For obvious reasons the format was deprecated and fully replaced with the `.osi` binary file format.
2322
This release no longer contains any support for the legacy `.txt` file format.
2423
These files may be used for manual checks.
24+
25+
26+
TIP: For efficient handling of trace files, you can utilize the specification-compliant tools and libraries provided in the companion https://github.com/OpenSimulationInterface/osi-utilities[osi-utilities] repository. For example, convenient writer and reader classes are provided handling OSI messages for the different file formats.
27+

doc/open-simulation-interface_user_guide.adoc

+3-11
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,11 @@ include::./architecture/packaging_layer.adoc[leveloffset=+3]
5757

5858
=== OSI trace files
5959

60-
include::./architecture/trace_file_formats.adoc[leveloffset=+3]
60+
include::./architecture/trace_file_overview_file_formats.adoc[leveloffset=+3]
6161

62-
include::./architecture/trace_file_naming.adoc[leveloffset=+3]
62+
include::./architecture/trace_file_binary_and_human_readable_formats.adoc[leveloffset=+3]
6363

64-
// === Files and scripts
65-
66-
// include::./architecture/proto-files.adoc[leveloffset=+3]
67-
68-
// include::./architecture/test_scripts.adoc[leveloffset=+3]
69-
70-
include::./architecture/trace_file_example.adoc[leveloffset=+3]
71-
72-
include::./architecture/formatting_script.adoc[leveloffset=+3]
64+
include::./architecture/trace_file_mcap_format.adoc[leveloffset=+3]
7365

7466

7567
// Setting up OSI

0 commit comments

Comments
 (0)