ROS2的Bag文件如何转CSV文本文件

各位鱼粉大家晚上好,不知不觉又到周末,小鱼这里祝大家周末愉快!

今天有位鱼粉问小鱼一个问题,如何把ROS2录制的文件转成TXT格式?

小鱼的理解其实他的意思是转成文本格式,且不问为啥要这样干,ROS1反正是支持的,ROS2支持吗?

小鱼把ROS2官方翻了一遍,没找到相应方法。

没有就只能自己造轮子了,因为ROS2默认把包记录的数据存储成了sqllite3的数据库格式了,这就很有意思了哈,既然是数据库,我们就可以直接读取了,然后导出成CSV格式。

如果是从头开始肯定很麻烦,最终还是伟大的github帮助了小鱼,本来想要拿来就用的代码,最后经过多次尝试,发现目前没有可以在foxy版本上拿来就用的代码,最后是小鱼妥协了,打算自己整活一个,这里立一个flag,本周内搞定这个工具。

今天晚上的成果如下:
在这里插入图片描述

已经把录制的包文件成功转出来了,但是消息内容没有进行反序列化~这个就是接下来的工作内容了。

最后祝大家周末愉快,早点休息哦~

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
As an AI language model, I cannot perform any actions beyond providing information. However, I can provide you with some guidance on how to convert a ROS1 bag file to a ROS2 bag file. There are different approaches to converting ROS1 bag files to ROS2 bag files. One of the simplest ways is to use the ROS1-ROS2 bridge, which allows communication between ROS1 and ROS2 systems. To convert a ROS1 bag file to a ROS2 bag file using the bridge, you can follow these steps: 1. Install the ROS1-ROS2 bridge package on your ROS2 system. You can do this by running the following command in your terminal: ``` sudo apt-get install ros-<distro>-ros1-bridge ``` Make sure to replace `<distro>` with the ROS2 distribution you are using (e.g., foxy, galactic). 2. Source the ROS1 and ROS2 environments in separate terminal windows: ``` source /opt/ros/<distro>/setup.bash # for ROS1 source /opt/ros/<distro>/setup.bash # for ROS2 ``` 3. Launch the ROS1-ROS2 bridge node in one terminal window: ``` ros2 run ros1_bridge dynamic_bridge ``` 4. In another terminal window, use the rosbag tool to play the ROS1 bag file and publish its messages to the ROS2 bridge: ``` ros1bag play <ros1_bag_file> --clock --pause --loop ``` 5. In a third terminal window, use the ROS2 bag tool to record the messages published by the bridge: ``` ros2 bag record -a ``` This will record all the messages published by the ROS1-ROS2 bridge and save them to a ROS2 bag file. Note that the conversion process may take some time, depending on the size of the ROS1 bag file and the complexity of the messages it contains. Also, not all message types are currently supported by the ROS1-ROS2 bridge, so you may encounter some errors or limitations during the conversion process.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值