Part 1: Getting Started with ROS — Overview, Installation and ROS Computational Graph Model

Arsalan Anwar
Analytics Vidhya
Published in
5 min readFeb 4, 2021

Overview

Robot Operating System (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms.

ROS was officially created and developed by Willow Garage starting from 2007.

ROS is currently maintained by Open Source Robotics Foundation

Robot Operating System abbr. ROS

In the further sections, we’ll discuss the following:

  1. Advantages of ROS
  2. ROS Installation
  3. ROS Computational Graph Model

Advantages of ROS

1. ROS acts as Meta OS:

  • A typical OS performs Scheduling i.e. the role of allocating resources like CPU, memory, disk space, I/O devices to the various programs as and when required and Hardware Abstraction i.e. the OS provides the software an easy way of accessing the hardware resources without knowing the inner details of the hardware.
  • ROS is not a traditional OS in the aspect of scheduling and hardware abstraction. However, it uses the host OS (Ex: Ubuntu) and facilitates communications between the processes. It is a collection of software frameworks for robot software development and it provides services designed for a heterogeneous computer cluster such as hardware abstraction, low-level device control, implementation of commonly used functionality, message-passing between processes, and package management.
ROS Meta OS (Courtesy: Surya Prakash via Udemy)

2. Code Reuse and Language Independence

ROS facilitates code reuse and supports various languages like Python, C++, Lisp, Java and other languages unofficially.

3. Open Source

ROS is a truly robust, general-purpose Open Source middleware suite which is free to use and anyone can contribute to its development. It was built from the ground up to encourage collaborative robotics software development

ROS Installation

Pre-requisites: Ubuntu OS

Note: If you don’t have an Ubuntu OS, you can install any virtual box like Oracle or VM Ware and then install ROS. Click here to download Oracle Virtual Box

ROS Installation: There are various distros (versions) of ROS available depending on your Ubuntu OS version.

For example: ROS Kinetic distro can be run on Ubuntu 16.04, ROS Melodic can be run on Ubuntu 18.04 and ROS Noetic can be run on Ubuntu 20.04.

So download the ROS distro depending on your Ubuntu OS version from this link.

Since I have Ubuntu 18.04, I have downloaded ROS Melodic by following the steps from this link. You can follow the steps by going to the respective ROS distro’s link.

One of the most important things to understand before we move on to the actual implementation and coding Robotic software is the ROS Computational Graph and understand its various components which we will be using extensively.

ROS Computational Graph Model

ROS Computational Graph is the peer-to-peer network of ROS processes that are processing data together. The basic Computational Graph components of ROS are Nodes, Master, Parameter Server, Messages, Services, Topics, and Bags, all of which provide data to the Graph in different ways.

ROS Computational Graph
  • Nodes: Nodes are processes that perform some computation. A robot control system usually comprises of many nodes each performing a single task. For example: one node controls a laser range-finder, one node controls the wheel motors, one node performs localization, one node performs path planning and so on. A ROS node is written with the use of a ROS client library, such as roscpp or rospy.
  • Master: The ROS Master is a server that tracks IP addresses of all nodes. It provides name registration and lookup to the rest of the Computation Graph. Without the Master, nodes would not be able to find each other, exchange messages, or invoke services.
  • Parameter Server: The Parameter Server allows data to be stored by key in a central location. It is currently part of the Master. It is basically a warehouse of constants.
  • Messages: Nodes communicate with each other by passing messages. A message is simply a data structure, comprising typed fields. Standard primitive types (integer, floating point, boolean, etc.) and arrays of primitive types are supported. Messages can include arbitrarily nested structures and arrays (much like C structs).
  • Topics: Messages are routed via a transport system with publish / subscribe semantics. A node sends out a message by publishing it to a given topic. The topic is a name that is used to identify the content of the message. A node that is interested in a certain kind of data will subscribe to the appropriate topic. There may be multiple concurrent publishers and subscribers for a single topic, and a single node may publish and/or subscribe to multiple topics. In general, publishers and subscribers are not aware of each others’ existence. The idea is to decouple the production of information from its consumption. Logically, one can think of a topic as a strongly typed message bus. Each bus has a name, and anyone can connect to the bus to send or receive messages as long as they are the right type.
  • Services: The publish/subscribe model is a very flexible communication paradigm, but in case of many-to-many communication, one-way transport is not appropriate for request/reply interactions, which are often required in a distributed bidirectional system. Hence, request/reply is done via services, which are defined by a pair of message structures: one for the request and one for the reply. A providing node offers a service under a name and a client uses the service by sending the request message and awaiting the reply. ROS client libraries generally present this interaction to the programmer as if it were a remote procedure call.
  • Bags: Bags are a format for saving and playing back ROS message data. Bags are an important mechanism for storing data, such as sensor data, that can be difficult to collect but is necessary for developing and testing algorithms.

Now that we have seen the different components of the ROS Computational Graph, lets see a ROS Computational Graph of two nodes communicating with each other.

ROS Computational Graph of 2 nodes communicating with each other

Summary

Through this article, we have covered the following:

  • Brief Overview of ROS
  • Advantages of ROS
  • ROS Installation Process
  • ROS Computational Graph

Feedback/Suggestions:

For any feedback or suggestions, please comment below or drop a mail at arsalan.anwar.7777@gmail.com or contact me via LinkedIn at www.linkedin.com/in/arsalananwar1998

--

--

Arsalan Anwar
Analytics Vidhya

Data Scientist | Researcher at New York University | AI & ML | LLM