From a200fa495a7dc7ba87391bb3d9b5a5ed5b3e55a3 Mon Sep 17 00:00:00 2001 From: Tomoya Kimura Date: Mon, 6 Dec 2021 16:36:09 +0900 Subject: [PATCH] feat: add autoware_rosbag_recorder packages (#98) * release v0.4.0 * remove ROS1 packages temporarily Signed-off-by: mitsudome-r * add sample ros2 packages Signed-off-by: mitsudome-r * remove ROS1 packages Signed-off-by: mitsudome-r * Revert "remove ROS1 packages temporarily" This reverts commit ac428d4af68ef0b51992d31f692dd9aae9a4a944. Signed-off-by: mitsudome-r * add COLCON_IGNORE to ros1 packages Signed-off-by: mitsudome-r * Unify Apache-2.0 license name (#1242) * Port autoware rosbag recorder to ros2 (#1569) * Port autoware rosbag recorder to ros2 Signed-off-by: wep21 * Update record.sh Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * Add shellcheck (#2079) * Add shellcheck Signed-off-by: Kenji Miyake * Fix shellcheck Signed-off-by: Kenji Miyake * Change formatter to clang-format and black (#2332) * Revert "Temporarily comment out pre-commit hooks" This reverts commit 748e9cdb145ce12f8b520bcbd97f5ff899fc28a3. * Replace ament_lint_common with autoware_lint_common Signed-off-by: Kenji Miyake * Remove ament_cmake_uncrustify and ament_clang_format Signed-off-by: Kenji Miyake * Apply Black Signed-off-by: Kenji Miyake * Apply clang-format Signed-off-by: Kenji Miyake * Fix build errors Signed-off-by: Kenji Miyake * Fix for cpplint * Fix include double quotes to angle brackets Signed-off-by: Kenji Miyake * Apply clang-format Signed-off-by: Kenji Miyake * Fix build errors Signed-off-by: Kenji Miyake * Add COLCON_IGNORE (#500) Signed-off-by: Kenji Miyake * remove COLCON_IGNORE (#510) Co-authored-by: Takayuki Murooka * Auto/add readme common pkg (#567) * add description to global paraemeter loader * add readme to rosbag recorde * fix typo Co-authored-by: Kazuki Miyahara * Fix Format Co-authored-by: Kazuki Miyahara * Clarify the description Co-authored-by: Kazuki Miyahara * Fix Typo Co-authored-by: tkimura4 * proper description Co-authored-by: Kazuki Miyahara Co-authored-by: tkimura4 * fix topic name * fix topic name Co-authored-by: mitsudome-r Co-authored-by: Kazuki Miyahara Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Takayuki Murooka Co-authored-by: Takayuki Murooka Co-authored-by: taikitanaka3 <65527974+taikitanaka3@users.noreply.github.com> --- .pre-commit-config.yaml | 6 +++--- .../autoware_rosbag_recorder/CMakeLists.txt | 17 +++++++++++++++ common/autoware_rosbag_recorder/Readme.md | 21 +++++++++++++++++++ common/autoware_rosbag_recorder/package.xml | 18 ++++++++++++++++ .../scripts/record.sh | 21 +++++++++++++++++++ 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 common/autoware_rosbag_recorder/CMakeLists.txt create mode 100644 common/autoware_rosbag_recorder/Readme.md create mode 100644 common/autoware_rosbag_recorder/package.xml create mode 100755 common/autoware_rosbag_recorder/scripts/record.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9914e008b048c..0875e6f6e3310 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,15 +34,15 @@ repos: - id: prettier-package-xml - id: sort-package-xml - - repo: https://github.com/gruntwork-io/pre-commit - rev: v0.1.17 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.8.0.1 hooks: - id: shellcheck - repo: https://github.com/scop/pre-commit-shfmt rev: v3.4.1-1 hooks: - - id: shfmt-docker + - id: shfmt - repo: https://github.com/pycqa/isort rev: 5.10.1 diff --git a/common/autoware_rosbag_recorder/CMakeLists.txt b/common/autoware_rosbag_recorder/CMakeLists.txt new file mode 100644 index 0000000000000..03e7ca43e5296 --- /dev/null +++ b/common/autoware_rosbag_recorder/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) +project(autoware_rosbag_recorder) + +find_package(ament_cmake_auto REQUIRED) +ament_auto_find_build_dependencies() + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + +ament_auto_package() + +install(PROGRAMS + scripts/record.sh + DESTINATION lib/${PROJECT_NAME} +) diff --git a/common/autoware_rosbag_recorder/Readme.md b/common/autoware_rosbag_recorder/Readme.md new file mode 100644 index 0000000000000..087e2cffbff2f --- /dev/null +++ b/common/autoware_rosbag_recorder/Readme.md @@ -0,0 +1,21 @@ +# Autoware Rosbag Recorder + +This package is to record ros2 bag with desired topic. + +## Usage + +Here is a usage below. + +```sh +ros2 run autoware_rosbag_recorder record.sh [-o filename] +``` + +If you want some other topics to record, you need to modify below in record.sh as an example. + +```sh + ros2 bag record -e "(.*)/velodyne_packets|/pacmod_interface/(.*)|/pacmod/(.*)|/vehicle/(.*)|/sensing/imu/(.*)|/sensing/gnss/(.*)|/sensing/camera/(.*)/camera_info|/sensing/camera/(.*)/compressed|/perception/object_recognition/detection/rois(.)|/perception/object_recognition/objects" -o "$OPTARG"; +``` + +## Assumptions / Known limits + +Recording all topics in autoware is very heavy so usually you need to avoid points cloud topics to record. diff --git a/common/autoware_rosbag_recorder/package.xml b/common/autoware_rosbag_recorder/package.xml new file mode 100644 index 0000000000000..e0d2cedb04044 --- /dev/null +++ b/common/autoware_rosbag_recorder/package.xml @@ -0,0 +1,18 @@ + + + autoware_rosbag_recorder + 0.1.0 + The autoware_rosbag_recorder package + + Yukihiro Saito + Apache License 2.0 + + ament_cmake_auto + + ament_lint_auto + autoware_lint_common + + + ament_cmake + + diff --git a/common/autoware_rosbag_recorder/scripts/record.sh b/common/autoware_rosbag_recorder/scripts/record.sh new file mode 100755 index 0000000000000..0826cade9c693 --- /dev/null +++ b/common/autoware_rosbag_recorder/scripts/record.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +usage_exit() { + echo "Usage: ros2 run autoware_rosbag_recorder record.sh [-o filename]" 1>&2 + exit 1 +} + +while getopts o:h OPT; do + case $OPT in + "o") echo "record as $OPTARG" ;; + "h") usage_exit ;; + "*") usage_exit ;; + \?) usage_exit ;; + esac +done + +if [ -n "$OPTARG" ]; then + ros2 bag record -e "(.*)/velodyne_packets|/pacmod_interface/(.*)|/pacmod/(.*)|/vehicle/(.*)|/sensing/imu/(.*)|/sensing/gnss/(.*)|/sensing/camera/(.*)/camera_info|/sensing/camera/(.*)/compressed|/perception/object_recognition/detection/rois(.)|/perception/object_recognition/objects" -o "$OPTARG" +else + usage_exit +fi