What is ROS?

You want to develop robotics applications, and have discovered ROS. But you’re confused… What is ROS?

ROS means Robot Operating System.

It’s quite hard to understand what is ROS from the beginning.

Is it an operating system? A framework? What should you do with it? When I first started a few years ago, it took me quite a long time to understand the concepts behind ROS.

In this post I’ll explain you the Why, the When, and the What.

This post is also the beginning of a series on ROS. At the end I’ll give you useful resources to understand what are the ROS core concepts and communication tools.

You are learning ROS?

Check out ROS For Beginners and learn ROS step by step.

>> I have also made a complete ROS crash course for beginners, check it out to start learning ROS Noetic from scratch:

After watching the video, subscribe to the Robotics Back-End Youtube channel so you don’t miss the next tutorials!

Why ROS?

One pretty common story in robotics development is this:

Someday, a student/engineer starts a new cool robotics project. She starts planning and working on the project. Soon, she discovers that it’s not that simple. Robotics is hard to learn, and it takes time to develop a good software for a robot. So, she starts to spend time working on how to communicate between all her programs, how she can implement a 3D simulation of the robot, etc.

The project comes to an end. No real progress was made, and the developer starts to loose faith. She has spent all her time trying to write a robotics framework, but worked only a little on the actual project. Soon the project is abandoned, or maybe she manages to finish something with some hacked code.

A few weeks later, another guy starts another new cool robotics project. He thinks: what if I find some framework I can directly use? He finds her code on the Internet, but the code seems really not reusable for his own application. So, he starts writing everything from scratch.

And so on, and so forth. Many people who are working in robot software development don’t actually develop robotics applications. They develop robotics framework that ends up being non reusable, not supported, not known, and quickly forgotten.

This situation often happens for people doing a PhD, with a 2-3 years time frame for the project.

This is one of the main factor slowing down robotics research and development, and ROS is trying to solve this problem.

Robot Operating System main goal

ROS allows you to stop reinventing the wheel. Reinventing the wheel is one of the main killers for new innovative applications.

Reinventing the wheel ROS

The ROS goal is to provide a standard for robotics software development, that you can use on any robot.

Whether you are programming a mobile robot, a robotic arm, a drone, a boat, a vending machine, well… You can use Robot Operating System.

And every time you start a new application, it becomes easier. You don’t have to re-learn how to use ROS. You can also easily switch to an existing ROS project developed by someone else and not be lost. The time has end when each new robotics application is developed from scratch, with a different code base every time.

This standard allows you to actually focus on the key features of your application, using an existing foundation, instead of trying to do everything yourself.

What is ROS?

First, what it is not:

Robot Operating System, despite its name, is not an operating system. Nor it is really a framework.

ROS is more of a middleware, something like a low-level “framework” based on an existing operating system. The main supported operating system for ROS is Ubuntu. You have to install ROS on your operating system in order to use it.

Robot Operating System is mainly composed of 2 things:

  • A core (middleware) with communication tools
  • A set of plug & play libraries

What is a middleware

Basically, a middleware is responsible for handling the communication between programs in a distributed system.

When developing a new software you can choose to: A. Develop one code base with everything compiling and running in one block, or B. Create sub programs, one for each sub task/functionality of your application.

Without any suspense, the second option is the best when developing a robotics software. You really need to be able to develop one part of your application (let’s say, a driver for a sensor), and run it without the whole application.

So, you’re now writing many small modules, and they need to communicate between each other. ROS core is here to help you do that.

ROS core and communication tools

With ROS, you will be able to easily separate your code base into packages containing small programs, called nodes.

How to make those programs communicate between each other?

Here, ROS comes with 3 main communication tools:

  • Topics. Those will be used mainly for sending data streams between nodes. Example: you’re monitoring the temperature of a motor on the robot. The node monitoring this motor will send a data stream with the temperature. Now, any other node can subscribe to this topic and get the data.
  • Services. They will allow you to create a simple synchronous client/server communication between nodes. Very useful for changing a setting on your robot, or ask for a specific action: enable freedrive mode, ask for specific data, etc.
  • Actions. A little bit more complex, they are in fact based on topics. They exist to provide you with an asynchronous client/server architecture, where the client can send a request that takes a long time (ex: asking to move the robot to a new location). The client can asynchronously monitor the state of the server, and cancel the request anytime.

