制御とコンピューターサイエンスの間

This is a blog to share codes and ideas for building robots/aeronautical systems

macにROS Kineticを入れた

環境

公式サイトとの違い

ROS公式サイトでは Pythonbrew install pythonでインストールしているが,自分はpyenvで管理しているのでそこのパスを使う

手順

設定

1.1 Homebrew

$ brew update
$ brew install cmake
$ brew tap ros/deps
$ brew tap osrf/simulation   # Gazebo, sdformat, and ogre
$ brew tap homebrew/core # VTK5
$ brew tap homebrew/science  # others

1.2 環境設定

公式との違い1 どこにインストールされているPythonとsitepackagesを使っているか確認

$ which python
/Users/kandai/.pyenv/shims

ディレクトリが分かったのでパッケージ管理しているフォルダを探し,homebrewでインストールしたモジュールをPythonに教えてあげる.

$ echo "$(brew --prefix) /lib/python2.7/site-packages" >> /Users/kandai/.pyenv/versions/2.7.15/lib/python2.7/site-packages/homebrew.pth

1.3 その他ツール

$ sudo -H python2 -m pip install -U pip  # Update pip
# wsPythonはしっかりインストールしましょう.rosde installの部分で怒られました.
$ sudo -H python2 -m pip install wxPython # Install python-wxtools
$ sudo -H python2 -m pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg sphinx
$ sudo -H rosdep init
$ rosdep update

2 インストール

2.1 catkin packagesのビルド

ここからはUbuntuとほぼ一緒

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
$ rosinstall_generator desktop_full --rosdistro kinetic --deps --wet-only --tar > kinetic-desktop-full-wet.rosinstall
$ wstool init -j8 src kinetic-desktop-full-wet.rosinstall

依存フォルダーを解決

$ rosdep install --from-paths src --ignore-src --rosdistro kinetic -y

catkin packagesのビルドをしていきます

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

~/ros_catkin_ws/install_isolatedにパッケージがインストールされたので,バイナリーを使えるようにするには,

$ source ~/ros_catkin_ws/install_isolated/setup.bash