其他分享
首页 > 其他分享> > ros之rosbag的使用

ros之rosbag的使用

作者:互联网

目录

rosbag record

rosbag record -a

[TOC]

# rosbag record
+ Record all topics.
```bash
rosbag record -a
rosbag record -o session1 /chatter
rosbag record -O session2_090210.bag /chatter
rosbag record --duration=30 /chatter
rosbag record --duration=5m /chatter
rosbag record --duration=2h /chatter
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

rosbag info session*.bag
rosbag info -y /path/to/my.bag
rosbag info -h

rosbag play

rosbag play recorded1.bag recorded2.bag

注: 如果播放两个及以上bag包,那么他们会第一帧对其,后面根据第一帧时间戳的时间差播放。

rosbag play -s 5 recorded1.bag
rosbag play -l recorded1.bag
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'"
rosbag filter my.bag out.bag "topic == '/tf' or topic == '/tf2'"
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>
rosbag compress *.bag
rosbag compress --lz4 *.bag
rosbag compress -h

rosbag decompress

decompress <bag-files>
rosbag decompress *.bag

参考

rosbag/Commandline - ROS Wiki

rosbag record -o session1 /chatter

+ Record to bag with name NAME.bag.
```bash
rosbag record -O session2_090210.bag /chatter
rosbag record --duration=30 /chatter
rosbag record --duration=5m /chatter
rosbag record --duration=2h /chatter
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

rosbag info session*.bag
rosbag info -y /path/to/my.bag
rosbag info -h

rosbag play

rosbag play recorded1.bag recorded2.bag

注: 如果播放两个及以上bag包,那么他们会第一帧对其,后面根据第一帧时间戳的时间差播放。

rosbag play -s 5 recorded1.bag
rosbag play -l recorded1.bag
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'"
rosbag filter my.bag out.bag "topic == '/tf' or topic == '/tf2'"
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>
rosbag compress *.bag
rosbag compress --lz4 *.bag
rosbag compress -h

rosbag decompress

decompress <bag-files>
rosbag decompress *.bag

参考

rosbag/Commandline - ROS Wiki

标签:record,--,chatter,filter,bag,使用,ros,rosbag
来源: https://www.cnblogs.com/chrislzy/p/14934366.html