To use those communication tools, you’ll simply have to use the appropriate libraries in your code, and define specific messages.

In your ROS environment you’ll also be able to create some global settings, named parameters, so multiple nodes can get access to the same set of settings from anywhere in the robotics application. And you’ll be able to launch your complete application with just one XML file, called a launch file.

ROS also includes a complete logging system, which is quite easy to use.

With all those features, you have everything you need to develop a distributed system. You’ll break your application into many packages, and each package will contain some independent nodes.

What is a ROS node ? 4/4

Once you’ve created your nodes, you’ll make them communicate with each other using topics, services and actions.

ROS language(s)

Robot Operating System is mainly developed using 2 languages: C++ and Python. Those are often the most preferred and used languages when developing robotics applications. You will use the roscpp library to write C++ code, and the rospy library to write Python code. There are also some libraries to make a bridge with other languages, such as rosjava for Java, and roslibjs or rosnodejs for JavaScript.

Now, to use ROS, which language(s) should you use? And if there are several languages, which ones are compatible with each other?

Well, you have to know that ROS is language agnostic. It means that the subprograms you write (nodes) can be written in any language. Your application can thus have a node written in Python communicating with a node written in C++.

Why is that? Simply because the communication layer is below the “language level”. As it is working as a middleware, ROS uses standard TCP/IP sockets to communicate between nodes.

ROs language agnostic

ROS libraries

ROS does not end with a set of core features and communication tools. It’s much more than that.

Actually, you can use a huge amount of existing ROS libraries directly in your code.

Those libraries will help you in many ways.

Imagine you’re developing a software for a mobile robot. When planning what to develop on this robot, you might list:

  • Driver for the motors
  • PID control loop
  • Motion planning
  • 3D visualization
  • Camera driver

The list can become pretty big if you want to add a lot of functionalities. And each item on the list will require a huge amount of time. How could you possibly develop a motion planning algorithm in a crowded environment with moving obstacles? How could you develop a 3D simulation tool while you are developing the hardware driver for your camera, with a short deadline?

Well, the problem is solved at 90% with Robot Operating System. For most of the common development blocks in robotics, you can find an open source ROS package. That’s the magic of open source software. When someone develops a nice package, he/she can publish it and share it with the community. And then, other people can use it and continue to improve it, all together creating a virtuous circle.

So, back to our libraries/packages:

  • Many motors and cameras have an existing ROS driver, or at least, something that you can use to avoid starting from scratch.
  • For your robot main control loop, use ros_control.
  • To represent a 3D model of your robot, simply describe it using XML with the URDF format.
  • For path and motion planning, use Moveit. Moveit will reuse your previously created URDF file.
  • To move a mobile robot, you can find a complete navigation stack.
  • For 3D visualization, use Rviz.
  • If you want a much more powerful simulation tool, with physical constraints, check out Gazebo – you can even make a drone fly with gravity and wind. If it flies on Gazebo, chances are great that it will fly for real.
  • You can also communicate between a ROS and a non-ROS environment thanks to the rosbridge package.

ROS communication tools and libraries

When using ROS, as soon as you try to develop a new package/feature, check out if someone did that before you and published the code on the Internet (mostly ROS packages can be found on GitHub). If this is the case, use this library – of course check the open source license to see what you can/can’t do – and if possible, help the library to become better!

The simulation tools provided by ROS are also super useful. One of the biggest time waster when developing robots is to always have to set up and run the physical robot to make a test. With simulation tools, you can develop your complete application (above the hardware driver level) directly on your computer.

The Robot Operating System community

In fact, ROS is not only a set of communication tools and useful libraries. It’s also a huge and growing community.

And this point is very, very important. When using a library, framework, middleware, well anything software-related, you want to check whether the community is active, and if the development is active or not.

With ROS, you can check all the validation boxes. ROS was first created in 2007 by a company named Willow Garage.

