In the previous article, we prepared the environment to install ROS by creating an Ubuntu virtual machine.
Today we are going to take a step forward, and we install the framework trying to launch it for the first time so that we can start getting familiar with it.
Let’s Install ROS!
Let’s start by launching our virtual machine, open a terminal and run the following command:
This way we modify the source.list file, updating its reference repositories, which we will then use to download the ROS installation packages.
We then proceed to install the necessary key by running the following command:
Now, let’s launch an update command from our apt package installation manager:
Once the update is complete, we proceed to install the full version of ROS:
The process will take you some time.
When the installation is finished run the following command to search for any other available packages:
Let’s continue by configuring rosdep, a package manager that will allow you to easily and directly install all the dependencies needed to correctly run ROS:
At this point the installation is complete. Before being able to use ROS, however, we need to initialize our development environment so that we always have it ready for our tests.
To do this, run the following commands:
In this way, whenever you open a new terminal, the change made to .bashrc with the previous commands will automatically add the ROS environment variables to your bash session.
Before proceeding further, remember that in case you need to install any other package for ROS the commands to be launched are as follows:
The command obviously requires that the version_name and packet_name values be replaced with the correct values.
For example in our case, version_name will be replaced with melodic.
In case you had any kind of problem with the installation process, refer to the official ROS guide for installation on Ubuntu at the following link.
Let’s Excute ROS!
Once the installation is complete, we just have to launch a master ROS node for the first time.
Open a terminal and run the following command:
The result you should get is the following:
ROS master is the main heart of each application: it represents the reference point for all the nodes that will make up your application.
Remember that it is possible to run only one ROS master at a time and it is mandatory to always launch it before any other node, under penalty of not being able to run your own project.
Well, in this article we have completed the installation of ROS and the development environment necessary to be able to use it profitably.
In the next article we will see a first example of a program written in ROS so as to begin to become familiar with the main tools offered.