LoginSignup
1
5

More than 3 years have passed since last update.

Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かす

Last updated at Posted at 2019-07-14

目的

Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かした際の備忘録です

準備

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

▪️Ubuntu Mate 16.04LTS イメージを準備してSDカードに書き込みます

下記参照サイトの"ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img"を使わせて頂きます。

RaspberryPi 3B+にROSを導入する

下記の通りSDカードをMacに繋ぎ、/dev/disk3であることを確認した後にddコマンドで書き込みます。

$ diskutil list
/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk3
   1:             Windows_FAT_32 PI_BOOT                 66.1 MB    disk3s1
   2:                      Linux                         4.9 GB     disk3s2
$ diskutil unMountDisk /dev/disk3
$ diskutil eraseDisk MS-DOS DISK /dev/disk3
$ diskutil unMountDisk /dev/disk3
$ sudo dd if=~/Downloads/ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img of=/dev/rdisk3 bs=1m
$ diskutil unMountDisk /dev/disk3

unMound後にSDカードをraspberryPi3B+に挿して電源ONするとUbuntu16.04LTSが起動する。

▪️Ubuntu Mate 16.04LTS インストール完了後にROSをインストールします。

下記参照サイトの通りにコマンド入力します。

Intall ROS Kinetic on Ubuntu MATE 16.04 on RaspberryPi3

Step 1: Go to System -> Administration -> Software & Updates
Step 2: Check the checkboxes to repositories to allow “restricted,” “universe,” and “multiverse.”

ros-install-on-ubuntu-mate.sh
#!/bin/sh 

## general
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove

## Step 3: Setup your sources.list
sudo sh -c echo deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main > /etc/apt/sources.list.d/ros-latest.list

## Step 4: Setup your keys
wget http://packages.ros.org/ros.key -O  | sudo apt-key add 

## Step 5: To be sure that your Ubuntu Mate package index is up to date, type the following command
sudo apt-get update

## Step 6: Install ros-kinetic-desktop-full
sudo apt-get install ros-kinetic-desktop-full

## Step 7: Initialize rosdep
sudo rosdep init
rosdep update

## Step 8: Setting up the ROS environment variables
echo source /opt/ros/kinetic/setup.bash >> ~/.bashrc
source ~/.bashrc

## Step 9: Create and initialize the catkin workspace
mkdir -p ~/catkin_workspace/src
cd catkin_workspace/src
catkin_init_workspace
cd ~/catkin_workspace/
catkin_make

## Step 10: Add the catkin_workspace to your ROS environment
source ~/catkin_workspace/devel/setup.bash
echo source ~/catkin_workspace/devel/setup.bash >> ~/.bashrc

## Step 11: Check the ROS environment variables
export | grep ROS

以上で準備は完了です。

テスト

確認用としてROSの基本パッケージの1つであるturtlesimを動かします。

roscoreと、turtlesim_nodeを別ターミナルで起動します

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

キーボードからturtleを操作できればOKです。

68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3334343838302f37373737323736372d363537622d343761382d303662362d3464346338636562613662312e706e67.png

備考

RaspberyPi 3B+ にUbuntu16.04LTSをインストールするには公式imgを更新する必要がある。
(RaspberyPi3だと公式imgをそのまま利用すればOK)
Raspberry Pi 3 B+ + Ubuntu MATE + ROSのセットアップ

色々ハマってしまい、本手順にたどり着くまで1週間ほど掛かりました。
(追記)RaspberryPi3B+ ではGAZEBOはスムーズに動かせませんでした..

参考

RaspberryPi 3B+にROSを導入する
Raspberry Pi 3 B+ + Ubuntu MATE + ROSのセットアップ
How To install ROS Kinetic on Raspberry Pi 3 (Ubuntu Mate)
Linux で tar.xz 形式のファイルを解凍する
macのコマンドでUSBメモリを初期化する。

Raspberry Pi 3にUbuntu MATE をインストール
ラズパイで作るROS搭載ロボット:Ubuntu mate + ROS Kineticのセットアップ手順
[ROS Projects] – ROS with Raspberry Pi 3 using Gazebo Face Simulation #Part1
ROSのインストールUbuntu16.04 +Kinetic (ラズパイ3風味)
ROS(Robot Operating System)によるRobotの操作

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