ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

As far as I know the subscriber and publisher nodes only communicate with roscore when declaring that they are subscribing or publishing a certain topic, service, parameter etc... After that, the nodes communicate with each other directly.

You can think of roscore as a sort of DNS. Once the nodes have discovered each other, they don't need to talk to roscore any more.

You can easily verify this behavior by opening 3 terminals. On the first one you run roscore, on the second one you run rostopic pub /my_int std_msgs/Int32 "data: 42" -r 1 (this will publish an integer with value 42 every second on a topic named /my_int) and on the third terminal run rostopic echo /my_int.

You will see the following output on the third terminal:

data: 42
---
data: 42
---
data: 42
---

After that, if you kill roscore on the first terminal you will see that the publisher and the subscriber are unaffected and messages data: 42 will keep piling up on the third terminal.

The problem is if roscore dies and a new node wants to register itself as a publisher or as a subscriber it will not be able to and will give you an error.

As far as I know the subscriber and publisher nodes only communicate with roscore when declaring that they are subscribing or publishing a certain topic, service, parameter etc... After that, the nodes communicate with each other directly.

You can think of roscore as a sort of DNS. Once the nodes have discovered each other, they don't need to talk to roscore any more.

You can easily verify this behavior by opening 3 terminals. On the first one you run roscore, on the second one you run rostopic pub /my_int std_msgs/Int32 "data: 42" -r 1 (this will publish an integer with value 42 every second on a topic named /my_int) and on the third terminal run rostopic echo /my_int.

You will see the following output on the third terminal:

data: 42
---
data: 42
---
data: 42
---

After that, if you kill roscore on the first terminal you will see that the publisher and the subscriber are unaffected and messages data: 42 will keep piling up on the third terminal.

The problem is if roscore dies and a new node wants to register itself as a publisher or as a subscriber it will not be able to and will give you an error.

For your application you might be interested in looking into ROS2. No roscore is needed any more.