LoginSignup
1
0

More than 3 years have passed since last update.

Ubuntu/ROS アップグレードメモ

Last updated at Posted at 2020-03-29

はじめに

ROSとUbuntuのバージョンは以下のようにリンクしています。(LTSは長期サポート版)

ROS Ubuntu
Melodic Morenia 17.10 or 18.04 LTS
Kinetic Kame 15.10 or 16.04 LTS
Indigo Igloo 13.10 or 14.04 LTS

リンクしていない組み合わせを選択することは基本的に不可能です。
(例えば Ubuntu 16.04 で ROS Melodic を動かすことはできない)

環境

Ubuntu 16.04.6 LTS 18.04.3 LTS
ROS Kinetic Melodic

本題

バックアップを取る

これ大事
/home以下くらいはコピーしておきましょう。

ROS Kineticを消す

パッケージ削除

sudo apt remove ros-kinetic-*
cd ~/catkin_ws
rm -rf build devel

環境変数を削除

~/.bashrcに記述されている

.bashrc
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash

を削除する

Ubuntuのアップグレード

1時間半位かかりました。
余裕のあるときにやりましょう。

パッケージの更新

sudo apt update
sudo apt full-upgrade 

アップグレード

sudo apt install update-manager-core
sudo do-release-upgrade

この後、何度か選択肢が出現するので自分の環境に合わせて処理を進めてください。
[y]か[ENTER]を押していればいいと思う

最後の方にデスクトップマネージャーをgdm3にするかlightdmにするか聞かれます。
後から変えられるので自分の好きな方を選んでください。
(lightdmは16.04、gdm3は18.04のデフォルト)

ROS Melodicのインストール

[追記]
ROSのインストールがうまくいかない場合は
/etc/apt/sources.listに下のコマンドを追記してください。

sources.list
deb http://archive.ubuntu.com/ubuntu bionic restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-security restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates restricted universe multiverse

ROS wikiに書かれている通りにインストール

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

sudo apt update
sudo apt install ros-melodic-desktop-full
apt search ros-melodic

cd /etc/ros/rosdep/sources.list.d
sudo rm 20-default.list
sudo rosdep init
rosdep update

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

source /opt/ros/melodic/setup.bash

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

参考サイト

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