0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ros2bagをカットできる!!

Posted at

はじめに

こんにちは!!B4の黒田です!!
本記事は,ros2bagをカットする方法についてです!!

  1. git cloneからbuildまでの流れ
  2. 実際にros2bagをカットする

※重要
OS: ubuntu22.04
Supported ROS: galactic,humble
/HOME内でCtrl+Hを押して,.bashrcを開く.
.bashrc内に

$source /opt/ros/humble/setup.bash 
$source /opt/ros/galactic/setup.bash

上記の2つの内,1つ書いてあればOK!!
次の,buildする際に必要です.

1. git cloneからbuildまでの流れ

まずは,下記のurlを開いてください!!
https://github.com/tier4/ros2bag_extensions」

これからbuild,git cloneします.

$mkdir -p $HOME/extension_ws/src
$cd $HOME/extension_ws/src
$https://github.com/tier4/ros2bag_extensions.git
$source /opt/ros/humble/setup.bash 
$rosdep install --from-paths . --ignore-src --rosdistro=${ROS_DISTRO}
$colcon build --symlink-install --catkin-skip-building-tests --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release

上記のコマンドを打つ上で,

$sudo apt install python3-rosdep2

2. 実際にros2bagをカットする

ros2 bag slice

$cd extension_ws/
# 1. from 1629430104.911167670 to the bag end time
$ros2 bag slice input_bag -o sliced_from -s 1629430104.911167670

# 2. from the bag start time to 1629430124
$ros2 bag slice input_bag -o sliced_till -e 1629430124

# 3. from 1629430104.911 to 1629430124
$ros2 bag slice input_bag -o sliced_between -s 1629430104.911 -e 1629430124

上記の「1」を用いて例を書きます.

$cd extension_ws/
$ros2 bag slice '/home/megken/0_data/kota/bag/2021-10-14_run2_cut' -o sliced_from -s 1634174820.738

また,startとendの時間はコマンドで見ることができます

$ros2 bag info '/home/megken/0_data/kota/bag/2021-10-14_run2_cut' 

Screenshot from 2023-12-20 16-11-31.png

以上です.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?