Skip to main content

roboto-mcap-codec

A fast, shared Rust decoder for ROS and DDS message data, packaged as a Python extension. It parses the schema languages used in MCAP and ROS bags — omgidl, ros2idl, ros2msg, ros1msg — and decodes message payloads across every common CDR framing (plain XCDR1/XCDR2, parameter-list PL_CDR, delimited D_CDR2) and the unaligned ROS1 wire, into plain Python dict / list / scalar values.

It powers message decoding in the Roboto Python SDK, where one Rust implementation serves both ingest-time field statistics and query-time message reads.

Install

pip install roboto-mcap-codec

Prebuilt abi3 wheels are published for CPython 3.10+ on Linux (manylinux2014 / glibc 2.17 and musllinux_1_2 / Alpine, x86-64 and aarch64), macOS (Intel and Apple Silicon), and Windows (x86-64 and ARM64). No Rust toolchain is needed to install.

Quick start

A RosCdrCodec is built once per channel schema, then reused to decode every message on that channel.

from mcap_codec import RosCdrCodec

# schema_encoding: "omgidl" | "ros2idl" | "ros2msg" | "ros1msg"
# schema_data:     the raw schema bytes (e.g. an MCAP Schema record's `data`)
# schema_name:     the fully-scoped root type name
codec = RosCdrCodec("ros2msg", schema_data, "sensor_msgs/msg/Imu")

# payload = the raw message bytes, including the 4-byte CDR encapsulation header
message = codec.decode(payload)        # -> nested dict / list / scalars

Decode only the fields you need (everything else is skipped, not materialized):

partial = codec.decode_fields(
    payload,
    ["angular_velocity.x", "header.stamp.sec"],
)
# -> {"angular_velocity": {"x": ...}, "header": {"stamp": {"sec": ...}}}

Output shape

  • structs → dict; sequences and arrays → list (multi-dimensional arrays → nested lists); octet / uint8 arrays → bytes (matching mcap_ros2; signed int8 arrays stay list[int], since bytes can't hold negatives). The deprecated byte / char aliases follow their dialect: ROS2 byte→uint8 / char→int8, ROS1 the reverse
  • scalars → native bool / int / float; strings → str
  • enums → integers
  • unions → {"$discriminator": <value>, "<active member>": <value>}
  • Time / Duration → {"sec": int, "nsec": int} (ROS2 nanosec normalized to nsec)
  • absent @optional members are omitted from the dict

Undecodable messages

Some fields have no portable CDR encoding and cannot be decoded reliably. When a message cannot be decoded for such a reason, decode() raises UnsupportedMessage (rather than returning a wrong value). Catch it to skip the message and keep reading the rest of the file:

from mcap_codec import RosCdrCodec, UnsupportedMessage

try:
    message = codec.decode(payload)
except UnsupportedMessage:
    message = None   # e.g. an implementation-defined `wstring`, or HASH autoid

This matches how the Roboto SDK and the Foxglove decoders treat the same cases.

Errors

  • RosCdrCodec(...) raises ValueError if the schema cannot be parsed.
  • decode(...) / decode_fields(...) raise ValueError on a genuine decode failure (malformed payload), and UnsupportedMessage for a message that is intentionally declined (see above).

License

Apache-2.0. Part of the Roboto platform.

Release files for roboto-mcap-codec 0.1.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for roboto-mcap-codec 0.1.19
File Size Uploaded
roboto_mcap_codec-0.1.19.tar.gz 176.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for roboto-mcap-codec 0.1.19
File
roboto_mcap_codec-0.1.19-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
roboto_mcap_codec-0.1.19-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 13.4 MB

Release files / roboto_mcap_codec-0.1.19.tar.gz

Download URL roboto_mcap_codec-0.1.19.tar.gz
Size 176.8 kB
Tags Source
SHA-256 checksum
How to use checksums
866b129bcf692651ed62b2b999af6637d3331f619fde4177ca5142a3d63a0d8d
BLAKE2b-256 checksum
How to use checksums
82385ee5759fe9c895641d25c100f2c24e52f75e73168ddf82dee13e61b4ffdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-win_arm64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-win_arm64.whl
Size 1.4 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
752a2b735fc64a7b76f2ce17f0471002a37f06c06aa618f85def5ac5e859dc25
BLAKE2b-256 checksum
How to use checksums
e59528f14bd76e146f07eb196485935fd9d2863de8b46be09fc184a117df0ac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-win_amd64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-win_amd64.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
853d7387912db5a4dea0dbda522c0419df132b0c12e55adab231ad9caff6b264
BLAKE2b-256 checksum
How to use checksums
adff2b1aff5e7e47fba56b858c872bde4ed5e4e26d903ae29d1c8200420da449
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_x86_64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
738563d0934da59ff62221d69108089bdecf3b64be116acb8d1e9b598932aeda
BLAKE2b-256 checksum
How to use checksums
51f3ffdf7d1b0af048aef2463bc730bb67cfecb3d009fe1b4551c94d78768e5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-musllinux_1_2_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
b9c867c0daeffc8b595ce19ed5c4e8ef9b2a7a6cc5187a8556c3e08958534097
BLAKE2b-256 checksum
How to use checksums
d228e465a50c4e8bc9e03ea1c8fd1f3dadbf0f4083ce3c6d5035f33aec15e664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
792a9cb034ce97704b1e007b93c524d75daae354c105352969e26b8e2fad7117
BLAKE2b-256 checksum
How to use checksums
b9b69bd9f74a5b507f8b5f68ad3d15149d68dc1acf8be65aa25f536a9e92a3bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
1cda23aae773e05c767918481fef006e5b0703609fb0a2fd9dfee846a753a8af
BLAKE2b-256 checksum
How to use checksums
8d9a4dc557f5f95520e09bf387fffdfa3ab2cd7c0c31f9e26cd0f7c27860d907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-macosx_11_0_arm64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a986d0fcc59cd7bc7d422e307e5193f734a3c93575f6eaa21b6797403b893be4
BLAKE2b-256 checksum
How to use checksums
75e5f8958a794c82148240d6e422aa80269529e12006d24c38eb1037fdbfd6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / roboto_mcap_codec-0.1.19-cp310-abi3-macosx_10_12_x86_64.whl

Download URL roboto_mcap_codec-0.1.19-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
92fb5dd4ff88f70d716441c9f6bedc3700ecd7f1aa010620ff1b16119b3148cc
BLAKE2b-256 checksum
How to use checksums
6f55678b5b20e170714716e45d6ddd339b8b507d5f933796f98d4d3876c0b743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page