Copied from https://github.com/foxglove/mcap/tree/main/python/mcap-ros1-support
Usage Demo
import tempfile
from mcap_owa.highlevel import OWAMcapReader, OWAMcapWriter
from owa.core.message import OWAMessage
from owa.core import MESSAGES
# Access message types through the global registry
KeyboardEvent = MESSAGES['desktop/KeyboardEvent']
class String(OWAMessage):
_type = "std_msgs/String"
data: str
def main():
with tempfile.TemporaryDirectory() as tmpdir:
file_path = tmpdir + "/output.mcap"
# Writing messages to an OWAMcap file
with OWAMcapWriter(file_path) as writer:
for i in range(0, 10):
publish_time = i
if i % 2 == 0:
topic = "/chatter"
event = String(data="string message")
else:
topic = "/keyboard"
event = KeyboardEvent(event_type="press", vk=1)
writer.write_message(event, topic=topic, timestamp=publish_time)
# Reading messages from an OWAMcap file
with OWAMcapReader(file_path, decode_args={"return_dict": True}) as reader:
for mcap_msg in reader.iter_messages():
print(f"Topic: {mcap_msg.topic}, Timestamp: {mcap_msg.timestamp}, Message: {mcap_msg.decoded}")
if __name__ == "__main__":
main()
For above script, stdout is following:
Topic: /chatter, Timestamp: 1741767097157638598, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097157965764, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097157997762, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158019602, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158036925, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158051239, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158065463, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158089318, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158113250, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158129738, Message: {'event_type': 'press', 'vk': 1}
Metadata
Release files for mcap-owa-support 0.6.6
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_owa_support-0.6.6.tar.gz | 13.7 kB | Without provenance | Details for mcap_owa_support-0.6.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcap_owa_support-0.6.6-py3-none-any.whl | Python 3 | none | any | Details for mcap_owa_support-0.6.6-py3-none-any.whl |
Total release size: 26.3 kB
Release files / mcap_owa_support-0.6.6.tar.gz
| Download URL | mcap_owa_support-0.6.6.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9866f41eccfca215fe8f9e2c1b857709458f77b13ebc7426974207737149312
|
|
BLAKE2b-256 checksum How to use checksums |
21dfa328940f66a6aa0dcf268d97c54ac2618abbb2801520018506d60c634d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mcap_owa_support-0.6.6-py3-none-any.whl
| Download URL | mcap_owa_support-0.6.6-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
846d6c3512befac5ef5f634a035667dab8da250d0b36d2c105fe26811ba832f7
|
|
BLAKE2b-256 checksum How to use checksums |
49c72355fecf37d81b4ee8e0ac42c95493a1e0df70a08ddb84c7415327b43963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mcap-owa-support 0.6.6
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.