Recording and playing back data
Recording and playing back data
This tutorial will teach you how to record data from a running ROS system into a .bag file, and then to play back the data to produce similar behavior in a running system.
rostopic list -v
//This should yield the following output:
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
只有topic list中列出的类型的msg才可以被record到data log file。
The list of published topics are the only message types that could potentially be recorded in the data log file, as only published messages are recorded.

rosbag用法如下:
suchang@suchang-virtual-machine:~/bagfiles$ rosbag
Usage: rosbag <subcommand> [options] [args]
A bag is a file format in ROS for storing ROS message data. The rosbag command can record, replay and manipulate bags.
Available subcommands:
check Determine whether a bag is playable in the current system, or if it can be migrated.
compress Compress one or more bag files.
decompress Decompress one or more bag files.
decrypt Decrypt one or more bag files.
encrypt Encrypt one or more bag files.
filter Filter the contents of the bag.
fix Repair the messages in a bag file so that it can be played in the current system.
help
info Summarize the contents of one or more bag files.
play Play back the contents of one or more bag files in a time-synchronized fashion.
record Record a bag file with the contents of specified topics.
reindex Reindexes one or more bag files.
For additional information, see http://wiki.ros.org/rosbag

在真的发送bag file中记录的msg之前会等待0.2s,以防止前几个msg丢失.
In its default mode rosbag play will wait for a certain period (.2 seconds) after advertising each message before it actually begins publishing the contents of the bag file. Waiting for some duration allows any subscriber of a message to be alerted that the message has been advertised and that messages may follow. If rosbag play publishes messages immediately upon advertising, subscribers may not receive the first several published messages. The waiting period can be specified with the -d option.
rosbag play可以不从bag file的开始播放,可以用-s 指定从距离文件初始记录时间xx秒开始.
rosbag play -r 2 ./2019-03-25-13-48-22.bag
-r 参数指定播放倍速.
在一个复杂系统里,可能有成百上千个topic,我们不可能记录所有topic上的msg.
// -O means output.生成一个subset.bag文件. 只记录/turtle1/cmd_vel /turtle1/pose这两个topic上的msg.
rosbag record -O subset /turtle1/cmd_vel /turtle1/pose
rosbag record/play的局限
rosbag很难精确地复制一个running systerm中的行为,因为rosrecord记录的msg的时间很难做到足够精确,比方说系统1s的时候发了msg1,2s的时候发了msg2,rosbag记录到的时候可能已经是1.01s和2.02s,这样的话就差出了0.01s,在play back的时候可能就会产生微小误差.
In the previous section you may have noted that the turtle's path may not have exactly mapped to the original keyboard input - the rough shape should have been the same, but the turtle may not have exactly tracked the same path. The reason for this is that the path tracked by turtlesim is very sensitive to small changes in timing in the system, and rosbag is limited in its ability to exactly duplicate the behavior of a running system in terms of when messages are recorded and processed by rosrecord, and when messages are produced and processed when using rosplay. For nodes like turtlesim, where minor timing changes in when command messages are processed can subtly alter behavior, the user should not expect perfectly mimicked behavior.
Recording and playing back data的更多相关文章
- Learning ROS: Recording and playing back data
本文主要部分来源于ROS官网的Tutorials. Description: This tutorial will teach you how to record data from a runnin ...
- 论文笔记之:Playing for Data: Ground Truth from Computer Games
Playing for Data: Ground Truth from Computer Games ECCV 2016 Project Page:http://download.visinf.tu- ...
- ROS教程
Learning ROS 学习ROS Depending on your learning style and preferences, you can take two approaches to ...
- 一篇对iOS音频比较完善的文章
转自:http://www.cnblogs.com/iOS-mt/p/4268532.html 感谢作者:梦想通 前言 从事音乐相关的app开发也已经有一段时日了,在这过程中app的播放器几经修改我也 ...
- IOS 音频播放
iOS音频播放 (一):概述 前言 从事音乐相关的app开发也已经有一段时日了,在这过程中app的播放器几经修改我也因此对于iOS下的音频播放实现有了一定的研究.写这个系列的博客目的一方面希望能够抛砖 ...
- iOS苹果官方Demo合集
Mirror of Apple’s iOS samples This repository mirrors Apple’s iOS samples. Name Topic Framework Desc ...
- android录音功能的实现
这个录音实现是我在Bus上看到并下载的,他那个源码不完整,再次把我整理完整的代码贴出,源码地址在这:http://download.csdn.net/detail/chaozhung/5618649 ...
- 通过WinAPI播放PCM声音
在Windows平台上,播放PCM声音使用的API通常有如下两种. waveOut and waveIn:传统的音频MMEAPI,也是使用的最多的 xAudio2:C++/COM API,主要针对游戏 ...
- 小程序-demo:小程序示例-page/api
ylbtech-小程序-demo:小程序示例-page/api 以下将演示小程序接口能力,具体属性参数详见小程序开发文档. 1. page/component返回顶部 1. a) .js Page({ ...
随机推荐
- phpstorm 下载以及安装
phpstorm都知道编写php代码比较高效,这里不多说. 关键是用它就要破解,毕竟不想花钱买,在网上找了好多方法,怎么尝试都不管用,后来我只是把版本替换为2017.1(最新版才是2017.3,版本差 ...
- selenium IDE 使用方法整理
1.设置起始点(确定case从哪步开始执行),快捷键:S,效果图如下: 2.设置断点(case执行到添加断点处,将自动停止),快捷键:B,效果图如下: 3.设置判断点 如:百度输入ceshi,点 ...
- 下拉框选择selected
var id=$("#orderId").children('option:selected').val(); //selected选中项取值 var id=$('#orderId ...
- Android 7.0 存储系统—Vold与MountService分析(三)(转 Android 9.0 分析)
Android的存储系统(三) 回顾:前帖分析了Vold的main()函数和NetlinkManager的函数调用流程,截止到NetlinkHandler的创建和start()调用,本帖继续分析源码 ...
- APP测试要点—UI、功能测试
一.UI测试 测试用户界面(如菜单.对话框.窗口和其它可规控件)布局.风格是否满足客户要求.文字是否正确.页面是否美观.文字.图片组合是否完美.操作是否友好等. UI测试的目标是确保用户界面会通过测试 ...
- 为自己搭建一个分布式 IM(即时通讯) 系统
前言 大家新年快乐! 新的一年第一篇技术文章希望开个好头,所以元旦三天我也没怎么闲着,希望给大家带来一篇比较感兴趣的干货内容. 老读者应该还记得我在去年国庆节前分享过一篇<设计一个百万级的消息推 ...
- Hadoop HA高可用集群搭建(Hadoop+Zookeeper+HBase)
声明:作者原创,转载注明出处. 作者:帅气陈吃苹果 一.服务器环境 主机名 IP 用户名 密码 安装目录 master188 192.168.29.188 hadoop hadoop /home/ha ...
- 用Portable.BouncyCastle来进行加解密的代码demo
前言 这里对之前对接的公司中的代码demo做一个总结,原本为清一色的java,哈哈.这里都转成C#.用到的库是Portable.BouncyCastle.官网.之前也是准备用.net core 内置的 ...
- 设计模式之行为类模式PK
行为类模式包括: 责任链模式 命令模式 解释器模式 迭代器模式 中介者模式 备忘录模式 观察者模式 状态模式 策略模式 模板方法模式 访问者模式 行为型模式涉及到算法和对象间职责的分配 行为类模式关注 ...
- ArcGIS API For Javascript_4.8-渲染器Renderer
渲染器:Renderer 类:esri / renderers / Renderer 继承: Renderer->Accessor 子类: ClassBreaksRenderer , Heatm ...