-
rosbag
2019-11-04 13:47:101、.bag文件转.txt 将file_name.bag文件中topic_name话题的消息转换到Txt_name.txt文件中: rostopic echo -b file_name.bag -p /topic_name > Txt_name.txt 2、rosbag remap rosbag ...https://www.cnblogs.com/lovebay/p/11193388.html
1、.bag文件转.txt
将file_name.bag文件中topic_name话题的消息转换到Txt_name.txt文件中:
rostopic echo -b file_name.bag -p /topic_name > Txt_name.txt2、rosbag remap
rosbag play ros.bag /image_raw:=/camera/image_raw3、使用rxplot画时间趋势曲线
在ROS系统中,标量数据可以根据消息中提供的时间戳作为时间序列绘制图形。
运行可以发布话题的节点后,可以通过rostopic list查看当前的发布的话题,现在,我们不再去使用rostopic echo ,而是通过rxplot命令就能够看到随时间变化的值的曲线。
rqt_plot /topic/data //单个话题,单个数据
rqt_plot /topic/x:y:z //单个话题,向量数据
rqt_plot /topic/x /topic/y /topic/z
123
或是先打开GUI界面:
rosrun rqt_plot rqt_plotLibra
岁月腐蚀了曾经的青春,留下温顺苍老的影子。----------- ddb
rosbag record and play
话题录制:
录制所有发布出来的话题,此时默认将话题保存在一个以当时时间戳命名的文件夹中:$ rosbag record -a1
录制指定话题:$ rosbag record /topic1 /topic121
话题回放:
基本功能:$ rosbag play 1
等待一定时间之后发布bag文件中的内容$ rosbag play -d 1
按一定频率回放,-r选项用来设定消息发布速率,如下面命令则表示以3倍原始速率发布话题
$ rosbag play -r 3 1
回放指定话题:
$ rosbag play --topics 1
其他指令:
展示bag文件中所包含话题的名称、类型和消息数量:$ rosbag info 1
更加灵活的回放方式,例如回放除了某个话题以外的所有话题:
参考:https://answers.ros.org/question/228676/exclude-some-topics-from-rosbag-play/exclude some topics from rosbag play
注意:rosbag的remap方法-----------rosbag play ros.bag /image_raw:=/camera/image_raw
**在/ camera/image_raw以外的主题上发布rosbag图像
**
是否可以在/ camera/image_raw以外的主题上播放包含图像的rosbag文件?在/ camera/image_raw以外的主题上发布rosbag图像来源
2017-04-20 Susan94
A
回答
1是的,这是可能的,你可以简单地remap your arguments或remap your topic-tag。
您可以从终端层面做到这一点,当你玩一个节点: rosbag play mybagfile.bag /camera/image_raw:=/dataset/name 可以your rosbag play command之前,从roslaunch文件做到这一点。当你运行多个节点时,它很有用。
重映射例如:
<remap from = "/camera/image_raw" to = "/dataset/name" />
roslaunch例如:
<launch> <arg name = "pathToRosbag" default = "/home/path/to/Rosbag.bag" /> <remap from = "/camera/image_raw" to = "/dataset/name" /> <node pkg = "rosbag" type = "play" name = "player" args = "$(arg pathToRosbag)"/> </launch>
-
rosbag_editor:使用简单的GUI从给定的rosbag创建一个rosbag-源码
2021-02-05 20:52:34rosbag_editor:使用简单的GUI从给定的rosbag创建一个rosbag -
如何将两个rosbag包合并或者提取rosbag包中某些话题到一个rosbag里
2021-01-20 02:57:37python merge_bag.py -v 1028msf.bag msf.bag vinReNoOutlier.bag 就把msf.bag和vinReNoOutlier.bag完全合并在一起了,时间戳打的都是原来两个bag里原始的时间戳,而不是像一边rosbag play一边rosbag record一样录... -
Separate rosbag_storage from rosbag
2020-12-25 23:20:21<p>rosbag_storage contains the file manipulation tools but does not depend on the communication libraries. Allowing rosbag to be used at the API level w/o compiling against the communication libraries... -
roslaunch播放rosbag和录制rosbag
2021-01-26 11:54:07launch播放rosbag如下: <launch> <node pkg="rosbag" type="play" name="player" output="screen" args="--clock /home/xx/xxx/xxx/xxx.bag"/> <!-- 注意这里bag文件的路径必须为绝对路径--&...launch播放rosbag如下:
<launch> <node pkg="rosbag" type="play" name="player" output="screen" args="--clock /home/xx/xxx/xxx/xxx.bag"/> <!-- 注意这里bag文件的路径必须为绝对路径--> </launch>
launch 录制rosbag如下:
<launch> <node pkg="rosbag" type="record" name="bag_record" args="topic-name1 topic-name1 -o /home/xx/xxx/xxx/xxx.bag"/> <!-- 注意这里bag文件的路径必须为绝对路径--> </launch>
参考链接:
https://blog.csdn.net/u012423865/article/details/78278440/
https://blog.csdn.net/the_dream_runner/article/details/106922495
-
rosbag常用方法及在roslaunch中使用rosbag
2021-04-06 10:19:02rosbag 主要用于记录、回放、分析 rostopic 中的数据。它可以将指定 rostopic 中的数据记录到 .bag 后缀的数据包中. 记录所有topic数据 rosbag record -a 选项表示将当前发布的所有 topic 数据都录制保存到一个 ...rosbag 主要用于记录、回放、分析 rostopic 中的数据。它可以将指定 rostopic 中的数据记录到 .bag 后缀的数据包中.
- 记录所有topic数据
rosbag record -a
将当前发布的所有 topic 数据都录制保存到一个 rosbag 文件中,录制的数据包名字为日期加时间。没有指定文件夹名字,生成的文件在工作空间所在目录。
- 指定文件夹名字
记录所有的
cd /home/xxx/bagfile rosbag record -a
或者将指定的topic信息存到指定的文件夹下,并且打上时间戳命名,如:aaa_2021-04-06-10-09-20.bag。
rosbag record -o /home/xxx/bagfiles/aaa.bag topic_name #多个topic rosbag record -o /home/xxx/bagfiles/aaa.bag topic_name1 topic_name2
-O不会加时间戳,直接为:aaa.bag。
rosbag record -O /home/xxx/bagfiles/aaa.bag topic_name
- 使用roslaunch
<node pkg="rosbag" type="record" name="bag_record" args="topicname1 topicname2 -o /home/xxx/bagfiles/aaa.bag"/>
在roslaunch文件中添加上述语句,则在指定文件夹中生成aaa_2021-04-06-10-09-20.bag的文件,记录了主题名为topicname1和topicname2的相关信息.
-
rosbag throws rosbag::IOException at 2GB mark
2020-12-29 02:11:56<div><p>After installing <code>ros-indigo-desktop-full</code> on my 32bit Ubuntu system, <code>rosbag</code> crashes when the bag file becomes about 2GB. It prints the following: <pre><code> terminate... -
rosbag: auto-generated docs don't include rosbag/bag.h
2020-12-27 05:46:29<div><p>Most of the links here are broken: ...<p>This makes it rather difficult to get started working with the rosbag C++ API.</p><p>该提问来源于开源项目:ros/ros_comm</p></div> -
Bug in rosbag_storage: can't reuse the same instance or rosbag::Bag
2020-12-30 08:31:26<div><p>In my application I used to create a single instance or rosbag::Bag and use it as follows <ol><li>open a file</li><li>parse using rosbag::View </li><li>close() </li><li>repeat from point 1.... -
rosbag2-源码
2021-03-09 09:45:08rosbag2 用于实现rosbag2的存储库,如其相应的。 安装说明 Debian软件包 rosbag2软件包可通过debian软件包获得,因此可以通过以下方式安装 $ export CHOOSE_ROS_DISTRO=crystal # rosbag2 is available starting ... -
[ROS2] rosbag 和 ros2 bag 转换
2020-04-14 17:27:35前期录制的rosbag用以在office中做各种实验和测试,如ndt, lidar fusion等.现在切换ros2 环境,又不想去重新费时费力去重新录制ros2 bag,那么就引申了转换格式的需求. 2. 方法 I)ros1 bridge 转换 2)现成...1. 需求
前期录制的rosbag用以在office中做各种实验和测试,如ndt, lidar fusion等.现在切换ros2 环境,又不想去重新费时费力去重新录制ros2 bag,那么就引申了转换格式的需求.
2. 方法
I)通过ros1 bridge 转换topic
2)现成的模块rosbag2 v2 plugin
https://github.com/ros2/rosbag2/
https://github.com/ros2/rosbag2_bag_v2/
安装rosbag2 rosbag2 plugin
sudo apt install -y ros-dashing-rosbag2-bag-v2-plugins ros-dashing-rosbag2-converter-default-plugins ros-dashing-rosbag2-storage ros-dashing-rosbag2-transport ros-dashing-rosbag2-storage-default-plugins ros-dashing-ros2bag
查看ros2 bag info
ros2 bag info -s rosbag_v2 2019-12-20-18-00-27.bag Files: 2019-12-20-18-00-27.bag Bag size: 792.8 MiB Storage id: rosbag_v2 Duration: 6.492s Start: Dec 20 2019 10:00:33.878 (1576836033.878) End Dec 20 2019 10:00:40.371 (1576836040.371) Messages: 7513 Topic information: Topic: /ns2/rslidar2 | Type: sensor_msgs/msg/PointCloud2 | Count: 75 | Serialization Format: rosbag_v2 Topic: /ns1/rslidar1 | Type: sensor_msgs/msg/PointCloud2 | Count: 76 | Serialization Format: rosbag_v2 Topic: /points_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 65 | Serialization Format: rosbag_v2
播放
ros2 bag play -s rosbag_v2 3lidars.bag
与此同时,可以新开终端录制ros2bag 格式的文件
-XPS-15-9560:~$ ros2 bag record /points_raw /ns1/rslidar1 /ns2/rslidar2 -o 3.bag2 [INFO] [rosbag2_storage]: Opened database '3.bag2'. [INFO] [rosbag2_transport]: Listening for topics... [INFO] [rosbag2_transport]: Subscribed to topic '/ns2/rslidar2' [INFO] [rosbag2_transport]: Subscribed to topic '/points_raw' [INFO] [rosbag2_transport]: Subscribed to topic '/ns1/rslidar1' [INFO] [rosbag2_transport]: All requested topics are subscribed. Stopping discovery... ^C[INFO] [rclcpp]: signal_handler(signal_value=2) -XPS-15-9560:~$ ros2 bag info 3.bag2/ Files: 3.bag2.db3 Bag size: 268.9 MiB Storage id: sqlite3 Duration: 6.427s Start: Apr 13 2020 08:08:39.422 (1586765319.422) End Apr 13 2020 08:08:45.850 (1586765325.850) Messages: 209 Topic information: Topic: /ns1/rslidar1 | Type: sensor_msgs/msg/PointCloud2 | Count: 73 | Serialization Format: cdr Topic: /ns2/rslidar2 | Type: sensor_msgs/msg/PointCloud2 | Count: 73 | Serialization Format: cdr Topic: /points_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 63 | Serialization Format: cdr
但是录制下来的帧数有所减少,时间也有差异
看看录制下来的帧率
-XPS-15-9560:~$ ros2 topic hz /points_raw WARNING: topic [/ns2/rslidar2] does not appear to be published yet average rate: 14.224 min: 0.006s max: 0.141s std dev: 0.04155s window: 15 average rate: 9.122 min: 0.006s max: 0.694s std dev: 0.12617s window: 25 average rate: 8.281 min: 0.006s max: 0.742s std dev: 0.16182s window: 31 average rate: 9.239 min: 0.006s max: 0.742s std dev: 0.13851s window: 44 average rate: 9.189 min: 0.006s max: 0.742s std dev: 0.12708s window: 53
帧率也有所降低
而我们用ros1 play和record的结果,是不会有这个现象的
rosbag record /points_raw /ns1/rslidar1 /ns2/rslidar2 [ INFO] [1586768938.763631804]: Subscribing to /ns1/rslidar1 [ INFO] [1586768938.766971727]: Subscribing to /ns2/rslidar2 [ INFO] [1586768938.769629437]: Subscribing to /points_raw [ INFO] [1586768938.772643391]: Recording to rosbag_2020-04-13-17-08-58.bag. -XPS-15-9560:/tmp$ rosbag info rosbag_2020-04-13-17-08-58.bag path: rosbag_2020-04-13-17-08-58.bag version: 2.0 duration: 6.4s start: Apr 13 2020 17:09:03.83 (1586768943.83) end: Apr 13 2020 17:09:10.27 (1586768950.27) size: 277.5 MB messages: 216 compression: none [216/216 chunks] types: sensor_msgs/PointCloud2 [1158d486dd51d683ce2f1be655c3c181] topics: /ns1/rslidar1 76 msgs : sensor_msgs/PointCloud2 /ns2/rslidar2 75 msgs : sensor_msgs/PointCloud2 /points_raw 65 msgs : sensor_msgs/PointCloud2
对比autoware sample ros2bag
wget https://autoware-ai.s3.us-east-2.amazonaws.com/sample_moriyama_150324.bag2.tar.gz
时间,总帧数和ros1 bag完全一致
但是播放的时候,帧率也会下降
-XPS-15-9560:~$ ros2 topic hz /points_raw average rate: 10.111 min: 0.088s max: 0.105s std dev: 0.00447s window: 11 average rate: 9.575 min: 0.088s max: 0.197s std dev: 0.02143s window: 20 average rate: 9.380 min: 0.088s max: 0.211s std dev: 0.02691s window: 29 average rate: 9.282 min: 0.088s max: 0.211s std dev: 0.02877s window: 38 average rate: 9.247 min: 0.088s max: 0.211s std dev: 0.02910s window: 48 average rate: 8.898 min: 0.088s max: 0.212s std dev: 0.03451s window: 56 average rate: 8.774 min: 0.088s max: 0.212s std dev: 0.03623s window: 64 average rate: 8.696 min: 0.088s max: 0.212s std dev: 0.03719s window: 73 average rate: 8.832 min: 0.088s max: 0.212s std dev: 0.03521s window: 83 average rate: 8.844 min: 0.088s max: 0.212s std dev: 0.03468s window: 92 average rate: 8.678
播放的时候,也许会出现
-XPS-15-9560:~$ ros2 bag play sample_moriyama_150324.bag2 [ERROR] [rosbag2_storage]: Could not open 'sample_moriyama_150324.bag2' with 'sqlite3'. Error: Failed to read from bag 'sample_moriyama_150324.bag2': File 'sample_moriyama_150324.bag2/sample_moriyama_150324.bag2_0.db3' does not exist. [ERROR] [rosbag2_storage]: Could not load/open plugin with storage id 'sqlite3'. [ERROR] [rosbag2_transport]: Failed to play: No storage could be initialized. Abort autoware@weilin-XPS-15-9560:~$ vim sample_moriyama_150324.bag2/
原因是对应的path要修改一下,如
vim metadata.yaml relative_file_paths: - ../sample_moriyama_150324.bag2/sample_moriyama_150324.bag2_0.db3
-
[rosbag] synchronize topics' time stamp to /clock with rosbag play
2020-12-28 10:34:18rosbag play with --clock option and use_sim_time param does work in most cases, but does not work with gazebo, because gazebo itself publishes /clock. <p>In this case, we need to synchronize the ... -
ros之rosbag使用
2018-11-06 20:07:00ros之rosbag 我是大自然的搬运工。。。。 rosbag record Record all topics. rosbag record -a Prepend PREFIX to beginning of bag name before date stamp. rosbag record -o session1 /chatter Record to ... -
处理图片集写入到rosbag中,并合并其他rosbag中的topic数据(C++)
2021-01-27 17:08:231.C++对rosbag中的操作 参考链接:http://wiki.ros.org/rosbag/Code%20API#C.2B-.2B-_API 将视察图转换为深度图写入到rosbag中 rosbag::Bag bag_out(argv[2],rosbag::bagmode::Write); uint16_t fx = 688.34765625;... -
ROS使用介绍——rosbag
2020-04-29 10:45:07rosbag相当于是把一段实时数据打包成了一个bag文件,这个文件可以按照自己喜欢的方式去做处理,也可以发送给其他人。可以说,rosbag在学习ROS的过程中扮演了十分重要的角色。本文主要内容来自官网,但做了些概括和... -
ROS service interface for Rosbag
2020-12-29 13:30:04<p>About a year ago I modified the <code>rosbag</code> package to act as a ROS service provider for local/remote logging control. That way I could start/stop/start-over the recording of messages being... -
How to modify rosbag?如何修改rosbag?
2018-07-03 20:18:00本文示例修改使用rosbag中的frame id 在http://wiki.ros.org/bag_tools中,能找到 change_camera_info.py usage: change_frame_id.py [-h] -o OUTPUT_BAGFILE -i INPUT_BAGFILE -f FRAME_ID ... -
Rosbag filter
2020-04-26 17:44:20通过rosbag filter 制作想要的bag场景: 一定时间内有特定topic。 注意:t.secs 是从rosbag info 得到的,不能从0开始。 命令:rosbag info small.bag path: small.bag version: 2.0 duration: 8:38s (518s) ... -
rosbag: allow writing message to rosbag without knowing its type (C++)
2020-12-27 05:48:22rosbag API, and want to delete a single message from a bag. For this, I was thinking of opening the bag in <code>Read</code> mode, opening another bag in<code>Write</code> mode, and then iterate over... -
rosbag_snapshot-源码
2021-02-13 20:49:00rosbag_snapshot 解决方案与已弃用的rosrecord -s命令类似,但具有附加功能。 它是作为此处的新软件包添加的,而不是根据对rosbag进行修补。 它订阅主题并维护最近的消息(例如行车记录仪)的缓冲区。 这在实时... -
rosbag_timeline-源码
2021-03-30 17:34:46rosbag_timeline 什么是新的 rqt_bag具有相同的功能,但是它显示的时间戳是消息到达rosbag record ,而不是消息生成的时间。 该工具显示消息时间戳,并带有一些辅助功能,例如主题排序,着色等。 它是如何工作的 ... -
ROSBAG 解析
2021-03-15 14:55:23ros自带将bag包中点云文件解析为pcd文件 rosrun pcl_ros bag_to_pcd 3.bag /velodyne_points pcd 上述命令中,三个参数分别...rosbag/bag.h> #include <rosbag/view.h> // 此处为include相关消息类的头文件 -
rosbag reader
2021-01-11 19:28:25<div><p>Starting from issue #1919, I worked on it a little bit and I made a class that reads bag files using directly the rosbag API. It implements the following functionalities <ol><li> <p>Reads a ... -
ros学习(一)——rosbag使用
2019-08-24 21:50:50rosbag简介 rosbag 既可以指命令行中数据包相关命令,也可以指 c++/python 的 rosbag 库。这里的 rosbag 是指前者。 rosbag 主要用于记录、回放、分析 rostopic 中的数据。它可以将指定 rostopic 中的数据记录到 .... -
rosbag使用教程
2020-11-27 10:18:58rosbag官网:http://wiki.ros.org/rosbag/Commandline 1 查看发布的话题 rostopic list rostopic list -v 2 bag数据记录——所有发布的消息 mkdir ~/bagfiles cd ~/bagfiles/ rosbag record -a //记录所有话题消息 ... -
ROS 中 rosbag 相关命令介绍
2020-07-29 11:05:24rosbag既可以指命令行中数据包相关命令,也可以指 c++/pythond的 rosbag 库。这里的 rosbag 是指前者。 rosbag 主要用于记录、回放、分析 rostopic 中的数据。它可以将指定 rostopic 中的数据记录到.bag后缀的数据包... -
ros 发布信息频率_ROS 中 rosbag 相关命令总结
2020-12-19 13:37:02rosbag简介rosbag 既可以指命令行中数据包相关命令,也可以指 c++/python 的 rosbag 库。这里的 rosbag 是指前者。rosbag 主要用于记录、回放、分析 rostopic 中的数据。它可以将指定 rostopic 中的数据记录到 .bag ... -
reused rosbag::Bag instance crashes
2020-12-25 23:20:33<p>I found a workaround by using a new instance of rosbag::Bag for the second rosbag file. This is working as expected. <p>Strange side note: when I change the topic name in the second bag file from ...