ros之rosbag使用

ros之rosbag

我是大天然的搬運工。。。。express

rosbag record

  • Record all topics.
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包,那麼他們會第一幀對其,後面根據第一幀時間戳的時間差播放。session

  • 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.oop

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.code

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/Commandline - ROS Wikiorm

相關文章
相關標籤/搜索