LoginSignup
18
16

More than 5 years have passed since last update.

Intel EdisonにROSをインストール

Last updated at Posted at 2014-11-09

前回記事で,Debian化したところからスタート.

Indigoのインストール説明に従って進める.

インストール準備

sources.listに追記

比較的新しいパッケージは,wheezyデフォルトでは提供されていないものもあるので.

/etc/apt/sources.list に,

deb http://ftp.jp.debian.org/debian wheezy-backports main

を追記.後で,
$ sudo apt-get update
しておくこと.

インストールに必要なパッケージの入手

$ sudo apt-get install liblog4cxx10-dev libboost-all-dev liblz4-dev libtinyxml-dev libbz2-dev
このへん,もしかしたら,rosdepで自動でやってくれてるかも.

$ pip install rosdep rosinstall_generator wstool rosinstall

$ sudo rosdep init

$ rosdep update

インストール

console_bridgeのインストール

これだけgroovyのパッケージなんだけど,catkinでも使うので,個別にインストールしておく必要があった.
こちらを参考に,

$ mkdir ~/cb_ws
$ cd ~/cb_ws
$ git clone https://github.com/ros/console_bridge
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=~/.local ../console_bridge
$ make install

catkinワークスペースの作成

$ mkdir ~/ros_catkin_ws

$ cd ~/ros_catkin_ws

ROS-Comm: (Bare Bones)のインストール

GUIなしのバージョンをインストール.

$ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --tar > indigo-ros_comm-wet.rosinstall

$ wstool init -j2 src indigo-ros_comm-wet.rosinstall

依存関係の解決

せっかく/home以下に逃がしたPythonパッケージなんだけど,rosdep叩くと,apt経由でoptに追加されるのは嫌だねーぇ.
先に導入しておくと良いのかな?

$ pip install nose argparse PyYaml empy netifaces paramiko coverage mock crypto Pillow numpy

$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y --os=debian:wheezy

"-r"オプションをつけると,何かパッケージがない場合でも先に進めるので,「それもう自分で導入した!」ってエラーのせいで進めない場合には使ってみるよろし.

catkinワークスペースのビルド

このときに,Pythonのパッケージが/home以下にインストールされるように,~/.pydistutils.cfgをいじっていたら,catkin自体のビルドシステムとカチあってダメだった!
ROSを使っているときに error: can't combine user with with prefix/exec_prefix/home or install_(plat)base というエラーが出たら,このせいなので, ~/.pydistutils.cfg の中のuserの値を0に設定すること.

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

インストールの確認

環境変数の設定

$ source ~/ros_catkin_ws/install_isolated/setup.bash

同じものを ~/.bashrc にも追記しておく.

インストール済みパッケージの確認

$ rospack list

roscoreを起動してみる

$ roscore

$ roscore
... logging to /home/alva/.ros/log/3fe2b84a-67ba-11e4-9171-fcc2de39d82d/roslaunch-ubilinux-22365.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubilinux:41785/
ros_comm version 1.11.9

SUMMARY
========

PARAMETERS
* /rosdistro: indigo
* /rosversion: 1.11.9

NODES

auto-starting new master
process[master]: started with pid [22378]
ROS_MASTER_URI=http://ubilinux:11311/

setting /run_id to 3fe2b84a-67ba-11e4-9171-> fcc2de39d82d
process[rosout-1]: started with pid [22391]
started core service [/rosout]

このように出たら,一安心.

このとき,前回の記事の「共有ライブラリを/home以下のものを見に来るように設定」をしておかないと.libconsole_bridge.soがない旨のエラーが出る.
止めるときは,Ctrl-C.

実際にパッケージをビルドしてみる

@garaemonさん記事にお世話になる.

$ cd ~/ros_catkin_ws/src
$ wstool set --git garaemon-catkin-sample-pkg https://github.com/garaemon/garaemon-catkin-sample-pkg.git
$ wstool update
$ cd ~/ros_catkin_ws

そして,

$ catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

でビルドされ,~/ros_catkin_ws/install_isolated/以下に配置される.

$ rospack find catkin_roscpp_sample
して,見つかればOK.

実行してみる

一つ目のターミナルで
$ roscore
を実行.

もう一つ,別のターミナルでEdisonにつないで,そっちでは
$ rosrun catkin_roscpp_sample hello_publisher
を実行.出力には何も出てこないけど大丈夫.

さらにもう一つ,別のターミナルでもEdisonにつないで,
$ rosrun catkin_roscpp_sample hello_subscriber
を実行.

すると,

[ INFO] [1415553430.867721509]: subscriber get message: Hello World!!
[ INFO] [1415553430.878154509]: subscriber get message: Hello World!!
[ INFO] [1415553430.887938809]: subscriber get message: Hello World!!
[ INFO] [1415553430.897799781]: subscriber get message: Hello World!!
[ INFO] [1415553430.907620039]: subscriber get message: Hello World!!
[ INFO] [1415553430.918231406]: subscriber get message: Hello World!!

と,ずらーっと出てくるので,しばし感慨にふける.
飽きたら,roscore以外のプロセスは,全部Ctrl-Cして止める.

ROSにはroslaunchという便利コマンドがあって,複数のプロセスをまとめて起動してくれる.
そのためには,roscoreが裏で起動している状態で,他のターミナルで

$ roslaunch catkin_roscpp_sample sample.launch

を実行する.
すると,この方法でも,先ほどのようにHello World!が見られる.

インストールの後

時刻合わせ大事(特にROS)

$ sudo apt-get install chrony

18
16
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
18
16