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 byteuint8 / charint8, 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roboto_mcap_codec-0.1.18.tar.gz (166.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

roboto_mcap_codec-0.1.18-cp310-abi3-win_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10+Windows ARM64

roboto_mcap_codec-0.1.18-cp310-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

roboto_mcap_codec-0.1.18-cp310-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

roboto_mcap_codec-0.1.18-cp310-abi3-macosx_10_12_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file roboto_mcap_codec-0.1.18.tar.gz.

File metadata

  • Download URL: roboto_mcap_codec-0.1.18.tar.gz
  • Upload date:
  • Size: 166.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for roboto_mcap_codec-0.1.18.tar.gz
Algorithm Hash digest
SHA256 772955cc33d8e37d0c0a868aad1d496994484b2129608f1239e80dfbbf9f2c5b
MD5 e3672e8eca1cb077cca46e04425b38f6
BLAKE2b-256 a90d861594191b1b273b9e7de29efd6a60df850fbaaf440cf6897a917d46e513

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18.tar.gz:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 1da9ac51f8cfed96c0a89c72f4b56ece29a383f6faacf0fcce145cf709d2cc2a
MD5 d9e4ee1c78ee9870536d3c826e3a4a80
BLAKE2b-256 eaf059758aabd60c27aab4a86701e05957fd55c489ac04f6de02498ac8c73e95

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-win_arm64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 54019deb604a48dafdb3265de60fb3ab3b13becfcc039d8111a04d6bd972eb86
MD5 b2f3edd4b1c951c7a98303105060b80b
BLAKE2b-256 93a1c2e971739ef6593437f9472bdaf6a0d5f040fe857df95e1a252edb589c5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-win_amd64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7558d072296ea49b9e46a26e5e41e4b63c3bfcd258de5be35f0bd71277eb7bc1
MD5 af6a1c00bef3825de9f281234226f5ef
BLAKE2b-256 3cb5038de32b4b37ff61497af304b4a8f55577a64a938c101318245db170746a

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 04f0dd154254f86709862e08b1a5acd0f099d6d7ebb5f781052f37f9b104c1eb
MD5 eaf2889881334b428c77f067590f4c0a
BLAKE2b-256 419706e826b3ab1681ca43038e655bd701feaedff1233d74011915a74be1be65

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6b8e7d00ea04b24655676ebc9eba0f0fbb1dccda40dffa8c063cf8a31e4adada
MD5 5e05753c1307539ef761998fe8e9b0c3
BLAKE2b-256 2b770af1c79879c06f8233e89073c63be4316096ea8e9c51fee0ac11932f3fb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 046e55133c2b8216b7bd3175f1d0394bdc9aa4058c732345684c06ff659ad3b9
MD5 93601a1a5fc08941ec3168d9795adfa0
BLAKE2b-256 2c726b70b0fa2eb0d8145cb401560bce1f8d38b40d030fab1ef566a9a7a8e63a

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3438be7c934849d45867f8af14e7cb1b37e70326608cbcd6549e5c47975b2e4a
MD5 2a5c09cb0d5e0d81b211fbfb0a15ddc9
BLAKE2b-256 fa5add37e8598e197bf7f78366ae94633974774dfd69c501c3a89fde2e6a3f6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file roboto_mcap_codec-0.1.18-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.18-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 65583068952b0c44380a6a362c45e1243709e4d57bf06444112abecffcb81ee9
MD5 5520b56655c64bfd3ba096713baa53a1
BLAKE2b-256 cf2c69d96d92be5cba0feff784e1786204d048f949c0549754651a945fbf7509

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.18-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: wheels.yml on roboto-ai/roboto-mcap-codec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.18 This release

9 files

0.1.17

9 files

0.1.16

9 files

0.1.15

9 files

0.1.13

6 files

0.1.12

6 files

0.1.11

6 files

0.1.10

6 files

0.1.9

6 files

0.1.8

6 files

0.1.6

6 files

0.1.5

6 files

0.1.4

6 files

0.1.3

6 files

0.1.2

6 files

0.1.1

6 files

0.1.0

6 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page