LoginSignup
5

posted at

updated at

ubuntu22.04にROS2 Humbleをインストールする

はじめに

ubuntu22.04LTSにROS2 Humbleをインストールしたので最低限必要なコマンドをメモ

aptリポジトリの追加

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

リポジトリをsource listに追加

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

ROS2 インストール

sudo apt update
sudo apt install ros-humble-desktop

動作テスト

Talkerを実行

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

別のTerminalでListenerを実行

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

環境設定

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source .bashrc

ワークスペースの作成

colconのインストール

sudo apt install python3-colcon-common-extensions
mkdir -p ~/ros2_ws/src
cd ros2_ws/
colcon build

Gazeboのインストール

ros-desktop-full でGazeboがインストールされなくなったので別にインストール

sudo apt -y install gazebo
sudo apt install ros-humble-gazebo-*

rqtのプラグインをインストール

rqt_tf_treeなどよく使うものはデフォルトではインストールされないのでaptから入れる

sudo apt install ros-humble-rqt-*

Reference

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
What you can do with signing up
5