WindowsでROS 2 examplesをビルドする手順
Windows版のROSを利用
準備
PowerShellを管理者として開き,Chocolatey のGUIをインストール
$ choco install ChocolateyGUI
Gitをインストール
ChocolateyGUI上でGitを検索してインストール
colconをインストール
$ pip install -U colcon-common-extensions
VisualStudio Codeをインストール
ROS 2 examplesのビルド手順
1. プロンプトを開く
管理者として「Developer Command Prompt for VS 2019」を実行
2. 作業用のディレクトリを作る
$ cd c:\
$ md \dev\ros2_example_ws\src
$ cd \dev\ros2_example_ws
3. examplesをクローンする
ブランチの切り替え(ROS2 dashing用のコードに切り替え)
$ cd c:\dev\ros2_example_ws\src\examples
$ git checkout dashing
$ cd c:\dev\ros2_example_ws\src\example_interfaces
$ git checkout dashing
4. ROS2の設定
$ call C:\dev\ros2_dashing\local_setup.bat
5. ビルド
作業用ディレクトリに移動
$ cd c:\dev\ros2_example_ws
以下のコマンドでビルドツールを実行
$ colcon build --symlink-install
6. 動作確認
$ cd c:\dev\ros2_example_ws
$ call install\setup.bat
$ ros2 run examples_rclpy_minimal_subscriber subscriber_member_function
別のプロンプトを開く
$ cd c:\dev\ros2_example_ws
$ call install\setup.bat
$ ros2 run examples_rclpy_minimal_publisher publisher_member_function
参考URL