LoginSignup
4
6

More than 3 years have passed since last update.

MacのDockerでUbuntu+ROSを動かす

Posted at

自動運転車やロボットを動かすならROSだよね。ということで。
まずはMacでROSを動かしてみたいと思います。

DockerでUbuntuを動かす

参考:https://qiita.com/yasuoka_dev/items/073f7e8c7dba75993323

$ docker pull ubuntu:18.04

ユーザを作って、sudoできるようにしておく。

UbuntuにROSを入れる

参考:http://www1.meijo-u.ac.jp/~kohara/cms/technicalreport/ubuntu18-04_ros_install

aptへのROSのダウンロード先の登録

$ 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-get update
$ apt-get install vim
$ apt-get install sudo

lsb_releaseがない。。
しかもこの状態でapt-get installしようとすると下記のファイルにゴミが残っているようでエラーに。。

E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)
E: The list of sources could not be read.
E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)
E: The list of sources could not be read.

ファイルを消してあげる。
しかもlsb_releaseでなく、lsb-releaseに変わっている。。罠が多すぎ。

$ rm /etc/apt/sources.list.d/ros-latest.list
$ sudo apt-get install lsb-release

最初から、sudo入れて、lsb-release入れて、その後にやろう。

ダウンロードのための公開鍵の取得

$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

gnupgがない。

$ sudo apt-get install gnupg

できたっぽい。

ROSのインストール

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

すごい数のパッケージ。1416パッケージ。
途中でなぜか都市の選択が。6:Asia>79:Tokyo を選択。
完了。

あと、rosdepのインストールは別途手動で必要なようなので、下記で入れる。

apt install python-rosdep

catkin_ws まで作成。
試しにパッケージを入れてみる。

$ sudo apt-get install -y ros-melodic-joystick-drivers

ros-tutorialsパッケージもいいかも。

日本語のチュートリアルドキュメントもあった。
https://github.com/tork-a/tork_moveit_tutorial/releases/tag/0.0.10

DockerだとGUIがないので、ブラウザから立ち上げるタイプもあった。
https://qiita.com/karaage0703/items/957bdc7b4dabfc6639da

$ docker run -p 6080:80 --shm-size=512m tiryoh/ros-desktop-vnc:melodic

コマンド一発。簡単すぎる。

4
6
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
4
6