rosbag-topic-compare
Determine the topic consistency in a rosbag dataset
This package is a rewriting of rosbag-compare for rosbags in both ROS1 and ROS2.
Use case
Say you have a bunch of rosbags inside a folder and you don't know whether or not all those rosbags have the same topics. rosbag-topic-compare will :
- retrieve the topics contained in each rosbag
- export a summary of the ros topics in a JSON file
- plot the topics that are missing for each rosbag :
Installation
rosbag-topic-compare can be installed from PyPi :
$ pip install rosbag-topic-compare
Or, if you want the plotting feature:
$ pip install rosbag-topic-compare[plot]
Usage
rosbag-topic-compare can be used both as a command line application and in Python code.
Command line
A basic use of rosbag-topic-compare is to simply call it with the path of the folder that contains rosbags. This will simply print out a YAML string with a summary of the comparison.
$ rosbag-topic-compare /path/to/folder/with/rosbags
You can also generate a figure that will show what topics are missing in each rosbag with the --plot/-p flag. This figure helps when you want to find out if all rosbags in a dataset contains all or some of the expected topics.
$ rosbag-topic-compare -p /path/to/your/rosbag/dataset
Here are all the CLI options of rosbag-topic-compare:
$ rosbag-topic-compare -h
usage: rosbag-topic-compare [-h] [-m METADATA] [-p] [--fig FIG] bagfolder
positional arguments:
bagfolder Dataset directory path
options:
-h, --help show this help message and exit
-m METADATA, --metadata METADATA
Metadata summary output path
-p, --plot Plotting mode : display a summary plot
--fig FIG, --summary-figure-path FIG
Path for saving a topic consistency figure
Python Code API
You can also call rosbag-topic-compare directly into your Python code :
from rosbag_compare import BagTopicComparator
data_path = "/path/to/folder/with/rosbags"
rbag_comp = BagTopicComparator(data_path)
# This step may take time as it open each rosbag separately
# Will show a progress bar
rbag_comp.extract_data()
# Export summary to a JSON file
rbag_comp.export_metadata() # Defaults to topics_<foldername>.json
rbag_comp.export_metadata("topics.json")
rbag_comp.export_metadata("topics.yaml")
# Generate a figure with the name of the
# missing topics for each rosbag
rbag_comp.plot() # Show figure
rbag_comp.plot(img_path="topics_summary.jpg") # Save figure to path
# Create a new comparator from exported metadata
rbag_comp = BagTopicComparator.from_json("topics.json")
rbag_comp = BagTopicComparator.from_yaml("topics.yaml")
Contributing
Pull requests are welcome and don't hesitate to open issues
(Recommended) flit is used to package this module. Development packages can be installed using flit :
$ python -m venv venv
$ source venv/bin/activate
$ pip install flit
$ flit install
(Alternative) Development requirements can be installed using pip :
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements/requirements-dev.txt
Acknowledgements
This package relies strongly on rosbags for working with rosbags. Hats off to the team at Ternaris for developing and maintaining it.
License
This project is licensed under a MIT license
Metadata
Release files for rosbag-topic-compare 0.0.3
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 |
|---|---|---|---|---|
| rosbag-topic-compare-0.0.3.tar.gz | 9.8 kB | Without provenance | Details for rosbag-topic-compare-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rosbag_topic_compare-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for rosbag_topic_compare-0.0.3-py3-none-any.whl |
Total release size: 18.4 kB
Release files / rosbag-topic-compare-0.0.3.tar.gz
| Download URL | rosbag-topic-compare-0.0.3.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c43f87e51e9c53d22c2715eba1caccedee3df441900a9cf24249ee925476b06
|
|
BLAKE2b-256 checksum How to use checksums |
c8ea0ed5334a8d0ffb80669304ed57d5fdf0255cf4a12e7966861cc7bbe8ecc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / rosbag_topic_compare-0.0.3-py3-none-any.whl
| Download URL | rosbag_topic_compare-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bb78175a0242f7cf51cb7b64003363262a65543c5b0ebdbe9c1cc77b8e3bcaf
|
|
BLAKE2b-256 checksum How to use checksums |
0a4fc989484ad84725d433dfcb7f8bdfbd5047c4dfd8993dead42e4e3ef062ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for rosbag-topic-compare 0.0.3
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.