Skip to content

Commit 5836232

Browse files
committed
feat: Add to README
1 parent b5ef7e6 commit 5836232

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ uv tool install pybag-sdk
1717

1818
## Quick Start
1919

20+
### CLI
21+
2022
```bash
2123
# Get file information
2224
pybag info data.mcap
@@ -28,6 +30,26 @@ pybag filter data.mcap -o output.mcap --include-topic /camera
2830
pybag merge input1.mcap input2.mcap -o output.mcap
2931
```
3032

33+
### Unified Reader
34+
35+
The `Reader` class provides a common interface for reading both MCAP and ROS 1 bag files.
36+
37+
The file format is automatically detected from the file extension.
38+
39+
```python
40+
from pybag import Reader
41+
42+
# Works with both .mcap and .bag files
43+
with Reader.from_file("data.mcap") as reader:
44+
for msg in reader.messages("/camera"):
45+
print(msg.log_time, msg.data)
46+
47+
# Same API for ROS 1 bag files
48+
with Reader.from_file("data.bag") as reader:
49+
for msg in reader.messages("/sensor/*"): # glob patterns supported
50+
print(msg.topic, msg.msg_type, msg.data)
51+
```
52+
3153
### Reading MCAP Files
3254

3355
```python

0 commit comments

Comments
 (0)