LoginSignup
1
0

More than 1 year has passed since last update.

ubuntu20.04LTSにROS2 Galacticをインストールする

Last updated at Posted at 2021-05-25

はじめに

2021年 5月23日にROS2の最新ディストリビューションであるGalactic Geocheloneがリリースされました。

Galacticをubuntu20.04LTSにインストールしたのでインストール手順をメモ

基本的には公式のインストールガイド通り
https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html

インストール

すでにROS2 Foxyが入っている場合、~/.bashrcの以下をコメントアウト

# source /opt/ros/foxy/setup.bash
# source ~/ros2_ws/install/local_setup.bash

変更した設定を反映

$ source ~/.bashrc

PPAの追加

$ 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
$ 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

インストール

$ sudo apt update
$ sudo apt install ros-galactic-desktop

環境設定

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

colcon build インストール

すでにインストール済みの場合は不要

$ sudo apt install python3-colcon-common-extensions

ワークスペースの作成

$ mkdir -p ~/ros2_ws/src
$ cd ros2_ws/
$ colcon build

動作確認

ターミナルを開いて以下を実行

$ ros2 run demo_nodes_cpp talker

別のターミナルで以下を実行

$ ros2 run demo_nodes_py listener

以下のようにメッセージが出ていれば成功

$ ros2 run demo_nodes_cpp talker
[INFO] [1611230592.489680360] [talker]: Publishing: 'Hello World: 1'
[INFO] [1611230593.490090831] [talker]: Publishing: 'Hello World: 2'
[INFO] [1611230594.490166446] [talker]: Publishing: 'Hello World: 3'
ros2 run demo_nodes_py listener
[INFO] [1611230787.236789185] [listener]: I heard: [Hello World: 3]
[INFO] [1611230788.215690250] [listener]: I heard: [Hello World: 4]
[INFO] [1611230789.215362123] [listener]: I heard: [Hello World: 5]

参考

1
0
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
1
0