5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSLでROS2(Foxy)

Last updated at Posted at 2021-04-25

WSLでROS2(Foxy)

WSLでROS2(Foxy)をインストールしてGazebo連携する方法のまとめ。

関連記事

ROS2レポジトリを追加

ROS2レポジトリを追加し、 GPG キーを承認するために下記コマンドを実行します。

sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg

ROS2リポジトリをソースリストに追加します。

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

ROS2パッケージのUpdate

aptをupdate。

sudo apt update

ROS2をインストール

sudo apt install ros-foxy-desktop

環境関数の設定

Sourceで環境関数の設定を読み込む

source /opt/ros/foxy/setup.bash

argcomplete のインストール

sudo apt install -y python3-argcomplete

## Sampleの実行

Talker

source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker

Listener

source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_py listener

Gazebo連携

sudo apt install ros-foxy-gazebo-ros-pkgs
gazebo /opt/ros/foxy/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world

gezebo-10.png

デモの車体を移動させる

ros2 topic pub /demo/cmd_demo geometry_msgs/Twist '{linear:{x: 1.0}}' -1

RVIz2

rviz2

rviz22.png

5
2
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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?