概要
ROSを勉強するために、まずインストールしてチュートリアルを行ってみたいと考えた。ROSは基本的に Ubuntu を使うのだが、めんどくさいので、なんとか Mac でできないかと考えたところ、以下の ROS 公式サイトで Indigo を Mac にインストールする方法が掲載されていたので、これにしたがってインストールしようとした。(そして、結局インストールできないのであった。。)
参考
-
ROS公式サイト:Indigo/Installation/OSX/Homebrew/Source
ROS公式サイトに、Mac上でIndigoをインストールする方法が載っていたので、主にこのサイトを参考にしました。
インストール環境
Mac OS High Sierra 10.13.6
インストール上の注意
-
Homebrew
今回、Indigo をbrew tap
を使ってインストールします。
brew tap
については @saa さん「brew tapとは」を参考にしました。簡単に言うと、公式以外のリポジトリをフォーミュラとしてHomebrewで使用するものです。個人のレポジトリが簡単に追加でき、これで Homebrew 上の install,uninstall,update 等が使えるようになっています。indigo のレポジトリは Homebrew の公式ではないので、brew tap によりインストールしていきます(Homebrew をインストール方法は後述。) -
Python
今回、なぜか Python 関連でエラーが起きるようです。この Mac は pyenv を使って、「2.7.0」「3.5.0」「anaconda」の3つの環境がインストールしてあり、そのうち「2.7.0」を使っています。pyenv でインストールした Python には pip が入っているので良いようです。
もしあなたがシステムの Python を使っているなら、Homebrew でインストールした Python を使う方が良いようです(後述)。
インストールの流れ
1. 事前インストール
1.1. Homebrew
Homebrewをインストールしてない人は、以下のコマンドでHomebrewをインストールしてください。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Hombrew をインストールしたら、次に cmake をインストールします(すでにインストールしている人は省いてください)。
$ brew update
$ brew install cmake
1.2. Python
High Sierra を使っている人で、システム Python を使っている人は、Homebrew で Python をインストールしてください。
brew install python
Homebrew でインストールした Python には pip が自動で入っているので、pip コマンドで以下をインストールします。
$ sudo -H pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
1.3. rosdep
rosdepでは、システム依存物をダウンロードするものです。システム依存物とは、パッケージが必要とする外部ライブラリやツールで、特にOSが提供するようなもののことです。デフォルトでは、システム依存物がインストールされないので、rosdep コマンドが用意されています。
$ sudo rosdep init
$ rosdep update
2. インストール
2.1. ワークスペースを作る
とりあえずまずワークスペースを作ります。
ros_catkin_wsディレクトリをホームディレクトリ下に作り、そこに移動します。
$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
次に、rosdep を使って、indigo をインストールします。
ここでは、Desktop-Full をインストールします。Desktop-Full は以下を含んでいます。
Desktop-Full install: ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception.
$ rosinstall_generator desktop_full --rosdistro indigo --deps --wet-only --tar > indigo-desktop-full-wet.rosinstall
$ wstool init -j8 src indigo-desktop-full-wet.rosinstall
ここでError: There already is a workspace config file .rosinstall at "src". Use wstool install/modify.
のようなエラーが起きたら、以下のコマンドを試すと解決するはず(参考:Adding more packages to a wstool generated workspace)。
$ ~/ros_catkin_ws$ wstool merge indigo-desktop-full-wet.rosinstall -t src
$ ~/ros_catkin_ws$ wstool update -j 4 -t src
2.2. システム依存性の解決
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y
しかし、次のようなエラーが出た。
yoshihasMacBook:ros_carkin_ws yoshihara$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
python_qt_binding: No definition of [python-qt-bindings] for OS [osx]
qwt_dependency: No definition of [python-qt-bindings-qwt5] for OS [osx]
rviz: No definition of [libqt4-opengl-dev] for OS [osx]
gl_dependency: No definition of [python-qt-bindings-gl] for OS [osx]
webkit_dependency: No definition of [python-qt-bindings-webkit] for OS [osx]
qt_gui_cpp: No definition of [qt4-qmake] for OS [osx]
qt_gui: No definition of [python-qt-bindings] for OS [osx]
turtlesim: No definition of [libqt4] for OS [osx]
actionlib: No definition of [python-wxtools] for OS [osx]
調べてみると、どうやら Indigo では Qt4 を使うらしいが、Homevbrewでは Qt4 が排除されてしまったのでエラーが出ているらしい。
これを解消する方法がないので、Indigo のインストールを断念せざるを得なかった。
結論
結局、Mac に Indigo は入れられませんでした。
次回、Kinematics** をインストールしてみたいと思うので、またよろしくお願いいたします。
(2018.9.19作成)