专栏首页机器人课程与技术ROS_Kinetic_13 ROS数据录制与回放

ROS_Kinetic_13 ROS数据录制与回放

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-

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 在ROS Kinetic和Gazebo 8中使用智能汽车仿真演示

    智能车无人驾驶技术是目前人工智能和机器人技术的研究热点,有许多开源平台可以使我们零基础零成本入门无人驾驶技术。本文分享一下目前ROS官网最新推荐的一款开源汽车仿...

    zhangrelay
  • MSRDS机器人仿真软件学习资源汇总

    使用spl可以获得丰富的支持,如C#, Java, Python, MATLAB, LabView, and Flash

    zhangrelay
  • ROS机器人网络配置的一些问题

    2 控制不实时,使用ssh登陆master控制,比client直接启动节点控制效果好一些;

    zhangrelay
  • Step by step to install WordPress on CentOS 7

    MudOnTire
  • 如何搭建 LAMP 网站服务环境

    Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为...

    宮園薰
  • 通过Chocolatey软件包管理器安装.NET Core

    在Linux的世界里,有了yum/apt-get百分之九十的软件都可以通过它来安装管理。但是在Windows系统上,装个软件还是挺折腾的。比如我要装个Chrom...

    张善友
  • 让你的布局滚动起来—ScrollView

    通过两天的”实战“,今天我们稍微放松一下脚步,让大家喘口气歇一会儿,我们今天为大家带来的控件,解决了太多在项目中遇到的适配问题,如果你已经碰到了这种问题,就紧跟...

    下码看花
  • 通过Chocolatey软件包管理器安装.NET Core

    张善友
  • windows下jenkins安装部署

    环境搭建(windows版本) 一、安装包下载地址 1、JDK安装包: 32位地址:http://download.oracle.com/otn-pub/jav...

    苦叶子
  • 自定义控件详解(二):Path类 相关用法

    听着music睡

扫码关注云+社区

领取腾讯云代金券