ros之rosbag的使用
作者:互联网
目录
- rosbag record
- rosbag info
- rosbag play
- rosbag filter
- rosbag compress
- rosbag decompress
- 参考
- rosbag info
- rosbag play
- rosbag filter
- rosbag compress
- rosbag decompress
- 参考
rosbag record
- Record all topics.
rosbag record -a
- Prepend PREFIX to beginning of bag name before date stamp.
[TOC]
# rosbag record
+ Record all topics.
```bash
rosbag record -a
- Prepend PREFIX to beginning of bag name before date stamp.
rosbag record -o session1 /chatter
- Record to bag with name NAME.bag.
rosbag record -O session2_090210.bag /chatter
- Specify the maximum duration of the recorded bag file.
rosbag record --duration=30 /chatter
rosbag record --duration=5m /chatter
rosbag record --duration=2h /chatter
- Split the bag when maximum size or duration is reached
rosbag record --split --size=1024 /chatter
rosbag record --split --duration=30 /chatter
rosbag record --split --duration=5m /chatter
rosbag record --split --duration=2h /chatter
- 其他用法见:
rosbag record -h
rosbag info
- Display a summary of the contents of the bag files.
rosbag info session*.bag
- Print information in YAML format.
rosbag info -y /path/to/my.bag
- 其他用法见
rosbag info -h
rosbag play
- Play back (publish) the contents of the given bags.
rosbag play recorded1.bag recorded2.bag
注: 如果播放两个及以上bag包,那么他们会第一帧对其,后面根据第一帧时间戳的时间差播放。
- Start SEC seconds into the bags.
rosbag play -s 5 recorded1.bag
- Loop playback.
rosbag play -l recorded1.bag
- Multiply the publish rate by FACTOR.
rosbag play -r 10 recorded1.bag
- 更多用法见:
rosbag play -h
rosbag filter
filter <in-bag> <out-bag> <expression>
eg.
rosbag filter my.bag only-tf.bag "topic == '/tf'"
- filter by topic
rosbag filter my.bag out.bag "topic == '/tf' or topic == '/tf2'"
- filter by time
rosbag filter my.bag out.bag "t.to_sec() >= 123444.77 and t.to_sec() <= 234545.88"
- 更多用法
rosbag filter -h
rosbag compress
rosbag compress is a command-line tool for a backup of bag file. Currently, there are two supported formats:BZ2 and LZ4. BZ2 is selected by default. BZ2 generally produces smaller bags than LZ4, However, BZ2 is typically much slower than LZ4.
compress <bag-files>
- Compress the given bag files using BZ2.
rosbag compress *.bag
- Use LZ4 to compress data.
rosbag compress --lz4 *.bag
- 更多用法见:
rosbag compress -h
rosbag decompress
decompress <bag-files>
- Decompress the given bag files.
rosbag decompress *.bag
参考
rosbag record -o session1 /chatter
+ Record to bag with name NAME.bag.
```bash
rosbag record -O session2_090210.bag /chatter
- Specify the maximum duration of the recorded bag file.
rosbag record --duration=30 /chatter
rosbag record --duration=5m /chatter
rosbag record --duration=2h /chatter
- Split the bag when maximum size or duration is reached
rosbag record --split --size=1024 /chatter
rosbag record --split --duration=30 /chatter
rosbag record --split --duration=5m /chatter
rosbag record --split --duration=2h /chatter
- 其他用法见:
rosbag record -h
rosbag info
- Display a summary of the contents of the bag files.
rosbag info session*.bag
- Print information in YAML format.
rosbag info -y /path/to/my.bag
- 其他用法见
rosbag info -h
rosbag play
- Play back (publish) the contents of the given bags.
rosbag play recorded1.bag recorded2.bag
注: 如果播放两个及以上bag包,那么他们会第一帧对其,后面根据第一帧时间戳的时间差播放。
- Start SEC seconds into the bags.
rosbag play -s 5 recorded1.bag
- Loop playback.
rosbag play -l recorded1.bag
- Multiply the publish rate by FACTOR.
rosbag play -r 10 recorded1.bag
- 更多用法见:
rosbag play -h
rosbag filter
filter <in-bag> <out-bag> <expression>
eg.
rosbag filter my.bag only-tf.bag "topic == '/tf'"
- filter by topic
rosbag filter my.bag out.bag "topic == '/tf' or topic == '/tf2'"
- filter by time
rosbag filter my.bag out.bag "t.to_sec() >= 123444.77 and t.to_sec() <= 234545.88"
- 更多用法
rosbag filter -h
rosbag compress
rosbag compress is a command-line tool for a backup of bag file. Currently, there are two supported formats:BZ2 and LZ4. BZ2 is selected by default. BZ2 generally produces smaller bags than LZ4, However, BZ2 is typically much slower than LZ4.
compress <bag-files>
- Compress the given bag files using BZ2.
rosbag compress *.bag
- Use LZ4 to compress data.
rosbag compress --lz4 *.bag
- 更多用法见:
rosbag compress -h
rosbag decompress
decompress <bag-files>
- Decompress the given bag files.
rosbag decompress *.bag
参考
标签:record,--,chatter,filter,bag,使用,ros,rosbag 来源: https://www.cnblogs.com/chrislzy/p/14934366.html