MCAP Documentation

repository·main·Indexed 21 days ago

https://github.com/foxglove/mcap

MCAP is a serialization-agnostic log container file format and library designed for robotics, offering high-performance logging across multiple languages including C++, Python, Go, Rust, JavaScript/TypeScript, and Swift. It provides specialized support for ROS1 and ROS2 message types, protobuf integration, and a CLI tool with performance benchmarking.

Tokens
73.3K
Snippets
212
Records
374
Agent score
76%

What's inside MCAP

  1. Overview of the Rust MCAP library

    main

    The Rust MCAP library is designed for reading and writing Foxglove MCAP files. It focuses on three core design goals:

    1. Simple APIs: Provides high-level iteration over messages where messages are automatically linked to their respective channels and schemas, removing the need for manual ID tracking.
    2. Performance: Optimized for low memory overhead. Writers avoid holding large buffers in memory, and readers support memory-mapped files to minimize copies and leverage OS-level caching.
    3. Resilience: Designed to recover all valid messages even from incomplete files or corrupted chunks.
  2. Overview of MCAP

    main
    MCAP is a serialization-agnostic logging library and file format. It is designed for robotics applications and is optimized to work across various workloads, resource constraints, and durability requirements.
  3. Overview of @mcap/core

    main
    The @mcap/core package provides low-level readers and writers for the MCAP (Modular Container format) in TypeScript. MCAP is a modular container format and logging library designed for pub/sub messages with arbitrary serialization, optimized for robotics applications across various workloads, resource constraints, and durability requirements.
  4. What is MCAP?

    main

    MCAP is a modular container file format designed for heterogeneous timestamped data, making it ideal for robotics applications. Key features include:

    • Heterogeneous data: Stores multiple message streams using different serialization formats (e.g., ROS, Protobuf, JSON Schema) and supports metadata and attachments in a single file.
    • Performant writing: Uses an append-only structure that allows for the recovery of partially-written files if recording is interrupted.
    • Efficient seeking: Provides fast access to indexed summary data, allowing users to extract specific data without scanning the entire file.
    • Self-contained files: Embeds all message schemas within the file, ensuring no external dependencies are required for decoding.
  5. Overview of MCAP TypeScript libraries

    main

    MCAP is a modular container format and logging library designed for pub/sub messages with arbitrary serialization, primarily for robotics applications. For JavaScript and TypeScript environments, the following NPM packages are available:

    • @mcap/core: Provides low-level readers and writers for the MCAP format.
    • @mcap/support: Adds support for well-known compression formats.
    • @mcap/nodejs: Provides environment-specific support for Node.js.
    • @mcap/browser: Provides environment-specific support for browser-based applications.
  6. What is MCAP and when should I use it?

    main

    MCAP is a modular container file format designed for heterogeneous timestamped data, specifically optimized for robotics applications.

    Use MCAP when you need to:

    • Store multiple data streams: Record messages encoded in different serialization formats (e.g., ROS, Protobuf, JSON Schema, FlatBuffers) within a single file.
    • Ensure high-performance writing: Leverage its append-only structure for performant recording.
    • Enable efficient seeking: Access indexed summary data and extract specific data without scanning the entire file.
    • Maintain self-containment: Embed all message schemas directly in the file so that no extra dependencies are required for decoding.
    • Handle interruptions: Recover partially-written files if a data recording process is interrupted.
  7. Use the Go MCAP library

    main
    The mcap Go library is an experimental implementation for reading and writing MCAP files. Note that because it is experimental, the API is subject to change without warning until the MCAP specification is finalized.
  8. Work with Protobuf in MCAP files

    main

    MCAP supports Protobuf data, allowing you to write Protobuf messages to MCAP files and read them back later. To implement this, you can use specialized support packages depending on your language of choice.

    For Python users, the mcap-protobuf-support package is available within the main repository to facilitate writing MCAP readers and writers specifically for Protobuf data.

  9. Available MCAP language implementations

    main
    MCAP libraries are available for multiple programming languages. All libraries are tested for conformance with the MCAP specification. You can find the implementations for C++, Go, Python, Rust, Swift, and TypeScript in their respective directories within the repository.
  10. Read, write, and visualize MCAP files containing JSON data

    main

    MCAP files can be used to store, read, write, and visualize JSON data.

    Writing and Reading

    Developers can implement workflows to write JSON data into MCAP files and subsequently read that data back for analysis or playback.

    Inspection

    You can use the mcap CLI tool to inspect MCAP files, validate their contents, and echo messages to stdout.

    Visualization

    Foxglove provides support for playing back both local and remote MCAP files that contain JSON data.