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
python -m venv venv
. venv/bin/activate

pip install -r requirements-dev.txt
pip install -e .

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:

pytest

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

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.

Release files for rosbags 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rosbags 0.10.0
File Size Uploaded
rosbags-0.10.0.tar.gz 172.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rosbags 0.10.0
File Interpreter ABI Platform
rosbags-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 281.8 kB

Release files / rosbags-0.10.0.tar.gz

Download URL rosbags-0.10.0.tar.gz
Size 172.1 kB
Tags Source
SHA-256 checksum
How to use checksums
095f2e88a159a0af86f97dc873038097653487faea49cc76ba1c1448793960d1
BLAKE2b-256 checksum
How to use checksums
e15fba3cd07cfa373b87852cfe354ac123a73178548b921d72b74742a3afd3dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / rosbags-0.10.0-py3-none-any.whl

Download URL rosbags-0.10.0-py3-none-any.whl
Size 109.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e71745b646ba2284144efad5cc9fd397a1218d566081e0b9a123e375f874ae1
BLAKE2b-256 checksum
How to use checksums
1e6159470fd70e74e554ecd7fd80bd465b0c5655c7b47e78ac9141b602f92db3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

0.11.5

2 release files

0.11.4

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.9

2 release files

0.10.8

2 release files

0.10.7

2 release files

0.10.6

2 release files

0.10.5

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

This release

0.10.0 This release

2 release files

0.9.23

2 release files

0.9.19

2 release files

0.9.18

2 release files

0.9.17

2 release files

0.9.16

2 release files

0.9.14

2 release files

0.9.13

2 release files

0.9.12

2 release files

0.9.11

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page