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