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 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.

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.16rc1.tar.gz (161.7 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.16rc1-cp310-abi3-win_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

roboto_mcap_codec-0.1.16rc1-cp310-abi3-musllinux_1_2_x86_64.whl (1.9 MB view details)

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

roboto_mcap_codec-0.1.16rc1-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.16rc1-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.16rc1-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.16rc1-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.16rc1-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.16rc1.tar.gz.

File metadata

  • Download URL: roboto_mcap_codec-0.1.16rc1.tar.gz
  • Upload date:
  • Size: 161.7 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.16rc1.tar.gz
Algorithm Hash digest
SHA256 f27d51f78208048c2dc9cc1c159b53aa87b06b2c6ce3fe16c69f9c36cfc351a2
MD5 40c43d00fa7fd14904b06cb18c2fcd79
BLAKE2b-256 86ebffc07f428d55428efb530983e7623d1644a308ce0214d193e6f56ede9a76

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 eb068d3ae0bd1a297ec312fe78bd350d155518e16a59970b51f04cc2f22a268d
MD5 a2b979900003c7fcd243aa3735d2f0a3
BLAKE2b-256 7c8714c526a6633d913ac38bea654edcbab4d5129b00ccc40d717a56dc6f4a91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d416264bf79d16fa3ecfdc4b88dbc2b1f54c5b83efdd49b0e7e83d3cdcb2b56f
MD5 1c13d9baebf4513e387e64a6ced7f340
BLAKE2b-256 d2b5fc3f48c1e5c2e5a177f4d9ca58aa0e70b9fb662576ebfed8a447f34ede46

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3c9dde58722dfde0db764a00cba3a68ed884be9f074c7f52f634e823b51d4af2
MD5 b40153993071eedad517f3d93e2c5b2e
BLAKE2b-256 8ab67b550f4fbc2d4b7b157bc123ddc33d7489b12b197670939db151a6ea0b2f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7a0b3221e14df2be949c1a526f08d3ae85201379e234beff6cfa6c03f394105a
MD5 46412d48b0a51e218ce74a7d5f4eba85
BLAKE2b-256 0948a2bbe9bcab1dad6fc4473335a9b1a9ccac9c5c1939e946132c97402d6732

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f358d5f1f1043c9b3dd0c3e4a06da8dfb089da23242ab70241f44e9455a5193
MD5 7434f2293b7f4960ab5dbe6fcdc34ee5
BLAKE2b-256 4b7c6bbd6e74716c6c9e86bae4e3b348d10fa4f76e30f4511c9b8499e21cd16d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34002722add0ac4e92f8e3c1d2ef1dfddaf903e7ec14944bf2e8a8a85cb45028
MD5 c9210d18f71150513fe18f533edfcb43
BLAKE2b-256 71371a9e4d8b0ab309aa79ad1dd152b09d0b28fda6e5e8f1a93efb08e6b80e6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab21c7f0f4d96384f2ec6e939413d03c0e8235efec978d9b53283ce6f75d4c4f
MD5 daec5c11b93167345ddcb2abf254ce26
BLAKE2b-256 f9636526bbe3b0b284aa03193e39af061e7b14842f6491838dcd28b05ae79655

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for roboto_mcap_codec-0.1.16rc1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 352700c5f6520c9615909892f0db7543fde17b9bb21a3b44a5e02e139b21343c
MD5 9399641fceccd3767d3054dc6b8be470
BLAKE2b-256 2fb654ad9db3a949fe00c03a9b9fad636b6d4382fdfd3cd74dbc43ed761f4aa1

See more details on using hashes here.

Provenance

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