Where is roscore in ROS2?

[ROS2 in 5 mins] 003 - Where is roscore in ROS2?

Written by Bayode Aderinola

05/11/2018

Hello ROS developers! In this post, we’ll find out what happened to roscore in ROS2 and how similar functions of the ROS1 master were implemented in ROS2. Sit back and get ready to have some fun!

In order to approach this theory-like topic with as much practical as possible, this post has two main sections:

  1. Some tinkering with a ROS2 installation. This is the real fun part: trying to find roscore in ROS2.
  2. Some theory. As this might be a little boring, so we’ll keep it short and sweet!

Section 1: Trying to find roscore in a ROS2 installation

Since ROS2 arrived in town, there has been a rumour going round that “roscore is missing”! But don’t take anyone’s word for it; let’s find out for ourselves. Shall we?

We need a functional ROS2 installation for this. We will use one of the awesome Docker images of ROS2 provided by the Open Source Robotics Foundation (OSRF), to keep it easy for everyone and make sure we can tinker with ROS2 without committing too much time to installing it (yet). Choose any of the following options:

  1. Spin a free ROS development environment at ROSDS. With this, you skip all installations; just a few clicks and you will have access a ROS-ready computer within your browser. This is the recommended option.
  2. You have docker installed on your local development machine. Please note that a ROS2 installation is not necessary since we’re using a docker image, but if you have ROS2 installed already you may choose to use it instead of the docker image.

We are using option 1 for this post.  It’s about time we skipped local installations and start developing within our browsers, but I digress.

Now is time for action: fire up a terminal on your machine and get ready to shoot some commands at it! Our first task is spinning up the ROS2 docker installation:

user:~$ docker run -it osrf/ros2:bouncy-ros-core
Unable to find image 'osrf/ros2:bouncy-ros-core' locally
...

root@d213f10c91f9:/#

You should get something like the above, ending with a prompt that grants access to the ROS2 docker machine. Now type the following commands and study the output.

root@d213f10c91f9:/# roscore
bash: roscore: command not found
root@d213f10c91f9:/# ros2core
bash: ros2core: command not found
root@d213f10c91f9:/# ros2 core
usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
ros2: error: argument Call `ros2 <command> -h` for more detailed usage.: invalid choice: 'core' (choose from 'daemon', 'extension_points', 'extensions', 'launch', 'lifecycle', 'msg', 'node', 'param', 'pkg', 'run', 'service', 'srv', 'topic')
root@d213f10c91f9:/# ros2 master
usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
ros2: error: argument Call `ros2 <command> -h` for more detailed usage.: invalid choice: 'master' (choose from 'daemon', 'extension_points', 'extensions', 'launch', 'lifecycle', 'msg', 'node', 'param', 'pkg', 'run', 'service', 'srv', 'topic')

You may want to try other commands to find roscore in ROS2, but I’m done here. ?

Conclusion: could not find roscore in ROS2The rumour appears true after all.

But what happened to roscore – it was the “core” of ROS, so now what? Let’s find out in the next section.

Section 2: ROS2 – ending the ROS “slave trade”

“Hey, are you saying the people of ROS engaged in slave trade?!” Of course not! It’s just a fun way of describing how ROS1 worked. Relieved? ?

So let’s break the news here: roscore is dead in ROS2. It was killed, buried for good, and replaced by a better system. Here are some highlights:

  • In ROS1, roscore is the master node. Other nodes depend on it. But in ROS2, no more “master” (and “slaves”). Exit roscore. Enter DDS (Data Distribution Service).
  • In ROS1, roscore drives a client/server (or slave/master) architecture. For ROS2, DDS drives a distributed architecture.
    • Peer-to-peer communication (not master-slave :D). This sounds more democratic, doesn’t it?
    • No more single point of failure (fault tolerance). roscore can hold other nodes to ransom in ROS1, but no node can do that in ROS2.
    • Configurable Quality of Service (QoS). ROS1 provides a “best effort” service, but in ROS2 we can set the QoS required for a specific use case.
  • ROS2 also uses DDS for serialization and transport, in addition to “discovery”, which was the main function of roscore in ROS1.
  • You can read more about DDS here.

In short, in ROS2, DDS is the new Sherrif in town; roscore has been fired!

Wrapping up

You still have your terminal open? Great, let’s see an example of how one of the core functions performed by roscore is ROS1 is now done in ROS2:

root@d213f10c91f9:/# ros2 node list -a
_ros2cli_node_daemon_0

The command above “finds existing nodes, including hidden ones”. In ROS1,  roscore, which was a single node, used to rule this space. But no more in ROS2!

Video

Do you prefer to see this post in “audio and video” instead of “black and white”? If yes, the video below is for you. Enjoy!

We want to hear you!

Did you like this post? Whatever the case, please leave a comment in the comments section below, so we can interact and learn from each other.

If you want to learn about other ROS topics, then please let us know on the comments area and we will do a post or video about it.

Keep pushing you ROS2 learning!

Topics: ROS | ros1 | ros2
Masterclass 2023 batch2 blog banner

Check Out These Related Posts

1 Comment

  1. Anonymous

    Re: your slave trade title – “It’s just a fun way of describing how ROS1 worked.”

    I may be the first person to say this out loud to your team, but this isn’t appropriate anywhere, much less a professional site like The Construct. I trust that the same info can be conveyed without this uncomfortable joke.

    Reply

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This