0
$\begingroup$

Rosanswers logo

Although most tutorials only discuss the publisher queue size, a subscriber has such a parameter as well. So I'm wondering: When to use which queue size?

Actually the subscriber seems to be the natural place for a queue: If new messages arrive and the handler hasn't finished processing the previous message, it decides whether to store or to discard the message.

But what is the purpose of a publisher queue? If I'm understanding the documentation correctly, it manages whether to publish or to discard a message if any subscriber is still busy.


Originally posted by Falko on ROS Answers with karma: 268 on 2015-11-23

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

As far as I understand it, when you call publish it does not block until the message is actually sent, but places the message in the publish queue and returns immediately. When your function, in which you called publish returns, it is up to ROS (via ros::spin()) to decide what to call next. Possibly to actually serialize and send your message, but there could be other stuff to do, e.g. processing an incoming message or publishing other messages.

Hence you need a queue and published messages could be dropped if there is too much load, form receiving and/or publishing too many messages.


Originally posted by Dimitri Schachmann with karma: 789 on 2015-11-23

This answer was ACCEPTED on the original site

Post score: 7


Original comments

Comment by Boris on 2015-11-23:
Publish queues may also help on low-bandwidth and high-latency communication channel, which is the last bottleneck before a message reach a subscriber.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.