Mcap libraries for python.
Project description
MCAP Python Library
This library provides classes for reading and writing the MCAP file format.
Reader Example
from mcap.mcap0.stream_reader import StreamReader
stream = open("example.mcap", "rb")
reader = StreamReader(stream)
for record in reader.records:
print(record)
Writer Example
from time import time_ns
from mcap.mcap0.writer import Writer
stream = open("example.mcap", "wb")
writer = Writer(stream)
writer.start("ros1", "example")
schema_id = writer.register_schema(
"example", "text/plain", data="example schema".encode()
)
channel_id = writer.register_channel(
schema_id=schema_id,
topic="example_topic",
message_encoding="text/plain",
metadata={"first": "a"},
)
writer.add_message(
channel_id=channel_id,
log_time=time_ns(),
data="example message".encode(),
publish_time=time_ns(),
)
writer.finish()
stream.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mcap-0.0.1.tar.gz
(10.9 kB
view hashes)
Built Distribution
mcap-0.0.1-py3-none-any.whl
(13.5 kB
view hashes)