ROS is a Robot Operating System. ROS is an open source platform and a Meta- operating system that can be used for your robots and gives a flexible environment to work. ROS focuses on the reusability of the code and makes different sections which can communicate in between themselves to simplify the process and it gives a well-defined system which can be accessed from multiple systems. ROS framework can be easily implemented with any modern programming languages like C++, lisp, python etc
WHY ROS IS REQUIRED:
We usually don’t work with2-3 programs simultaneously. And even if we are coding for our system consisting of different sections like sensor circuitry, motor driver circuitry etc, concurrency, inter- communication and extensibility, these are the things that we don’t usually do. You will find it difficult to use raw APIs (Application Program Interface, they are protocols, routines and tools for creating software applications) which are used in programming for GUI(Graphical User Interface). But ROS makes all this simple
Without changing the complete grammar and vocabulary of the programming, we can build our system based on the basic platform available that is why ROS is called as a meta operating system(meta operating system is a OS that is built on a main OS and allows different processes to communicate with each other at runtime) in case of ROS it is based on Ubuntu-Linux.
ROS provides following features:
- Abstraction of Hardware
- Device control at low level
- Implementing generally used functionality
- Exchange of messages between different processes
- Managing packages
- Tools and libraries are available for obtaining, creating, writing and running codes using multiple computer systems or androids etc.
- Peer to peer topology (in which both the sections or programs included can be client or server having same importance).
ROS has few important terminologies as follows:
Nodes are the processes that perform computation just like our normal programs or codes. And they communicate among themselves under the frame of action of ROS. These nodes are registered and work under the guidance of a ROS master(only one ROS master can run at a time). We can have several nodes for performing different tasks like taking sensor’s data, driving the motors, locating itself in the surrounding with the camera, processing the pictures, mapping the surrounding, processing the overall data etc.
Nodes communicate with each other over a topic. Consider nodes as senders and receivers of mails then topic becomes the post office where the mails are dumped and the nodes who need these mails can receive from there. When the nodes are working independently and giving the output of their processes, they need to communicate for sending the result for further processing, so for this purpose ROS uses topics. A node can publish the data to the topic or subscribe the topic for receiving the data given by other nodes.
A node can subscribe to any number of topics. This is how the communication is established
Communication as messaging:
The mails that we are referring to are nothing but the messages. Communication becomes easier when same kinds of messages are sent to a specific message topic so that ROS can convert these messages i. e. datastructures into bytes streams at the sender’s end and can transmit to recipient’s end. Again it is converting the bytes back to the messages of the same datastructures. So it’s like every node has its own message topic or just a topic where it is dumping all its data.
Publisher and subscriber:
To get some data the node has to ask the other node for the data i.e. subscribing. The node must have an instance of object that is called a ROS subscriber. When any node outputs its data to a topic, it needs to have one more object i.e. ROS Publisher. Publisher publishes the data over the ROS topic and subscriber subscribes to the topic for getting the data.
Sending and receiving the messages is a continuous phenomenon. ROS provides with one more facility of contacting the nodes in the network known as services. Services allow the node to send the request and receive the response. Note that the request is send to that message topic to which the other node is publishing. With ROS services, calling the function in another node is as easy as calling a local function. Services communicate with a name and we have several commands those can be used on topics as follows
Following image shows the overall processing going on
Let’s consider one example if you have camera fixed on your robot and you want to see all the images on your laptop as well as on the laptop attached with the robot then the overall process happening is depicted in the image below
In the following image you can see the application of services in ROS
ROS is organized in different packages which contain codes, build files, launch files, manifests, services, a ROS-independent library, a dataset, configuration files etc. The purpose of the packages is to make the ROS functionality in easy to consume way
Some similar kinds of packages are bound together known as stacks. A collection of packages for distribution.
Note:For installation of latest version of ROS and detail information for starting with ROS refer to ROS’s official website.