Install ROS on Turtle Rover

Last updated 21 days ago

Here is a quick tutorial how to install ROS on your Turtle Rover

Prepare your Turtle Rover to ROS installation

First connect your device to Turtle Rover's console via SSH

Next step is to establish Internet connection

ROS installation

Update package list

$ sudo apt update

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 $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

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: ROS Kinetic on the Raspberry Pi#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