launch播放rosbag如下:
<launch>
<node pkg="rosbag" type="play" name="player" output="screen" args="--clock /home/xx/xxx/xxx/xxx.bag"/>
<!-- 注意这里bag文件的路径必须为绝对路径-->
</launch>
launch 录制rosbag如下:
<launch>
<node pkg="rosbag" type="record" name="bag_record" args="topic-name1 topic-name1 -o /home/xx/xxx/xxx/xxx.bag"/>
<!-- 注意这里bag文件的路径必须为绝对路径-->
</launch>
关于时间戳:
如果需要使用rosbag中的时间,则需要在launch中增添一句:
<param name="use_sim_time" value="true" />
注意播放rosbag时,需要加上--clock。
参考链接:
在roslaunch中通过rosbag运行bag文件_在roslaunch中使用rosbag_Zuo丶的博客-优快云博客