rosbag-topic-remove
Filter out topics from a rosbag
Use case
Say you have too much topics in a rosbag (ROS1 or ROS2) and that you want to keep a copy of this rosbag without data from a specific sensor. rosbag-topic-remove will :
- Filter out topics based on their name
- Filter out topics based on glob-like wildcard patterns
- Preserve your original rosbag
Installation
rosbag-topic-remove can be installed from PyPi :
pip install rosbag-topic-remove
Usage
rosbag-topic-remove can be used both as a command line application and in Python code.
Command line
A basic use of rosbag-topic-remove is to simply call it from the command line.
rosbag-topic-remove /path/to/rosbag -t /topic/to_delete
rosbag-topic-remove /path/to/rosbag -t *sensor*
Here are all the CLI options of rosbag-topic-remove:
$ rosbag-topic-remove -h
usage: rosbag-topic-remove [-h] [-o OUTBAG] [-t TOPICS [TOPICS ...]] [-f]
inbag
positional arguments:
inbag Input bag
options:
-h, --help show this help message and exit
-o OUTBAG, --output OUTBAG, --outbag OUTBAG
Filtered bag
-t TOPICS [TOPICS ...], --topics TOPICS [TOPICS ...]
Topics to remove from the rosbag
-f, --force Force output file overwriting
Python Code API
You can also call rosbag-topic-remove directly into your Python code :
from rosbag_topic_remove import BagTopicRemover
data_path = "path/to/a/rosbag.bag" # ROS1
data_path = "path/to/a/rosbag" # ROS2
rbag_rem = BagTopicRemover(data_path)
# Change the input bag
rbag_rem.inbag = "path/to/another/rosbag"
# Remove /cmd_vel
rbag_rem.remove("/cmd_vel")
# Remove /cmd_vel
rbag_rem.remove("/cmd_vel")
# Remove all camera info topics
rbag_rem.remove("/*/camera_info")
# Remove all topics from the IMU and from the GPS
rbag_rem.remove(("/imu/*", "/gps/*"))
# Export a rosbag with all topics filtered
rbag_rem.export("path/to/save/this/filtered/rosbag.bag") # ROS1
rbag_rem.export("path/to/save/that/filtered/rosbag") # ROS2
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-remove 0.0.2
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-remove-0.0.2.tar.gz | 8.5 kB | Without provenance | Details for rosbag-topic-remove-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rosbag_topic_remove-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for rosbag_topic_remove-0.0.2-py3-none-any.whl |
Total release size: 16.0 kB
Release files / rosbag-topic-remove-0.0.2.tar.gz
| Download URL | rosbag-topic-remove-0.0.2.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae946b51ed606827b2601ce5529ce8b1ea1a2bf8daa557170a6fb34155306cf
|
|
BLAKE2b-256 checksum How to use checksums |
76fd76e8f2a80cf185be6b52652b1c93a9414e3edd1ea75257fb1cf0efae72ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / rosbag_topic_remove-0.0.2-py3-none-any.whl
| Download URL | rosbag_topic_remove-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63b940073873595bb1461fd41a95dece86be187c73e2a6d361261a49f227bbdd
|
|
BLAKE2b-256 checksum How to use checksums |
5f42771bc3aaca189fd18c104724667b7a10671c7196ea8e503ea1f735976b8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for rosbag-topic-remove 0.0.2
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.