Skip to main content

Shared Rust CDR/IDL decoder for ROS and DDS message data (omgidl, ros2idl, ros2msg, ros1msg).

Project description

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 CdrCodec is built once per channel schema, then reused to decode every message on that channel.

from mcap_codec import CdrCodec

# 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 = CdrCodec("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, "nanosec": int}
  • 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 CdrCodec, 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

  • CdrCodec(...) 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.

Project details


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.15.tar.gz (114.9 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.15-cp310-abi3-win_arm64.whl (938.6 kB view details)

Uploaded CPython 3.10+Windows ARM64

roboto_mcap_codec-0.1.15-cp310-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

roboto_mcap_codec-0.1.15-cp310-abi3-musllinux_1_2_x86_64.whl (1.4 MB view details)

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

roboto_mcap_codec-0.1.15-cp310-abi3-musllinux_1_2_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

roboto_mcap_codec-0.1.15-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

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

roboto_mcap_codec-0.1.15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

roboto_mcap_codec-0.1.15-cp310-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

roboto_mcap_codec-0.1.15-cp310-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: roboto_mcap_codec-0.1.15.tar.gz
  • Upload date:
  • Size: 114.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for roboto_mcap_codec-0.1.15.tar.gz
Algorithm Hash digest
SHA256 199d46663ce8f6065b9eea7e05c746dcb68cd1313577b4df0f5a950e4e0ea04f
MD5 8d263a408ba0690f70f16f8587aa58f6
BLAKE2b-256 eb5f779d550b97597ac5e11cdf166bae4d05a88b3ca340353b7eedecf54b0605

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15.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.15-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 1e8f41e507825b54dd54139976731411575c6ddda0c07fcf47df080a4fc7e947
MD5 46e11f0dc94db92761edc52e60a39e38
BLAKE2b-256 13fa0f6d64b78a50086f9953ca1c91884f4b1dde4e11e5eccd0f1174cd7a3e71

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 562c319f7350f3e34ce1c04a2d4a86125ec1a6c7958d4e12622fed95c4c61d4f
MD5 901a8e2d14ebc7cd77e206efd41706c1
BLAKE2b-256 ff991d406a3ce6175b8d098d80fd47f2027b3dd3246619b5e976f778e8675ce4

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a7b8da59a1dc5b7f68662ed6c50b35267316e2fe04e1d093232c2ffc716c4c36
MD5 f7fee235d09a04ef9e2aecd93a4da68a
BLAKE2b-256 d194c63ac4cfc92a51b6b9a2eca0198d15380eacf940af9e20baa701bc86729a

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6805346d951674bb5d8ecbc866950a1d6c77428d21f41a2f070081f1b3f12640
MD5 df13a4a9e79dde4997ea2b01e80f345d
BLAKE2b-256 4dbc4ec5ea993819c32e84701da1245ea5b7413b21e07a446d579b69c1fae6b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b74f69fa982b6ffb5f9f302bc4f6eb07a56e146326214b164c40197757c3209
MD5 1f28ccfc7ddddf82552087322563e795
BLAKE2b-256 1516c0770e438394466cd74605b2547057944e3c25d3747c21532dff4fed2d1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e1c2d32b9ef99479bc9da683c4e36eb3b80ad77d56aed92df746f77f29430ec6
MD5 6a58ca02e8f50668bc41ed57fe101f98
BLAKE2b-256 d3629ccf96b0594836bcdeda5ec1aac853d6fdf43fd143e0ba445e53afb85a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7b751c199a2037a8af2120979795f5ad055468d99d2e71f1ea48a3ca5c3fe6d
MD5 6dcfefed831a27c9ad5a5c1e74ca3e64
BLAKE2b-256 571f2e30da52716881d48dc39bdd323a4a20fca73e2aab8c72d09690e24f009c

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.15-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.15-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd971d56dfed03d6484eb0452ac0258331c842c8ee20c9f23a53339b4b64bfaa
MD5 b84143a9255644313381ff2c38211ad0
BLAKE2b-256 63a3f81e6d0763af04e385566c16f08127afcbca9e38c9b747451d84e32edf88

See more details on using hashes here.

Provenance

The following attestation bundles were made for roboto_mcap_codec-0.1.15-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.

Supported by

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