Overview¶
ASAM OSI Utilities is a C++ library that provides tools for working with ASAM Open Simulation Interface (OSI) trace files.
What is OSI?¶
The Open Simulation Interface (OSI) is an open standard developed by ASAM (Association for Standardization of Automation and Measuring Systems) for the exchange of simulation data between traffic participants, sensors, and simulation environments in autonomous driving development.
OSI uses Protocol Buffers for efficient binary serialization of structured data.
OSI Trace File Formats¶
This library supports three OSI trace file formats:
MCAP (Multi-Channel)¶
File extension: .mcap
The MCAP format is the recommended format for storing OSI data. It provides:
Multiple channels - Store different OSI message types in the same file
Random access - Quickly seek to any point in time
Compression - Built-in support for lz4 and zstd compression
Metadata - Rich metadata including schemas, timestamps, and custom fields
Cross-platform - Tooling available in C++, Python, Go, TypeScript, and more
OSI defines a specialization of the MCAP format with additional constraints. See the OSI trace file specification.
Requirement |
Value |
|---|---|
Version |
MCAP 0x30 |
Indexing |
Required (chunk index records in summary section) |
Compression |
None, |
Metadata name |
|
Required Metadata Fields¶
The net.asam.osi.trace metadata record must include:
version- OSI release version (e.g.,3.8.0)min_osi_version- Minimum OSI schema version usedmax_osi_version- Maximum OSI schema version usedmin_protobuf_version- Minimum protobuf version usedmax_protobuf_version- Maximum protobuf version used
Single-Channel Binary¶
File extension: .osi
A simple binary format for storing a sequence of OSI messages of the same type:
[4-byte length][protobuf message][4-byte length][protobuf message]...
Length is a little-endian unsigned 32-bit integer
Length does not include the 4-byte length field itself
No metadata, no random access, no compression
Best for: Simple use cases, streaming, and interoperability with legacy tools.
Single-Channel Text¶
File extension: .txth
Human-readable format where each line is a Protocol Buffer text-format message:
timestamp { seconds: 0 nanos: 0 } version { ... }
timestamp { seconds: 0 nanos: 100000000 } version { ... }
One message per line
Intended for debugging and manual inspection only
Not recommended for production use due to parsing ambiguities
Supported OSI Message Types¶
The library supports all OSI top-level message types:
Message Type |
Description |
|---|---|
|
Ground truth world state |
|
Sensor input data |
|
Sensor configuration |
|
Processed sensor output |
|
Ego vehicle state |
|
Traffic control commands |
|
Traffic command updates |
|
Traffic state updates |
|
Motion planning requests |
|
Streaming data updates |
|
Data reduction config |
Library Components¶
Trace File Readers¶
Class |
Description |
|---|---|
|
Read MCAP trace files |
|
Read |
|
Read |
Trace File Writers¶
Class |
Description |
|---|---|
|
Write MCAP trace files |
|
Write |
|
Write |
Integration Helpers¶
Class |
Description |
|---|---|
|
OSI channel helper for external MCAP writer integration |
Example Usage¶
#include "osi-utilities/tracefile/reader/MCAPTraceFileReader.h"
osi3::MCAPTraceFileReader reader;
if (reader.Open("trace.mcap")) {
while (reader.HasNext()) {
auto reading = reader.ReadMessage();
if (reading.has_value()) {
// Process message based on type
std::visit([](auto&& msg) {
// Handle different message types
}, reading.value().message);
}
}
reader.Close();
}
Examples¶
The examples provide small, focused programs for reading/writing each supported trace format and for converting .osi to .mcap.
See Examples for purpose and usage details.