baglab
ROS2 rosbag data analysis library. Load, explore, and visualize rosbag data with MATLAB-like simplicity using pandas DataFrames.
Features
- Lazy loading — open a bag and read only the topics you need
- Dot-access — navigate message fields like
msg.twist.linear.x - Geometry — quaternion/euler conversion, distance, pose interpolation
- Signal processing — lowpass filter, FFT, differentiation, integration
- Diagnostics — topic rate, message gaps, latency chain analysis
- Plotting — time-series, trajectory, step response, error band
Installation
Prerequisites
- Python 3.10+
- ROS2 (Humble / Jazzy)
baglab (Python only)
pip install baglab
For development:
git clone https://github.com/Kotakku/baglab.git
cd baglab
pip install -e ".[dev]"
MCAP acceleration backend (optional)
Installing baglab_mcap_backend enables high-speed MCAP reading without ROS 2 dependency.
cd baglab
sudo apt install liblz4-dev libzstd-dev
pip install --no-build-isolation ./baglab_mcap_backend
Check whether the backend is available:
import baglab
print(baglab.has_mcap_backend()) # True / False
baglab works without the backend — it falls back to rosbags (pure Python).
Usage
import baglab
# Load a rosbag (lazy loading)
bag = baglab.load("path/to/rosbag")
# List topics
print(bag.topics)
# {"/motor/angle": "sensor_msgs/msg/JointState", ...}
# Access topic data (loaded on first access)
twist_df = bag["/cmd_vel"]
# Dot-access for message fields
twist_df.msg.twist.linear.x # Series
twist_df.msg.twist.linear.df # DataFrame (columns: [x, y, z])
# Timestamps
t = baglab.stamp_to_sec(twist_df) # absolute [s]
t = baglab.stamp_to_sec(twist_df, relative=True) # relative (starts at 0)
# Reindex by publication timestamp
twist_df = baglab.reindex_by_stamp(twist_df)
Plot example
import baglab
import matplotlib.pyplot as plt
bag = baglab.load("path/to/rosbag")
twist_df = bag["/cmd_vel"]
t = baglab.stamp_to_sec(twist_df, relative=True)
vel = twist_df.msg.twist.linear.df
fig, axes = plt.subplots(3, 1, sharex=True)
for ax, axis_name in zip(axes, ["x", "y", "z"]):
ax.plot(t, vel[axis_name])
ax.set_ylabel(axis_name)
axes[-1].set_xlabel("time [s]")
plt.show()
Documentation
https://kotakku.github.io/baglab/
License
Apache-2.0
Metadata
Release files for baglab 1.1.0
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 | |
|---|---|---|---|---|
| baglab-1.1.0.tar.gz | 49.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baglab-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.1 kB
Release files / baglab-1.1.0.tar.gz
| Download URL | baglab-1.1.0.tar.gz |
|---|---|
| Size | 49.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57b97ffacb3785c70859f8de6602e456b9bc458a90876fbbc75739b21d62ffdd
|
|
BLAKE2b-256 checksum How to use checksums |
a50b3b8b8a254314c1103d30b09466adfb1eb9a2bc25c24398d1b4362629ce5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / baglab-1.1.0-py3-none-any.whl
| Download URL | baglab-1.1.0-py3-none-any.whl |
|---|---|
| Size | 45.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a62332e7c35ca2887eace0f8f1bc22ac90f522c48cbe763601bd71d37cfebf8
|
|
BLAKE2b-256 checksum How to use checksums |
94163ce514d392bfbfb5c90937c23e6c16574699859d4a9d72aaede26c007156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logSecurity for baglab 1.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for baglab-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logA 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.