ROS is now currently actively developed by a lot of dedicated people all over the world. Also, many companies are sponsoring some open source development related to ROS.

Working with sponsors for big open source projects is very common, and it’s often a proof that there’s a market validation, because companies are willing to pay for it. That’s a great guarantee if you’re worrying about the project being abandoned in a few months/years from now.

There is a global ROS committee, Open Robotics, that maintains the vision and decides on the global path to follow for the core development. They often provide some information about what’s going on, and they get feedback from the global community to get ideas and see what’s important for ROS users.

Every year, the ROS committee organizes a world wide event, called ROSCON. Every year the country and city changes, so you can have a chance to participate in one of those some day. During ROSCON, new key features and development progress are explained. The videos of the talks are available online. Sometimes you can find really valuable information in those presentations.

The ROS community is also very active online:

  • ROS Wiki. This is where you’ll find most of the tutorials, concept explanations, and guides for different packages. It’s a really nice website, but sometimes not complete and lacking some guidelines, so you’ll have to find more information elsewhere.
  • ROS Answers. A Q&A website, so you can ask all your technical oriented questions. There is already a good amount of answered questions that you can check. Oftentimes if you can’t find something on the Wiki you’re likely to get it here.
  • ROS Discourse. This is a forum to talk about future developments, projects using ROS, and anything related to ROS. That’s a great resource to check from time to time, so you’re sure you don’t miss anything.
  • GitHub. Most of the ROS packages are available on GitHub. Here you’ll be able to browse the code and make some contributions.

When to use ROS?

Is ROS really suited for your application? Or is it an overkill solution?

It really depends on what you’re trying to achieve. For some applications, using ROS is clearly too much, especially if you don’t have any ROS knowledge.

Let’s start by talking about when not to use ROS. If your robot is very basic, ex: open a door with a human presence detector, move a 2 wheels robot along a line on the ground, then for those applications, a simple Arduino board might be largely enough.

But if you want to connect your robot with another robot, or a bigger system, or add many other sensors, ROS might makes more sense.

Here is when you’ll want to use ROS:

  • Your robot contains many different sensors and actuators. ROS will help you create a distributed system for all those components, instead of having one big monolith code base that will be hard to maintain and scale.
  • You’re learning robotics. ROS will allow you to quickly run a complete robot application and see the bigger picture. Once you’re confident with ROS, you’ll be able to quickly write code for many different robots.
  • You’re doing research in robotics. ROS is simply perfect for that. Usually, your research will be about a very particular point, where you should put all your focus. With ROS, as you already have all the code, communication tools, and libraries to build a robot software, you can indeed focus on your research topic instead of trying to reinvent the complete system.
  • You’re prototyping a robot. Prototyping often means that you want to get things done as quickly as possible. If you know ROS, well it might only take you a few days to create a complete prototype software for any mobile base or robotic arm. This will save you months of hard work.

What is ROS – Continue the series

There is much more to say about ROS, but I’ll wrap it up here.

ROS is one of the most – if not the most – maintained and developed robotics framework for robot programmers. As it is open source (most of the core packages are released under a BSD license), you can easily find the code and use it in your programs.

ROS goal is to create a standard for robotics software development. It involves:

  • A core base
  • Communication tools which are language-agnostic
  • Plug & play libraries
  • An active and growing community
  • And much more…

Learning ROS is maybe one of the best decisions you might take if you want to get serious about developing robot software.

Even if you don’t use ROS to actually develop final products or libraries, this will help you understand so many things about robotics. This will give you the opportunity to meet many passionate and very skilled robotics developers. And this will give you the foundation to start any robotics project very quickly.

In this post I gave you an overview of what is Robot Operating System. I didn’t expand the details on the core base and communication tools here. This is the next step you should take in order to learn more. And, good news for you! I’ve written a complete “What is ROS” series.

Read the “What is ROS” series by clicking on the following links (I recommend you read them in the order):

What is a ROS…

Did you find this tutorial useful?

Do you want to learn how to program with ROS?

If yes, this course is for you:

ROS For Beginners - A Step By Step Course

>> ROS For Beginners - A Step By Step Course <<