ROS2 でよく使いそうなスペルをまとめました.開発を進めながら適宜追加していきます.
実行環境は Ubuntu, Distribution は foxy を前提として書いていきます.
ROS2環境の読み込み
source /opt/ros/foxy/setup.bash
毎回打つのは面倒なので, .bashrc
に書いてしまいましょう.
パッケージの作成 (C++)
cd <workspace>/src
ros2 pkg create --build-type ament_cmake <package-name>
依存パッケージ読み込み
cd <workspace>
rosdep install -i --from-path src --rosdistro foxy -y
パッケージのビルド
cd <workspace>
colcon build --packages-select <package-name>
ワークスペース環境の読み込み (Overlay)
これをやらないと,自作パッケージの実行ができません.
cd <workspace>
. install/setup.bash
トピックのremap
ros2 run ros2_pigpio wheels --ros-args --remap /wheels:=/cmd_vel
コメント