LoginSignup
1
3

More than 3 years have passed since last update.

Raspberry Pi 3B+(Raspbian buster)にROS kinetic をインストールしてturtlesimを動かすまで辿り着けませんでした

Posted at

目的

Raspberry Pi 3B+(Raspbian buster)にROS kinetic をインストールしてturtlesimを動すまで辿り着けませんでした。備忘録です。

※ Raspbian busterにROS kinetic をインストールするために必要なboostライブラリのインストールに失敗して挫折しました。
※ 代わりに、Raspbian stretchでROS kinetic インストールしましたがturtlesimパッケージ取得方法が分からず挫折しました。
※ 代わりに、Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かすと正常に動きそちらを使うことにしました。

準備

▪️RaspberryPi 3B+を用意します。
Raspberry Pi 3 Model B+ スターターセット

▪️Raspberry Pi 3B+(Raspbian buster)を準備します

Raspberry Pi 3 Model B+の初回セットアップ(購入から起動まで)
raspbian/images 日本ミラーサイト

公式サイトだとダウンロードに時間が掛かるためミラーサイトからデータ取得します。

▪️Raspberry Pi 3B+(Raspbian buster)にROS kinetic をインストールします。

Installing ROS Kinetic on the Raspberry Pi
Raspberry Pi 3 にROS kinetic をインストールしてみました。

公式サイトのRaspbian busterを利用する場合はROS wiki記載の通り boost 1.58 ライブラリをインストールする必要があります。

Boostライブラリのビルド方法
Installing ROS Kinetic on the Raspberry Pi
On Raspbian Buster the compilation may fail with "'boost/tr1/unordered_set.hpp' file not found". This is because rospack version used in Kinetic is dependent on boost 1.58. To fix this error try installing boost 1.58 manually.

しかしながら、RaspberryPi3B++busterだと、./b2 install の実行後インストール完了せず諦めました。(詳細は後述※1)

--
そもそもRaspbian busterはRaspiberryPi4用のimageかもしれないと思い、
Raspbian stretchで同手順を実施しました。

するとstretch + ROS kineticインストール完了しましたが、
その後のturtlesimパッケージインストールできませんでした。(詳細は後述※2)

sourcelist更新すれば良いかもしれませんが方法が分からず挫折しました。

turtlesim
To install and start the turtlesim:
sudo apt-get install ros-$(rosversion -d)-turtlesim

$ sudo apt-get install ros-kinetic-turtlesim
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package ros-kinetic-turtlesim

テスト

確認用としてROSの基本パッケージの1つであるturtlesimを動かすまで辿り着けませんでした。

roscore起動
$ roscore
turtlesim_node起動
$ rosrun turtlesim turtlesim_node
turtle_teleop_key node起動
$ rosrun turtlesim turtle_teleop_key

他サイトを探しても同様のROS kinetic環境でturtlesimを動かしている記事が見つからず、Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かすことで環境構築を進めることにしました。

参考

Raspberry Pi 3 Model B+の初回セットアップ(購入から起動まで)
raspbian/images 日本ミラーサイト
MacでRaspberryPi入門
Installing ROS Kinetic on the Raspberry Pi
Raspberry Pi 3 にROS kinetic をインストールしてみました。
ROS KineticをRaspberry Pi 3にインストールしてセンサノードに仕立てる
Installing ROS Kinetic on the Raspberry Pi
Boostライブラリのビルド方法
Boost Downloads
fatal error: 'boost/tr1/unordered_set.hpp' file not found
Get Boost 1.58
turtlesim Package Summary
ROS Kinetic on Raspbian Stretch for Raspberry PI 3
Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かす

※1RaspberryPi3B++busterだと、./b2 install の実行後インストール完了せず諦めました。

BoostライブラリインストールしないとROSインストール時に下記エラーが出ます。

$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
ros_catkin_ws/src/rospack/include/rospack/rospack.h:108:10: fatal error: boost/tr1/unordered_set.hpp: そのようなファイルやディレクトリはありません
 #include <boost/tr1/unordered_set.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

下記の通りboostライブラリをインストールする必要があります。
インストール手順を記載します

Installing ROS Kinetic on the Raspberry Pi
On Raspbian Buster the compilation may fail with "'boost/tr1/unordered_set.hpp' file not found". This is because rospack version used in Kinetic is dependent on boost 1.58. To fix this error try installing boost 1.58 manually.

$ wget http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2
$ tar --bzip2 -xf boost_1_58_0.tar.bz2
$ cd boost_1_58_0
$ ./bootstrap.sh --prefix=$HOME/boost_1_58_0

> Select your configuration options and invoke ./bootstrap.sh again without the --help option. Unless you have write permission in your system's /usr/local/ directory, you'll probably want to at least use
> $ ./bootstrap.sh --prefix=path/to/installation/prefix
$ ./b2 install
$ (download boost_1_70_0.tar.gz)
$ tar zxvf boost_1_70_0.tar.gz
$ cd boost_1_70_0
$ ./bootstrap.sh
$ ./b2 install -j2 --prefix=$HOME/boost_1_70_0
> ./b2 install -j2 --prefix=(インストールしたいディレクトリ)
> /usr以下を使用すると環境を壊すことになりかねないので、通常は$HOME/localや$HOME/boost_1_51_0といったディレクトリを用意するのが良いでしょう。

./b2 install が完了せず挫折しました。(メモリスワップ領域枯渇?)

※2 その後のturtlesimパッケージインストールできませんでした。

Raspbian stretchにROSを下記の通りインストールする。

How to Install ROS Kinetic on Raspberry Pi 3 running Raspbian Stretch Lite

ros-kinetic-install-on-rasp-stretch.sh
sudo apt-get install dirmngr
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://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake --fix-missing --allow-unauthenticated

sudo rosdep init
rosdep update

mkdir -p ~/ros_catkin_ws
cd ~/ros_catkin_ws

rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
wstool init src kinetic-ros_comm-wet.rosinstall

cd ~/ros_catkin_ws
rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j 1

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

catkin_make_isolatedが固まる場合は、-j 1を指定して並列ビルドを抑制すると良い。

$ sudo apt-get install ros-$(rosversion -d)-turtlesim
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
E: パッケージ ros-kinetic-turtlesim が見つかりません
$ rosinstall_generator desktop --rosdistro kinetic --deps --wet-only --exclude collada_parser collada_urdf --tar > kinetic-desktop-wet.rosinstall

sourcelistを更新すれば良いかもしれないが更新方法が分からず挫折

1
3
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
3