概要

  • rosbagのtopicを大量にremapするshell scriptを作った
    • 脳死 rosbag record -a して、後でセンサ入力しか要らないことに気がついて大量のremapが必要になった時とかに使うとか
  • rosbagからtopicを抽出してrosbagを作り直す等も考えたけど面倒だったのでshell scriptでごまかした
    • “rosbag topic filter” “rosbag topic extract” “rosbag topic” でいい感じなのがパッと見つからなかったので、shell scriptでいいやってなった

環境等

shell scriptを作成する

#!/bin/bash

FILE_NAME=${1}

TOPIC_LIST=(
/tf
/tf_static
/perception/object_recognition/objects
/perception/object_recognition/tracking/objects
/perception/object_recognition/detection/objects
/localization/twist
)

TOPIC_FILTER=""
for TOPIC in ${TOPIC_LIST[@]}; do
  TOPIC_FILTER+=$TOPIC
  TOPIC_FILTER+=":=/tmp"
  TOPIC_FILTER+=$TOPIC
  TOPIC_FILTER+=" "
done
rosbag play $FILE_NAME --clock $TOPIC_FILTER

    1. rosbag infoで叩いて出てきたtopic一覧から要らないtopicをTOPIC_LISTの所に並べていく
    1. 実行権限
chmod a+x rosbag_remap.sh
    1. 実行
./rosbag_remap.sh file.bag