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

Revision history [back]

click to hide/show revision 1
initial version

Hey,

So I went over the ROS Documentation and this is what I understood from it.

As the documentation says,

publish() in roscpp is asynchronous, and only does work if there are subscribers connected on that topic. publish() itself is meant to be very fast, so it does as little work as possible:

  1. Serialize the message to a buffer
  2. Pushes that buffer onto a queue for later processing

The queue it's pushed onto is then serviced as soon as possible by one of roscpp's internal threads, where it gets put onto a queue for each connected subscriber -- this second set of queues are the ones whose size is set with the queue_size parameter in advertise(). If one of these queues fills up the oldest message will be dropped before adding the next message to the queue.

It looks like the publisher and the subscriber do not directly interact. Instead, they use two queues. Publisher simply pushes data to q1 and the subscriber retrieves data from q2. Data transfer from q1->q2 is implicit and taken care of by the roscpp internals.

I'm not sure what you mean by the socket level connection between the subscriber and the publisher but I don't think there is such a connection between those two like client - server. Instead, both the subscriber and publisher will be connecting to the ROS master.