Hello ROS Developers! In this post, we are going to answer the question “What is roscore”?
Our approach will be to SHOW what happens when roscore
is NOT running and what happens when it is. And then we go briefly over the theory behind this. We’ll also look at the command to start roscore
and what the output of this command means.
Let’s go!
Step 1: Setup your development environment
To follow this post, you need a computer with ROS already installed. There are three options; I recommend the last one as it’s the easiest!
- You have ROS installed locally (
kinetic <= version < crystal
). Great, nothing more is needed, just be ready to spin up a terminal at short notice 🙂 . - You don’t have ROS installed but you have
docker
installed. Don’t worry, there’s a way out – rundocker run -it osrf/ros:kinetic-destop
in your terminal to pull a ROS docker image. Please note:- Docker will “pull” this image if you don’t have it locally already.
- You need to run this command on every terminal you use in this post, before typing any other command!
- Neither ROS nor docker is installed? No problem – launch ready-to-go development environment on ROS Development Studio (ROSDS) within your browser! If you don’t have an account yet, you can create a free account here. Once you log in, create a project. You can call it
roscore_test
. To “launch a terminal” in ROSDS, pick theShell
app from theTools
menu.
Step 2: Run the test
Open a terminal and type the command shown. You should get an output like the one shown below:
user:~$ rosnode list ERROR: Unable to communicate with master!
That command was supposed to display a list of available ROS notes, not ERROR: Unable to communicate with master.
Mitchew, what’s going on?
Let’s try something different: let’s display a list of ROS topics:
user:~$ rostopic list ERROR: Unable to communicate with master!
Same thing! Okay, okay, maybe this will work. Open another terminal and run the following command:
user:~$ roscore ... logging to /home/user/.ros/log/9a7bf8ba-3b1a-11e9-b53e-0663119dbe5e/roslaunch-ip-172-31-35-10-26176.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://instance:45720/ ros_comm version 1.12.14 SUMMARY ======== PARAMETERS * /rosdistro: kinetic * /rosversion: 1.12.14 NODES auto-starting new master process[master]: started with pid [26195] ROS_MASTER_URI=http://instance:11311/ setting /run_id to 9a7bf8ba-3b1a-11e9-b53e-0663119dbe5e process[rosout-1]: started with pid [26226] started core service [/rosout]
Now go back and re-run the previous commands:
user:~$ rosnode list /rosout
user:~$ rostopic list /rosout /rosout_agg
Great, now it’s working, but what’s the catch? Let’s check that in the theory section!
Step 3: Master the concept – what is roscore
?
In the “Run the test” section, we see that we couldn’t do anything until we started roscore
. This is because it’s the node (program) that prepares the ROS system and gets it ready to work and accept commands. ROS is a centralized system, a master node (program) is always needed for other nodes and should be executed before other nodes. roscore
starts this master node.
You might have noticed that our error message whined about being unable to communicate with ‘master’, and the output of the roscore
program mentioned something about starting ‘master’. In the same output, you’ll also see that roscore
started a core service /rosout
, which is shown in the list of nodes. This /rosout
service is responsible for managing ROS output, using the topics /rosout
and /rosout_agg
.
If you are interested and want to learn more, please check our ROS In 5 Days (Python) course. The course explains what roscore, node, topic, service, action, etc, are, in detail.
Read more about roscore
from ROS Wiki: http://wiki.ros.org/roscore.
Extra 1: Video
Prefer to see the ‘sights and sounds’ version of this post? Please see the video below and be sure to tell us what you think about it.
Related Courses
Extra 2: Infographic
Here is the whole roscore
story in a small “flyer” that you can share with your friends for some quick learning!
Infographic:
Feedback
Did you like this post? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other. Thank you!
Roscore command is not working in ros development studio ‘s shell