Skip to main content

A thin wrapper around rosbag.Bag with some convenient methods

Project description

bagmanager

A thin wrapper around rosbag.Bag with some convenient methods

alt text

Installation

pip install bagmanager

Usage

from bagmanager import BagManager
bag_file = '/path/to/bag/file.bag'
bag_manager = BagManager(bag_file=bag_file)

# info about the bag file
print(bag_manager)

# get information about the topic
topic_info = bag_manager.get_topic_info(topic='some_topic', get_header_time=True)
# get_header_time=True is costly but returns a list of timestamps from the messages headers.

# get the timestamp from the message header of the 3rd message
time_header = topic_info['msg_time_list_header'][2]

# get the timestamp from the bag of the 1st message
time_rosbag = topic_info['msg_time_list_rosbag'][0]

# get the number of messages in the topic
number_of_messages_in_topic = topic_info['message_count']

# get the message type of the topic
message_type = topic_info['message_type']

# get the frequency of messages in the topic
frequency = topic_info['frequency']


# get the closest msg from 'another_topic' to a message from 'some_topic'by its 3rd message **header** time
msg = bag_manager.get_closest_message_by_header_time(topic='another_topic', time_header=time_header)

# get the closest msg from 'another_topic' to a message from 'some_topic'by its 1st message **rosbag** time
msg = bag_manager.get_closest_message_by_rosbag_time(topic='another_topic', time_rosbag=time_rosbag)

# get a msg from 'some_topic' by index
msg = bag_manager.get_message_by_index(topic='some_topic', index=number_of_messages_in_topic-1)


# get the number of messages from topics in an interval of times
start_time_rosbag = topic_info['msg_time_list_rosbag'][2]
end_time_rosbag = topic_info['msg_time_list_rosbag'][7]
message_count = bag_manager.get_message_count_in_interval(topics=['some_topic', 'another_topic'], start_time_rosbag=start_time_rosbag, end_time_rosbag=end_time_rosbag)

Development

Create a venv (recommended)

git clone https://github.com/omrirz/bagmanager.git
python -m pip install -r requirements.txt

Test

python -m pytest

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

bagmanager-0.0.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

bagmanager-0.0.5-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file bagmanager-0.0.5.tar.gz.

File metadata

  • Download URL: bagmanager-0.0.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for bagmanager-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e6591ef1fee202800ff9077fc507fcaa1a880505c7e3ac39b69d5b386e294eb0
MD5 70b145bdf256ae1cba950b47ef3826af
BLAKE2b-256 2d72337fa42df77bfc9db2a4d1ac92f3ab998a2d713cb1b53da679cbd1eb8075

See more details on using hashes here.

File details

Details for the file bagmanager-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: bagmanager-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for bagmanager-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8ee6ceacbea27ef7bf7f148e880085f54690d7dcd38d1a7d99c612f6845b2998
MD5 8e85f3412fbd370818f1e67548485624
BLAKE2b-256 939cdabcfe9cd53c0d7e57e5a5d8e5267a7fe0e3cf8cd7ec600c3292f7e7a7b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page