机器人操作系统ROS学习实战篇之------回放rosbag包

2019/08/26 14:55
阅读数 954

继续ROS的研究,今天的内容是rosbag包的回放。

1:录制rosbag

1 cd catkin_ws                  #进入工作空间
2 mkdir bagfile/                 #创建bagfile文件夹
3 sudo chmod -R 777 ~/catkin_ws/bagfile/  #修改文件夹权限
4 cd bagfile/                  #进入bagfile文件夹
5 rosbag record -a               #记录发布的topics

2:启动话题node,消息发布器继续用上一篇写好的,有不清楚的可以点这里看消息发布器和订阅器

1 cd ~/catkin_ws                           #进入工作空间
2 rosrun pub_sub_test pub_string       #启动话题发布

 

3:回放rosbag

1 rosbag info 2019-08-23-02-18-48.bag    #查看回放信息
path:        2019-08-23-02-18-48.bag
version:     2.0
duration:    21.4s
start:       Aug 23 2019 02:18:48.00 (1566551929.00)
end:         Aug 23 2019 02:19:10.41 (1566551950.41)
size:        113.9 KB
messages:    639
compression: none [1/1 chunks]
types:       rosgraph_msgs/Log [acffd30cd6b6de30f120938c17c593fb]
             std_msgs/String   [992ce8a1687cec8c8bd883ec73ca41d1]
topics:      /chatter      212 msgs    : std_msgs/String  
             /rosout       215 msgs    : rosgraph_msgs/Log (2 connections)
             /rosout_agg   212 msgs    : rosgraph_msgs/Log
1 rosbag play 2019-08-23-02-18-48.bag     #话题回放

 以上就算完成了录制和回放的最简单功能,其他复杂场景只能以后有空再慢慢折腾了......

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部