Ask Your Question
3

When to use publisher queue size vs. subscriber queue size

asked 2015-11-23 03:08:01 -0500

updated 2015-11-23 03:08:43 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
7

answered 2015-11-23 04:42:28 -0500

Dimitri Schachmann gravatar image

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.

edit flag offensive delete link more

Comments

1

Publish queues may also help on low-bandwidth and high-latency communication channel, which is the last bottleneck before a message reach a subscriber.

Boris gravatar image Boris  ( 2015-11-23 10:13:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-23 03:08:01 -0500

Seen: 2,168 times

Last updated: Nov 23 '15