ATT_POWER 9d148527a4
feat: add 'trans' command to aimrt_cli for converting aimrtbag to rosbag (#39)
* feat: support translate aimrtbag to rosbag

* feat: 添加数据包转换工具

* CI: change build worlflow image tag from v20240927 to latest

* feat: now support transfer aimrtbag to rosbag

* feat: Adjust the build and installation process of aimrt_cli , copy ROS2 plugin proto files when building aimrt_cli

* chore: format the code style

* chore: format code

* feat: Differentiate between aimrt-cli and transbag, make transbag an independent tool; add documentation for transbag

* chore: Update CI trigger from label "ci ready" to "ci"

* chore: format code

* choro: feat:  compile bagtrans module only when bagrecord and ros2 plugin are enabled; improve documentation

* choro: Modify activation method for bagtrans

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-18 20:19:00 +08:00

1.8 KiB
Raw Blame History

bagtrans 工具

简介

bagtrans 是一个 AimRT 官方提供的命令行工具,用于将 AimRT 的 bag 文件转换为 ROS2 的 bag 文件其中ros2 原生消息会直接转换pb 消息会转换为 aimrt 提供的 ros2_plugin_proto 中的 RosMsgWrapper 消息类型。

安装

bagtrans 工具是一个基于 Python 开发的小程序,并且依赖于 aimrt 提供的 ros2_plugin_protobuf 消息类型,通过以下步骤安装:

  1. 编译 aimrt 生成 ros2_plugin_proto

执行您 aimrt 源码库中的build.sh文件进行编译,可以在build.sh文件中关闭其他您不需要的 CMake 选项以加快编译,但是需要确保AIMRT_BUILD_ROS2_PLUGINAIMRT_BUILD_RECORD_PLAYBACK_PLUGIN 选项为ON

  1. 在终端中执行以下命令:
cd <path_to_your_aimrt_src_code>/src/tools/bagtrans
python setup.py install

bagtrans工具将会自动安装到您的 python 环境中。使用 pip list | grep bagtrans可查看是否安装成功。可使用 pip uninstall bagtrans进行卸载。

使用说明

bagtrans 工具的使用方法如下:

每次使用前,需要使用命令 source <path_to_your_aimrt_src_code>/src/tools/bagtrans/build/share/ros2_plugin_proto/local_setup.bash 以修改环境变量。

transbag 命令的使用方法如下:

bagtrans trans -h, --help 会显示参数说明:

options:
  -h, --help            show this help message and exit
  -s SRC_DIR, --src_dir SRC_DIR
                        aimrtbag source directory.
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        directory you want to output your files.

其中 -s 参数为必填参数,表示 aimrtbag 的源目录,-o 参数为必填参数表示转换后的bag的输出目录如果输出目录不存在则会自动创建如果输出目录存在则会覆盖。