-
Notifications
You must be signed in to change notification settings - Fork 0
ROS on Raspberry Pi
To check what Raspbian release is installed:
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"The guide assumes that Stretch is the Raspbian release used and Kinetic is the ROS distro to be installed.
$ 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
$ sudo rosdep init
$ rosdep updateIf the full ROS distribution is wanted, install rosinstall_generator desktop, otherwise choose rosinstall_generator ros_comm (recommended option for Raspberry Pi). ROS comm only installs the essential packages and communication libraries, avoiding GUI tools that consume a lot of space.
$ 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.rosinstallSome dependencies must be built from source.
$ mkdir -p ~/ros_catkin_ws/external_src
$ cd ~/ros_catkin_ws/external_src
$ wget http://sourceforge.net/projects/assimp/files/assimp-3.1/assimp-3.1.1_no_test_models.zip/download -O assimp-3.1.1_no_test_models.zip
$ unzip assimp-3.1.1_no_test_models.zip
$ cd assimp-3.1.1
$ cmake .
$ make
$ sudo make install
$ cd ~/ros_catkin_ws
$ rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretchAdd swap space to the RPi to increase RAM space and avoid internal compilation error.
$ vim /etc/dphys-swapfile
# Edit the following lines:
CONF_SWAPSIZE=1024
# Uncomment the following line:
CONF_SWAPFILE=/var/swapThen proceed to build the catkin workspace:
$ cd ~/ros_catkin_ws/
$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2
# After installation, append the source command to the bashrc file:
$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrcAfter the installation, remove the swap memory by changing /etc/dphys-swapfile back to its original form:
$ vim /etc/dphys-swapfile
# Edit the following line:
CONF_SWAPSIZE=100
# Comment the following line:
# CONF_SWAPFILE=/var/swap$ sudo apt-get install libncurses5-dev libncursesw5-devRaspbian distros already come with wiringPi installed. If not, just:
$ sudo apt-get install wiringpiPython libraries required are Flask (for the web app) and getch (to handle keyboard inputs).
$ sudo python -m pip install --upgrade pip
$ pip install py-getch
$ pip install Flask$ sudo apt-get install gnome-terminal