Skip to main content

A Python library to work with bag files without ROS.

Project description

pybag

A Python library to work with bag files (MCAP format) without ROS.

[!Warning] The library is still in the early stages of development and the API is still unstable

Installation

# Add dependency to your package
uv add pybag-sdk

# Install pybag cli
uv tool install pybag-sdk

Quick Start

# Get file information
pybag info data.mcap

# Filter messages
pybag filter data.mcap -o output.mcap --include-topic /camera

# Merge multiple files
pybag merge input1.mcap input2.mcap -o output.mcap

Reading MCAP Files

from pybag.mcap_reader import McapFileReader

with McapFileReader.from_file("data.mcap") as reader:
    for msg in reader.messages("/camera"):
        print(msg.log_time, msg.data)

Writing MCAP Files

from pybag.mcap_writer import McapFileWriter
from pybag.ros2.humble import std_msgs

with McapFileWriter.open("output.mcap") as writer:
    log_time_ns = 1000
    msg = std_msgs.String(data="hello")
    writer.write_message("/status", log_time_ns, msg)

Custom Messages

from dataclasses import dataclass
import pybag

@dataclass
class SensorData:
    __msg_name__ = 'custom/msg/SensorData'
    temperature: pybag.float32
    humidity: pybag.float32

with McapFileWriter.open("sensors.mcap") as writer:
    writer.write_message("/sensor", 1000, SensorData(25.5, 60.0))

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

pybag_sdk-0.6.1.tar.gz (159.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybag_sdk-0.6.1-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

Details for the file pybag_sdk-0.6.1.tar.gz.

File metadata

  • Download URL: pybag_sdk-0.6.1.tar.gz
  • Upload date:
  • Size: 159.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"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}

File hashes

Hashes for pybag_sdk-0.6.1.tar.gz
Algorithm Hash digest
SHA256 735385b169e568e8e0cac86db3d3328e30e63c9bb1c4974388a9354b97c867ab
MD5 b224e74275cd7068ee6df9297add756d
BLAKE2b-256 013413b16216177da95306daba16eeb354e4e0ce84ab5c80f4d9cbf31c1e9f58

See more details on using hashes here.

File details

Details for the file pybag_sdk-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: pybag_sdk-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 69.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"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}

File hashes

Hashes for pybag_sdk-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cca5d9665adff6f6d3c667e96ac71b9ae6a2f3bcc67df9092786d4e4df5a41ca
MD5 e3c5b476299f3df4bcca631391c4abad
BLAKE2b-256 be1120acaa063907b01fdc5d1fb6aa5c56b68a69ae444b1b3a4fd3b99022bb72

See more details on using hashes here.

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