ROS Installation


After understanding the ROS archictecture as well aso the functionality of ROS, let us proceed to setup the development environment of ROS: Like I mentioned in my previous post before, ROS works only with the Linux environment and it depends also the Linux distro that we are using. Simply to say, specific ROS version needs some specific Linux operation system to work. Currently there are two distros that have been used worlwide the most, ROS kinetic with Ubuntu 16.04, Ubuntu 15.10, and Debian 8 as also ROS melodic with Ubuntu 18.04. I personally would prefer to use the ROS melodic due to its actuality, since the newer ROS version could still bridge the older version of ROS packages.But it should be kept in mind also that not all packages in older versions would work here. Some could possibly be depricated. In this tutorial I will use ROS melodic as my reference.

Different Version of ROS

ROS Installation

The first step to install ROS in your system is to setup the Ubuntu 18.04. It could be installed through this link. The first step you need to do is to download the desktop image data and make a usb booter or dvd booter by using software like balenaEtcher. Remember to select the version either it is the 32 Bit or the 64 Bit depending on your computer specification. Since ROS does also have a physical engine simulation in its prebuilt, please do not underestimate tha computer specification. After settle the operation system, the we could proceed with the installation.

 

Installation

Setup the sources.list

To be able to receive and update the ROS packages from ros.org. We should give command such command to our Linux terminal (ctrl+alt+t) :

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Setup your keys

Maybe we have question what is actually the keys here? For some people who have been using git system, they would probably already know what is key. The idea behind key is that we would make sure that the ROS packages that we download really do come from the ros server. Therefore we need to set the private key to be able to sign the packages for our ROS distribution.

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

ROS Installation

After setup the sources.list as well as the keys, now we should be able to install ROS in our system. First we need to update the Debian package in our system with :

sudo apt update

After the debian packages are updated. We could install ROS using :

sudo apt install ros-melodic-desktop-full

Environment Setup

To make sure that the ROS environment variables are automatically added to your bash session every time a new shell is launched, we could run:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Dependencies for Building Packages

We have already done with the installation of the ROS packages. To create and manage your own ROS workspaces, there are various tools and requirements that are distributed separately. For example, rosinstall is a frequently used command-line tool that enables you to easily download many source trees for ROS packages with one command.

To install this tool and other dependencies for building ROS packages, run:

sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

Before we can use many ROS tools, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. To do the initialization:

sudo rosdep init
rosdep update

After finishing the installation of our ROS system, we could now proceed with the installation of ROS environment. This environment is necessary to maintain or to develop the ROS packages. The official build system of ROS called catkin. catkin combines CMake macros and Python scripts to provide some functionality on top of CMake’s normal workflow. catkin‘s workflow is very similar to CMake‘s but adds support for automatic ‘find package’ infrastructure and building multiple, dependent projects at the same time.

So, now let’s create a catkin workspace. The place where you put your catkin workspace does not matter. In the end , you just only need to initialize the catkin directory. Open the terminal in your workspace and give this command :

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make

Before proceeding to develop the ROS packages, we need to source our new setup using this command:

source devel/setup.bash

Another alternative is to put this line in your ~/.bashrc using:

sudo gedit ~/.bashrc

And put the setup.bash command line in the last line of the .bashrc, and save it.

What’s Next?

Like I mentioned in the previous post, before that I will make a post related to the ROS installation and the tutorial to write a simple publisher and subsriber for the ROS topic. Luckily I have finished the first issue by this post. But the ROS topic is still too long to be posted here. So, I will separate it and write a post about ROS topic in details for the next post.


Leave a Reply

Your email address will not be published. Required fields are marked *