前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ROS_Kinetic_13 ROS数据录制与回放

ROS_Kinetic_13 ROS数据录制与回放

作者头像
zhangrelay
发布2019-01-23 10:53:54
7190
发布2019-01-23 10:53:54
举报

ROS_Kinetic_13 ROS数据录制与回放

官网教程:http://wiki.ros.org/cn/ROS/Tutorials/Recording%20and%20playing%20back%20data

录制数据

~$ roscore

~$ rosrun turtlesim turtlesim_node

~$ rosrun turtlesim turtle_teleop_key

~$ rostopic list -v Published topics:  * /turtle1/color_sensor [turtlesim/Color] 1 publisher  * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher  * /rosout [rosgraph_msgs/Log] 2 publishers  * /rosout_agg [rosgraph_msgs/Log] 1 publisher  * /turtle1/pose [turtlesim/Pose] 1 publisher Subscribed topics:  * /turtle1/cmd_vel [geometry_msgs/Twist] 1 subscriber  * /rosout [rosgraph_msgs/Log] 1 subscriber

~$ mkdir tempbagfiles

~$ cd tempbagfiles

~/tempbagfiles$ rosbag record -a

[ INFO] [1464622786.642608299]: Recording to 2016-05-30-23-39-46.bag. [ INFO] [1464622786.643371124]: Subscribing to /turtle1/color_sensor [ INFO] [1464622786.650218953]: Subscribing to /turtle1/cmd_vel [ INFO] [1464622786.657875320]: Subscribing to /rosout [ INFO] [1464622786.664989967]: Subscribing to /rosout_agg [ INFO] [1464622786.670321801]: Subscribing to /turtle1/pose

检查数据

~/tempbagfiles$ rosbag info 2016-05-30-23-39-46.bag

path:        2016-05-30-23-39-46.bag version:     2.0 duration:    2:58s (178s) start:       May 30 2016 23:39:46.68 (1464622786.68) end:         May 30 2016 23:42:45.24 (1464622965.24) size:        1.5 MB messages:    22780 compression: none [2/2 chunks] types:       geometry_msgs/Twist [9f195f881246fdfa2798d1d3eebca84a]              rosgraph_msgs/Log   [acffd30cd6b6de30f120938c17c593fb]              turtlesim/Color     [353891e354491c51aabe32df673fb446]              turtlesim/Pose      [863b248d5016ca62ea2e895ae5265cf9] topics:      /rosout                    11 msgs    : rosgraph_msgs/Log   (2 connections)              /rosout_agg                 7 msgs    : rosgraph_msgs/Log                /turtle1/cmd_vel          589 msgs    : geometry_msgs/Twist              /turtle1/color_sensor   11087 msgs    : turtlesim/Color                  /turtle1/pose           11086 msgs    : turtlesim/Pose

回放数据

~/tempbagfiles$ rosbag play 2016-05-30-23-39-46.bag

[ INFO] [1464623082.857050437]: Opening 2016-05-30-23-39-46.bag Waiting 0.2 seconds after advertising topics... done. Hit space to toggle paused, or 's' to step.  [RUNNING]  Bag Time: 1464622881.662740   Duration: 94.985623 / 178.560502

~/tempbagfiles$ rosbag play -r 20 2016-05-30-23-39-46.bag

[ INFO] [1464623266.773542306]: Opening 2016-05-30-23-39-46.bag Waiting 0.2 seconds after advertising topics... done. Hit space to toggle paused, or 's' to step.  [RUNNING]  Bag Time: 1464622965.207398   Duration: 178.530281 / 178.560502      Done.

录制数据子集

~/tempbagfiles$ rosbag record -O subset /turtle1/command_velocity /turtle1/pose

[ INFO] [1464623367.500278060]: Subscribing to /turtle1/command_velocity [ INFO] [1464623367.505078209]: Subscribing to /turtle1/pose [ INFO] [1464623367.509689375]: Recording to subset.bag.

~/tempbagfiles$ rosbag info subset.bag

path:        subset.bag version:     2.0 duration:    52.9s start:       May 30 2016 23:49:27.71 (1464623367.71) end:         May 30 2016 23:50:20.61 (1464623420.61) size:        255.9 KB messages:    3297 compression: none [1/1 chunks] types:       turtlesim/Pose [863b248d5016ca62ea2e895ae5265cf9] topics:      /turtle1/pose   3297 msgs    : turtlesim/Pose

:~/tempbagfiles$ rosbag play -r 4 subset.bag

[ INFO] [1464623465.046134599]: Opening subset.bag Waiting 0.2 seconds after advertising topics... done. Hit space to toggle paused, or 's' to step.  [RUNNING]  Bag Time: 1464623420.578935   Duration: 52.866810 / 52.898519      Done.

-End-

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年05月30日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ROS_Kinetic_13 ROS数据录制与回放
    • 录制数据
      • 检查数据
        • 回放数据
          • 录制数据子集
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档