ROS进二阶学习笔记(6) -- ROS Bag

来源:互联网 发布:matlab plot 矩阵 编辑:程序博客网 时间:2024/05/19 10:37



ROS Bag是ROS计算图级的一个概念:


Bags:

ref : http://wiki.ros.org/Bags


在 计算图里 在线使用

   工具:rosbag
   创建bags, 收听topic,记录数据。可以回放或者remap到别的topic。
   rosbag还能处理具有时间戳的数据,publish一个 simulated clock that corresponds to the time the data was recorded in the file。
   bag文件的格式用来记录和回放数据都是非常高效的,消息都是跟在ros里一样的格式记录的。
   具体command-line使用方法: rosbag command-line usage

离线使用和数据迁移

   有多种离线使用方式。

   工具:rqt_bag

     可以让你可视化bag数据,plot 或者image。ref rqt_bag: http://wiki.ros.org/rqt_bag

   工具:rostopic

     快速查看bag文件,list topics 和 echoing data to console.
       Display messages in a bag file:
             $ rostopic echo -b log_file.bag /topic_name
       rostopic list
             list

      Display a list of current topics.
            $ rostopic list
            list <namespace>
            List topics in the specified namespace. In previous versions, this is equivalent to the rostopic info command.
                    $ rostopic list /namespace
          -b
          List topics in a bag file.
          -p
          List only publishers.
          -s
          List only subscribers.
          -v
          Verbose mode.
                    $ rostopic list -v
          --host New in Diamondback
          Group list by hostname.
   ref more: http://wiki.ros.org/rostopic

   Programmatic APIs - rosbag工具

     rosbag 工具可以更快速操作bag文件,这让你提取满足特定filter的消息到一个新的bag文件。
     参考: rosbag Code API, Cookbook examples,
               
     rosrecord 包里有APIs,可以让其他的C++/python 包有能力to iterate over stored messages,它老了,已经被rosbag取代了。

     msg文件有更新时,bag file可以轻易地被提取。bag 文件格式里存有与之所存数据匹配的 msg 文件。像rosbagmigration这样的工具可以写规则进去,来自动的更新bag files当它变得out of date.

工具:

   >> rosbag: unified console tool for recording, playback, and other operations.
   >> rqt_bag: graphical tool for visualizing bag file data.
   >> rostopic: the echo and list commands are compatible with bag files.

Older tools

    The following tools have been superceded by rosbag, but are still supported:
    >> rosrecord
    >> rosplay
    >> rosrebag

格式

bag文件的格式与普通用户没多大关系了。
The underlying format of a bag file should not be relevant to the average user. It is subject to change, but backwards compatibility will be maintained by the programmatic access libraries, or custom conversion libraries.


===================

如何在程序中使用bag 文件

问题1: 数据的记录和回放到console

        ref: http://wiki.ros.org/rosbag/Code%20API

问题2: a collection of code fragments demonstrating use of the rosbag APIs.

        ref: http://wiki.ros.org/rosbag/Cookbook


更多高级的玩法

当需要更高级的功能时,得ref: rosBag 的 API 文档
提取数据时,可能会涉及到 tuples Generator 的操作。






0 0
原创粉丝点击