Skip to main content
pipeline status coverage report python versions PyPI - Downloads

Rosbags

Rosbags is the pure python library for everything rosbag. It contains:

  • highlevel easy-to-use interfaces,

  • rosbag2 reader and writer,

  • rosbag1 reader and writer,

  • extensible type system with serializers and deserializers,

  • efficient converter between rosbag1 and rosbag2,

  • and more.

Rosbags does not have any dependencies on the ROS software stacks and can be used on its own or alongside ROS1 or ROS2.

Rosbags was developed for MARV, which requires a fast, correct, and flexible library to read, manipulate, and write the various rosbag file formats.

Getting started

Rosbags is published on PyPI and does not have any special dependencies. Simply install with pip:

pip install rosbags

Read and deserialize messages from rosbag1 or rosbag2 files:

from pathlib import Path

from rosbags.highlevel import AnyReader
from rosbags.typesys import Stores, get_typestore

bagpath = Path('/home/ros/rosbag_2020_03_24')

# Create a type store to use if the bag has no message definitions.
typestore = get_typestore(Stores.ROS2_FOXY)

# Create reader instance and open for reading.
with AnyReader([bagpath], default_typestore=typestore) as reader:
    connections = [x for x in reader.connections if x.topic == '/imu_raw/Imu']
    for connection, timestamp, rawdata in reader.messages(connections=connections):
         msg = reader.deserialize(rawdata, connection.msgtype)
         print(msg.header.frame_id)

Convert between rosbag versions:

# Convert "foo.bag", result will be "foo/"
rosbags-convert foo.bag

# Convert "bar", result will be "bar.bag"
rosbags-convert bar

# Convert "foo.bag", save the result as "bar"
rosbags-convert foo.bag --dst /path/to/bar

# Convert "bar", save the result as "foo.bag"
rosbags-convert bar --dst /path/to/foo.bag

Documentation

Read the documentation for further information.

Contributing

Thank you for considering to contribute to rosbags.

To submit issues or create merge requests please follow the instructions provided in the contribution guide.

By contributing to rosbags you accept and agree to the terms and conditions laid out in there.

Development

Clone the repository and setup your local checkout:

git clone https://gitlab.com/ternaris/rosbags.git

cd rosbags
uv sync

This creates a new virtual environment with the necessary python dependencies and installs rosbags in editable mode. The rosbags code base uses pytest as its test runner, run the test suite by simply invoking:

uv run pytest

To build the documentation from its source run sphinx-build:

uv run sphinx-build -a docs public

The entry point to the local documentation build should be available under public/index.html.

Support

Professional support is available from Ternaris.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rosbags-0.11.5.tar.gz (281.6 kB view details)

Uploaded Source

Built Distribution

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

rosbags-0.11.5-py3-none-any.whl (144.9 kB view details)

Uploaded Python 3

File details

Details for the file rosbags-0.11.5.tar.gz.

File metadata

  • Download URL: rosbags-0.11.5.tar.gz
  • Upload date:
  • Size: 281.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rosbags-0.11.5.tar.gz
Algorithm Hash digest
SHA256 f6fc16e52af1f383209010557c92933d4ac30a1b376c97e215b71244b26304d8
MD5 876d9600b0ef83ee9555e6537cf71cfe
BLAKE2b-256 ab3db618779b1eb36f0f50b2634e59bc9cc4d5c87a3c1e32bcda2f8f33684275

See more details on using hashes here.

File details

Details for the file rosbags-0.11.5-py3-none-any.whl.

File metadata

  • Download URL: rosbags-0.11.5-py3-none-any.whl
  • Upload date:
  • Size: 144.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rosbags-0.11.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e81bc1bbdadeb1a03cd43f9d67dfb2e17ac9fd5245c8ee5119da72ce8a7ab29b
MD5 5b8e6f89834d3305d88a42ed1289af1f
BLAKE2b-256 1a8eb4f03a302c071a9f764cc79e450dbab6a97c0034eb662990836e1e0d16fa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.11.5 This release

2 files

0.11.4

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.11

2 files

0.10.10

2 files

0.10.9

2 files

0.10.8

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.23

2 files

0.9.22

2 files

0.9.21

2 files

0.9.20

2 files

0.9.19

2 files

0.9.18

2 files

0.9.17

2 files

0.9.16

2 files

0.9.15

2 files

0.9.14

2 files

0.9.13

2 files

0.9.12

2 files

0.9.11

2 files

0.9.10

2 files

0.9.9

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page