Comment on page

Install ROS on Turtle Rover

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

Prepare your Turtle Rover for ROS installation

First, connect your device to Turtle Rover's console via SSH
Next step is to establish Internet connection

Prepare ROS installation tools

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

Installing ROS packages

To install ROS on TurtleOS you can either compile package from source or download one of our precompiled workspaces.

A. Use our precompiled workspace

We have precompiled ROS workspaces to make installation process easier. You can find them together with lists of packages they contain here.
Download selected one to your host machine and upload it to your Rover:
Or download it directly to your Rover using wget. E.g.:
Create a directory for ROS kinetic workspace and extract the archive to that directory:
sudo mkdir -p /opt/ros/kinetic
sudo tar -xf 2019-07-10-ROS.tar -C /opt/ros/kinetic
Use rosdep to install system dependencies
rosdep install --from-paths /opt/ros/kinetic/share --rosdistro kinetic -i -r -y

B. Compile ROS package sources

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 command above 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 using the rosdep tool
rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r
Initialize and configure catkin workspace
catkin init
catkin config --install -i /opt/ros/kinetic -j 2
The configuration shown above says that the workspace is going to be installed in 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 to use the catkin_make command instead, you can follow this tutorial
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 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 decent power supply (a 5V/2.5A charger would do fine)
That’s it! Our workspace is installed in the /opt/ros/kinetic directory.

Testing ROS Master Node

To access all the installed tools and packages you need to "source" the workspace. To do this, use this command:
source /opt/ros/kinetic/setup.bash
If you want the command to be executed at the start of every terminal session, simply add it to the .bashrc file
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
Now, to run Master Node, type:
On another terminal, "source" the workspace and then type:
rostopic list
You should see /rosout and /rosout_agg topics listed.

Adding or Updating packages

Let's say you want to add joy package. So first, you need to create a new rosinstall file
rosinstall_generator joy --rosdistro kinetic --deps --wet-only --tar > joy.rosinstall
Next, merge it with our workspace and update package sources
wstool merge joy.rosinstall -t src
wstool update -t src
Don't forget to install system dependencies via rosdep
rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r
Rebuild our workspace
sudo catkin build