mcap-ros2-support-fast
High-performance pure Python ROS2 message serialization and deserialization for MCAP files.
No dependencies on ROS2 or a ROS2 environment.
Installation
uv add mcap-ros2-support-fast
Usage
Decoding Messages
from small_mcap import read_message_decoded
from mcap_ros2_support_fast.decoder import DecoderFactory
decoder_factory = DecoderFactory()
with open("recording.mcap", "rb") as f:
for msg in read_message_decoded(f, decoder_factories=[decoder_factory]):
print(f"{msg.channel.topic}: {msg.decoded_message}")
For a schema constant such as uint8 STATE_ACTIVE=1, decoded messages expose the same
read-only class and instance access used by ROS2 Python messages:
message = msg.decoded_message
assert type(message).STATE_ACTIVE == 1
assert message.STATE_ACTIVE == 1
Constants are metadata and are not serialized as message fields.
Encoding Messages
from small_mcap import McapWriter
from mcap_ros2_support_fast import ROS2EncoderFactory
encoder_factory = ROS2EncoderFactory()
with open("output.mcap", "wb") as f:
writer = McapWriter(f, encoder_factory=encoder_factory)
writer.start(profile="ros2")
schema_id = 1
writer.add_schema(
schema_id,
"geometry_msgs/msg/Point",
"ros2msg",
b"float64 x\nfloat64 y\nfloat64 z",
)
channel_id = 1
writer.add_channel(channel_id, "/point", "cdr", schema_id)
point = {"x": 1.0, "y": 2.0, "z": 3.0}
writer.add_message_encode(channel_id, log_time=0, data=point, publish_time=0)
writer.finish()
Bounded ROS 2 sequences enforce their declared maximum while encoding. Passing more
elements than the schema permits raises ValueError instead of silently dropping
data. Decoding remains wire-compatible and reads the length stored in the message.
Benchmarks
Median runtime from the non-slow pytest-benchmark suite on the included nuScenes dataset (data/data/nuScenes-v1.0-mini-scene-0061-ros2.mcap, 30,900 messages).
Read Performance
| Messages | mcap-ros2-support-fast | rosbags | pybag | mcap-ros2 |
|---|---|---|---|---|
| 10 | 5.46 ms | 7.47 ms | 25.56 ms | 365.70 ms |
| 100 | 36.44 ms | 67.04 ms | 110.68 ms | 1324.51 ms |
| 1000 | 127.68 ms | 234.15 ms | - | 4210.95 ms |
Note: pybag is skipped at 1000 messages because it cannot decode diagnostic_msgs/DiagnosticArray.
Read Summary (median time):
- 33-67x faster than reference mcap-ros2
- 1.37-1.84x faster than rosbags
- 3.04-4.68x faster than pybag (10-100 msgs; pybag skipped at 1000 due to decoder limitations)
Write Performance (Read + Write)
| Messages | mcap-ros2-support-fast | rosbags | pybag | mcap-ros2 |
|---|---|---|---|---|
| 10 | 17.36 ms | 18.33 ms | 56.32 ms | 928.81 ms |
| 100 | 119.05 ms | 129.59 ms | 253.93 ms | 3132.39 ms |
| 1000 | 397.07 ms | 460.15 ms | - | 9193.86 ms |
Read+Write Summary (median time):
- 23.2-53.5x faster than reference mcap-ros2
- 1.06-1.16x faster than rosbags
- 2.13-3.24x faster than pybag (10-100 msgs; pybag skipped at 1000 due to decoder limitations)
Write-Only Performance
| Messages | mcap-ros2-support-fast | rosbags | pybag | mcap-ros2 |
|---|---|---|---|---|
| 10 | 11.34 ms | 10.91 ms | 30.67 ms | 576.93 ms |
| 100 | 66.75 ms | 53.50 ms | 104.61 ms | 794.56 ms |
| 1000 | 224.47 ms | 177.82 ms | - | 1357.78 ms |
Write-Only Summary (median time):
- 6.0-50.9x faster than reference mcap-ros2
- 0.96-1.26x similar to rosbags (rosbags remains slightly faster for write-only)
- 1.57-2.71x faster than pybag (10-100 msgs; pybag skipped at 1000 due to decoder limitations)
Metadata
Release files for mcap-ros2-support-fast 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcap_ros2_support_fast-0.8.0.tar.gz | 18.2 kB | Without provenance | Details for mcap_ros2_support_fast-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcap_ros2_support_fast-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for mcap_ros2_support_fast-0.8.0-py3-none-any.whl |
Total release size: 42.1 kB
Release files / mcap_ros2_support_fast-0.8.0.tar.gz
| Download URL | mcap_ros2_support_fast-0.8.0.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58c6be1d79a30bedaf6f97273d2d6f6addf46cea1d840bb694c9cad79eecdca9
|
|
BLAKE2b-256 checksum How to use checksums |
d33c5644aeccc5ea9e54c93e18171a3e8d00c461fb19f323fd31211ad2bb07a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mcap_ros2_support_fast-0.8.0-py3-none-any.whl
| Download URL | mcap_ros2_support_fast-0.8.0-py3-none-any.whl |
|---|---|
| Size | 23.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67f6fda4d3e0f4a6fb41feb87c9cb0972f106b9a40cd6fddedcbaeab297eb25f
|
|
BLAKE2b-256 checksum How to use checksums |
0b5c6db94d8db22b2a240f5d9b51d96fa3cbbadd5f8ae1f183056c227a44240d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mcap-ros2-support-fast 0.8.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.