8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ROS 2 コマンドチートシート

8
Last updated at Posted at 2023-12-17

topic

topic一覧
ros2 topic list
topic出力
ros2 topic echo <topic name>
topic周期
ros2 topic hz <topic name>
topic帯域
ros2 topic bw <topic name>
Example
パラメーター例
ros2 topic list
ros2 topic echo /camera/camera/color/image_raw
ros2 topic hz /camera/camera/color/image_raw
ros2 topic bw /camera/camera/color/image_raw

ros2 run

基本
ros2 run <pkg name> <pkg exec>
リマップ(オプション)
--ros-args -r /before:=/after
パラメーター(オプション)
--ros-args -p param_name:=param_value
Example
パラメーター例
ros2 run realsense2_camera realsense2_camera_node --ros-args -p enable_color:=false -r /camera/camera/color/image_raw:=/image_raw

ros2 launch

基本
ros2 launch <pkg name> <launch file>
ファイル直
ros2 launch <launch file path>
launchパラメータ(runパラメータとは違う)
param_name:=param
Example
パラメーター例
ros2 launch realsense2_camera rs_launch.py depth_module.profile:=1280x720x30 

Build

基本
colcon build
シンボルリンクを貼る(おすすめ)
colcon build --symlink-install
シンボルリンク+リリースビルド
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
シンボルリンク+リリースビルド+rustリリースビルド
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --cargo-args --release
マージビルド
colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release
単一のパッケージのみビルド(依存を考慮する
colcon build --packages-up-to <pkg name>
オプション一覧
--symlink-install
--merge-install
--cmake-args -DCMAKE_BUILD_TYPE=Release
--cmake-args -DCMAKE_BUILD_TYPE=Debug
--packages-up-to
--cargo-args --release
--cargo-args --debug
Example
パラメーター例
colcon build --packages-up-to realsense2_camera

Buildトラブった時

src以外消す
rm -rf ./install ./log ./build
rust関連でおかしいときに全てを消す
rm $HOME/.cargo/config.toml
touch $HOME/.cargo/config.toml
rm -rf ./install/ ./log/ ./build/
find ./ -name 'Cargo.lock' -type f -exec rm -rf {} \;
8
5
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
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?