The first part of this article is an overview of the ROS midleware, in th esecond part, we’ll go more in depth in the new ROS version: ROS2.
Keep in mind that ROS2 is currently on heavy development, some packages have already been released but most of them are not ready to use. Besides, some ROS2 features are still not available.
But you should certainly keep an eye and even try ROS2 before you get too much late.
A ROS overview
The Robot Operating System (ROS) is a set of software libraries and tools that has been created to help developers build robot applications. From drivers to state-of-the-art algorithms, and with powerful developer tools, ROS is a necessary set of tools for any robotics project. And it’s all open source.
For more detailed information, you can read our previous article about ROS. It will give you some insights about what is ROS, its communication protocols and available tools to optimize your developments.
First, Ubuntu needs to be installed on your system. Be aware that based on your ubuntu release, the ROS/ROS2 distribution will change:
|Ubuntu release||ROS Distribution||ROS2 Distribution|
|Ubuntu 16.04 – Xenial||Kinetic||Bouncy & Crystal|
|Ubuntu 18.04 – Bionic||Melodic||Crystal & Dashing|
|Ubuntu 19.04 – Disco||X||X|
In the different links above, you will find other tutorials to get ROS installed.
In case you would like to try previous or new releases you can use Docker images .
Docker makes easier to create, deploy, and run applications by using containers. Containers allow to package up an application with libraries and other dependencies.
In a way, Docker is a bit like a virtual machine. But rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they’re running on. A Docker container runs a Docker image, which is a file, composed of multiple layers of libraries and dependencies.
If you want to test ROS2 without risking your ROS environment by installing some programs, we recommend that you work on ROS2 Docker images.
Once your computer is running under Ubuntu and ROS/ROS2 is ready to be used, look on ROS tutorials to understand how it works.
ROS history to explain ROS2
ROS environment was developed by Willow Garage for the PR2 robot by Willow Garage. PR2 is a humanoid robot that can navigate autonomously in a known environment.
At this time, they knew that PR2 would not be the only robot on the market and instead of developing a personalized program working only for PR2, they wanted to implement a scalable and standard software to improve or modify the robot in the future. So, they worked on a middleware, ROS, by defining levels of abstraction to be useful on other robots.
They were guided by the PR2 characteristics:
- A single robot
- No real-time requirements
- Excellent network connectivity
- Cross-platform (which works just as well on mobile bases as on humanoids for example)
Today we see ROS used not only on PR2 and similar robots, but also on wheeled robots of all sizes, legged humanoids, industrial arms, outdoor ground vehicles and aerial vehicles.
At the same time, ROS is adopted in multiple domains, beyond the academic research community that was their initial focus.
More and more, ROS-based manufactured robots are available on the market and government agencies are investing in ROS for their own fielded systems.
With all these new uses, ROS is being pushed to its limits (see the PR2 characteristics above). While it is holding up well, the community believe that they can develop a better platform based on new robots requirements:
- Teams of multiple robots
- Small embedded platforms
- Real-time systems
- Non-ideal networks
- Production environments
Another reason to implement ROS2 is to take advantage of the opportunity to improve user-facing APIs. Some new APIs will be designed, incorporating the best of community experience with the first-generation APIs.
Why not just enhance ROS?
As a rule, the changes described above could be integrated into the existing ROS core code. This option considered and given the intrusive nature of the changes, there is too much risk associated with changing the current ROS system that is relied upon by so many people. ROS should remind the same as today. So ROS2 will be built as a parallel set of packages that can be installed alongside and interoperate with ROS.
Who should switch to ROS2 right now (2019)?
|Students||You should keep on working with ROS for now due to the lack of compatible packages and software stability. ROS2 will be ready to mass adoption in the near future.
You are not losing your time since many of the concepts in ROS and ROS2 are the same.
|Professors||You should keep teaching ROS for now. But do not forget to start looking for ROS2, even try some new tutorials to be ready when ROS2 will be the standard.
Investing on TurtleBot3 can be a good compromise since it is ROS and ROS2 compatible.
|Researchers||Unless your paper concern ROS2 performance or features you should stick with ROS for now.|
|Companies||You should really consider ROS2 to reduce the amount of code transfer in the future. Put people with experience with ROS on the project.|
|Manufacturers||Now is a good time to switch. ROS2 Dashing is the first LTS release so it’s now safe to start porting drivers without fear of new features that will break functionality.|
Some key features differences between ROS and ROS2
|Platforms||Tested on Ubuntu
Maintained on other Linux flavors as well as OS X
|ROS2 is currently being CI tested and supported on Ubuntu Xenial, OS X El Capitan as well as Windows 10|
|C++||C++03 // don’t useC++11 features in its API||Mainly uses C++11
Start and plan to use C++14 & C++17
|Python||Target Python 2||>= Python 3.5|
|Middleware||Custom serialization format (transport protocol + central discovery mechanism)||Currently all implementations of this interface are based on the DDS standard.|
|Unify duration and time types||The duration and time types are defined in the client libraries, they are in C++ and Python||In ROS2 these types are defined as messages and therefore are consistent across languages.|
|Components with life cycle||In ROS every node usually has its own main function.||The life cycle can be used by tools like roslaunch to start a system composed of many components in a deterministic way.|
|Threading model||In ROS the developer can only choose between single-threaded execution or multi-threaded execution.||In ROS2 more granular execution models are available and custom executors can be implemented easily.|
|Multiple nodes||In ROS it is not possible to create more than one node in a process.||In ROS2 it is possible to create multiple nodes in a process.|
|roslaunch||In ROS roslaunch files are defined in XML with very limited capabilities.||In ROS2 launch files are written in Python which enables to use more complex logic like conditionals etc.|
Which DDS for ROS2
ROS2 uses a DDS (Data Distribution Service) for publishing and subscribing instead of a custom message handler. The main advantage is transmission performances will be improved following the DDS updates. Besides, you will be free to choose the DDS matching to your specifications.
Indeed, the DDS you choose can greatly affect how ROS2 behaves. Right now, some DDS have working issues on some applications. In the future, each DDS will have its advantages and limits depending on the situation.
- Here are some DDS entities :
- FastRTPS / eProsima
- Vortex OpenSplice / ADLINK Technology
- Connext / RTI
- CoreDX / Twin Oaks
- Cyclone DDS / Eclipse
If you are looking for information about DDS, you should take a look on Rover Robotics article in the resources section at the bottom of the page.
One of ROS2 main features is life cycle management for nodes. This feature allows greater control over the state of ROS system. Indeed, it will allow roslaunch to ensure that all components have been instantiated correctly before it allows any component to begin executing its behaviour. It will also allow nodes to be restarted or replaced on-line.
This a core feature for the robot’s safety.
Implementing ROS2 – Plateform/Tutorials
Every robot and component compatible with ROS will be compatible with ROS2 once drivers, packages and SDK are available for ROS2 implementations.
One of the first companies to dive into ROS2 is Robotis. In the past, they had already developed some excellent tutorials for learning ROS with the first Turtlebot robot.
- TurtleBot 3 – Installation
- TurtleBot 3 – GitHub Robotis developed their own package for the TurtleBot3. On their GitHub, they have linked the wiki pages and the open source codes.
Following this tutorial will guide you through ROS2 discovery. It is a good platform with a well-thought tutorial to take a first look at ROS2.If you still have a TurtleBot2 at your disposal, you can use ROS2 as well. Indeed, Robotis released a ROS2 TurtleBot2 demo tutorial.
Investing in turtlebot3 is a good choice due to its compatibility with ROS and ROS2.
Instructions to migrate from ROS to ROS2
There are two different kinds of package migrations:
- Migrating the source code of an existing package from ROS to ROS2 with the intent that a significant part of the source code will stay the same or at least similar.
- Implementing the same or similar functionality of a ROS package for ROS2 but with the assumption that the source code will be significantly different.
Concerning the first type, right now, not a lot of documentation are available but they might be in the future. Please take a look at this ROS to ROS2 migration guide, which is focusing on the second type and describes the high-level steps to migrate a ROS package to ROS2.
Though, it does not aim to be a step-by-step migration instruction and is rather destined to experienced users.
Resources for ROS2
Official resources for ROS2
- Main page
- Features Status
- ROS2 GitHub
- ROS2 Benchmarking
- ROS2 test performances
- ROS on DDS
Tutorials for ROS2
Rover Robotics worked on ROS2, they posted on their blog a tutorial about their last implementations to get the navigation work on ROS2.
In this article, you can find lots of useful information about last bugs in ROS2, which DDS is better, how to launch their demo and other implementation advice.
About tutorials, you should take a look at “The Construct” website , they are releasing some articles about the ROS2 configuration.