录制所有话题
rosbag record -a
录制多个话题
rosbag record -a
rosbag record /topic1 /topic2 -o xxx.bag
rosbag play xxx.bag
脚本录制方法
<launch>
<node pkg="rosbag" type="record" name="bag_record" args="/origin_topic1 /topic2 -o ~/bag/xxx.bag">
<remap from="new_topic1" to="origin_topic1" />
</node>
<!-- 路径必须为绝对路径-->
</launch>
roslaunch文件播放
<launch>
<node pkg="rosbag" type="play" name="player" output="screen" args="--clock ~/bag/xxx.bag">
<remap from="origin_topic1" to="new_topic1" />
</node>
<!-- 路径必须为绝对路径-->
</launch>
延迟播放
rosbag play <your bagfile name> -d <delay time>
仅播放前十秒
rosbag play -u 10 xx.bag
倍率播放
rosbag play -r 10 <your bagfile name>(表示10倍速率播放)
展示包的话题信息(名称、类型和消息数量:)
rosbag info <your bagfile name>
回放指定话题:
rosbag play <your bagfile name> --topics <topics>
话题重映射
rosbag play --clock XXX.bag /old_topic:=/new_topic
rosbag active修复
①切换到xxx.bag.active文件所在的目录下;
②命令行输入,生成的org文件可以删除
rosbag reindex xxx.bag.active
③转成正常格式的bag,xxx.bag.active也可以直接播放
rosbag fix xxx.bag.active result.bag