Make sure you have dirmngr installed (it’s necessary for downloading public keys from the HKP server)
$ sudo apt install dirmngr
Add ROS repositories and download GPG keys
$ 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
Update package list
$ sudo apt update
Install prerequisites
$ sudo apt install python-rosdep python-rosinstall-generator python-wstool python-rosinstall python-catkin-tools python-psutil build-essential cmake
Initialize rosdep and update its package list
$ sudo rosdep init
$ rosdep update
Create a directory to store our catkin workspace
$ mkdir -p ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
Use rosinstall_generator tool for creating a rosinstall file. This file will contain a list of ROS packages alongside their sources
$ rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
ros_comm contains basic ROS communication tools. The above command will include this package and all its recursive dependencies
Download packages to source directory using wstool
$ wstool init src kinetic-ros_comm-wet.rosinstall
Install system dependencies of downloaded packages with the rosdep tool
$ rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch
Initialize and configure catkin workspace
$ catkin init
$ catkin config --install -i /opt/ros/kinetic -j 2
Configuration shown above says that the workspace is going to be installed to the /opt/ros/kinetic directory and that up to 2 parallel jobs can be running
NOTE: In this tutorial we use catkin commands from catkin-tools. If you want instead to use the catkin_make command, you can follow this tutorial:
http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi#Building_the_catkin_Workspace
Build and install the workspace
$ sudo catkin build
CAUTION: Raspberry Pi has limited resources and TurtleOS doesn’t have a swap partition. This fact can lead to the device becoming unresponsive over time, because of a memory exhaustion. If this results in the compilation being terminated, you can try limiting the jobs running based on the memory usage
$ sudo catkin build --mem-limit 50%
The next job won’t be started as long as the memory usage is above 50%
Also remember to have a decent power supply (a 5V/2.5A charger would do fine)
That’s it! Our workspace is installed in the /opt/ros/kinetic directory. If you want to access all the installed tools and packages, use this command:
$ source /opt/ros/kinetic/setup.bash
If you want the command to be executed at every start of the terminal session, simply add it to the .bashrc file
$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc