I am sure many of you have some experience on robotic systems, maybe as academic projects or even as hobby electronic projects. As beginners, we usually start with an Arduino board or a microcontroller of a similar kind. However, when you advance your skills on robotics, it will be valuable for you to have an understanding about ROS which is widely used in the field of robotics.
As per the current academic curriculum, you will get a brief understanding on ROS in your final year. However, I had the opportunity to work on a hexapod project using ROS during my internship. Since I had no prior knowledge on ROS, I learned ROS by myself and trust me guys, it is not as hard as you think. Hopefully this article will help you to take your first step in ROS. Let’s go!
What is a Robotic System?
A robot is a system that can perceive its environment (surrounding) with the use of sensors, taking decisions based on the readings from the sensors, computations and algorithms as well as executing the decisions using actuators. However unfortunately, these sensors and actuators are not ideal. Hope many of you have already encountered such occasions. This introduce randomness to the system which makes working with real life robots extremely difficult. Add seemingly unpredictable movements of animals and humans (agents) to the environment too. Now you have a tough problem at your hands.
How do we solve these problems or let alone start to solve them? We need some system that can act as a bridge between our sensors and actuators. This something is a decision process or a set of steps that the system must follow to achieve the desired outcome. These steps are called algorithms and can be considered as the mind of the robot. This is where ROS comes to play!!!
According to the original ROS paper,
“To meet these challenges, many robotics researchers, including ourselves, have previously created a wide variety of frameworks to manage complexity and facilitate rapid prototyping of software for experiments, resulting in the many robotic software systems currently used in academia and industry. Each of these frameworks was designed for a particular purpose, perhaps in response to perceived weaknesses of other available frameworks, or to place emphasis on aspects which were seen as most important in the design process.”
What is ROS?
Although ROS stands for Robot Operating System, ROS is not an operating system. ROS is a meta operating system which assumes there is an underlying operating system (Linux) to carry out its tasks.
The intention of ROS is to create a robotics standard, so you don’t need to reinvent the wheel anymore when building a new robotic software. So, we already know how to build robots without ROS. Why do we need to use ROS? Let’s find out.
- ROS is general
The same code base can be used to build different kind of robots: robotic arms, legged robots, drones etc… Only thing you need to know is how to communicate between nodes and if you need to build a completely different robot than the previous one, you won’t be lost.
- ROS has packages for everything
Sometimes you may have faced problems due to lack of libraries and resources when you are going to build a robot. However, in ROS there are many packages that are waiting to help you in whichever project you choose. You need to compute a trajectory for your robot? There is a package for that. Want to use your joystick to control the robot? There is a package for that as well. Or else do you want to map out a room with a drone? There are many packages to support you too. Therefore, you don’t have to worry at all.
- ROS is language agnostic
You can easily communicate between nodes written in both Python and C++ in ROS. You can also get a WebSocket server running on your robot (rosbridge_suite) or an HTTP server, thus use any language to communicate with it.
- ROS has great simulation tools
We cannot run our robot in the real world at once and see what will collapse. Therefore, it is always good to run a simulation first. For that purpose, ROS provides some amazing simulators like Gazebo, Rviz, CARLA etc… With Gazebo you can even add some physical constraints to the environment, so when you run the simulation and the real robot, the outcome is pretty much the same. Imagine mapping a room in 3D with a drone directly on your computer, that could save you a huge amount of time.
- You can control multiple robots with ROS
ROS can work with multiple ROS masters running on different robot systems simultaneously which means ROS can communicate between multiple independent robots built using ROS.
- ROS is light and available open source
ROS won’t take a huge space on your machine and ROS can be installed even in a Raspberry Pi 3 board so you can work with low resources. One of the biggest advantages of ROS is that it is available open source. Most of the core packages are released under a BSD license. A BSD license allows you to modify and use the code for commercial purposes, without having to release your code with an open source license.
Therefore, I think these reasons are more than enough for an undergraduate to try out ROS. Believe me it is worth moving to ROS.
Getting Started with ROS
To start this journey, you have to have a Linux based operating system (preferably Ubuntu). Don’t worry this link will teach you step by step how to dual boot your PC: - https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/
Select the ROS distribution that supports your Linux version. (e.g.: - Kinetic for Ubuntu 15.10 and 16.04, Lunar for Ubuntu 16.10 and 17.04, Melodic for Ubuntu 18.04 etc…) The latest distribution is the one that is actively developed. (or at least supported -> LTS distro) For more information visit: - http://wiki.ros.org/Distributions
Install your preferred ROS distro. Installing ROS is pretty straight forward. Step by step guide can be found on ROS Wiki: - http://wiki.ros.org/ROS/Installation Follow the instructions and you will be fine.
Now we have successfully installed ROS. What should we do with it? I don’t know anything about ROS. Calm down! Here are some resources for you to begin your journey in ROS.
ROS Wiki - http://wiki.ros.org/ROS/Tutorials
eBooks - Effective Robotics Programming with ROS 3rd Edition, Mastering ROS for Robotics Programming, Programming Robots with ROS A Practical Introduction to the Robot Operating System
Online courses on edX - https://www.edx.org/course/hello-real-world-with-ros-robot-operating-system (Found this course to be very useful and it teaches ROS from the very beginning to more advanced topics)
Online course on Udemy - https://www.udemy.com/course/ros-for-beginners/
Set of online tutorials - https://www.theconstructsim.com/ (This excellent series of tutorials will help you to learn and get hands on experience ROS without using an Ubuntu device)
What can we do with ROS?
Let me give you a brief summary on a ROS project that I have worked on during my internship at CSIRO, Australia. CSIRO has several six-legged robot platforms as the ones shown below. All of these hexapods use the same high-level controller package written in ROS. That is the beauty of ROS. You can easily build up packages and use them in many other similar kinds of projects while changing the parameters accordingly.
As you can see these robots come with different sensors and actuators like dynamixel servo motors, Lidars, Cameras, IMU sensors and so on. However, ROS provides the interoperability among these different devices by bringing them in to a common platform.
Troubleshooting becomes very easy with the built-in tools in ROS like RQT plot, RQT graph and ROS Bag. I was able to fully implement this high-level controller on a Raspberry Pi 3 board to control a basic hexapod which emphasizes the fact that ROS works very well in constrained environments too. All of these hexapods can be simulated in the Gazebo and Rviz simulation environments as well.
You will get to know that building and implementing a robot system in ROS is very simple. All you need is to create a workspace including all the required ROS packages and compile it. These ROS packages can be written in either Python or C++. The entire robotic system gets simplified into a set of ROS nodes which are designed for certain purposes and a set of ROS topics which keep the communication between these nodes. You can create ROS launch files to launch all the required nodes at once. ROS parameter server can be used to pass parameters using YAML files. There is a vast community who uses ROS for different purposes from which you can get many valuable insights.
Begin your ROS journey today. Throughout this amazing journey with ROS you might encounter with certain issues. Let us know if you face any problems or you need any clarifications regarding ROS.
Good luck. Cheers!!!
(written by Oshada Jayasinghe and Sakuna Harinda)