0
$\begingroup$

Rosanswers logo

From what I know:

  1. If we do not specify, by default the subscribe is going to global callbackqueue on that node.

  2. I assume that each node has 1 global callbackqueue

  3. However I read question&ans from answer.ros.org (I lost the link already)--->if we have mulitple subscribers for a node, let's say subA and subB in the same node1. We can assign different queueSize for each :

    ros::Subscriber sub1A = n.subscribe("topicA", 1, callbackMon); ros::Subscriber sub1B = n.subscribe("topicB", 1000, callbackMon);

I tried to implement this, and yes it's true. But I don't know why.

I want explanation on this. I thought by default sub1A and sub1B are assigned to the SAME global callbackqueue (see my point 2) , so how come I can assign different sizes for the SAME queue?

To support my question, from callback and spinning overview , I read that the implementation for spinOnce is basically :

ros::getGlobalCallbackQueue()->callAvailable(ros::WallDuration(0));

So I see that spinOnce only call from ONE QUEUE, that is the globalcallbackqueue, so I can't see that this only queue can be assign to different sizes?

------------------------------------------------------------EDIT--------------------------------------------------------------------

Please confirm/correct the following statements:

  1. When we do n.subscribe, the queue size refers to incoming message queue

  2. Each subscriber has one incoming message queue

  3. When we do advertise, the queue size refers to outgoing message queue

  4. Each publisher has one outgoing message queue

  5. Each node (by default) has one global callback queue.

Questions:

What about the callback queue size? Where do we set it?What is its default size? What happen if the incoming message queue size is small that the message has been thrown away but the callback for handling that message still in the callback queue?


Originally posted by alienmon on ROS Answers with karma: 582 on 2016-08-31

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The callback queue and the message queue are different things.

There is one callback queue that tracks which callbacks need to be processed, but there is a separate message queue for each topic.


Originally posted by ahendrix with karma: 47576 on 2016-08-31

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by alienmon on 2016-09-01:\

  1. When we do n.subscribe, the queue size refers to the message queue?
  2. Each subscriber has one message queue, and each node has one global callback queue?
  3. What if the message queue size is small that the message has been thrown away but the callback for that message still in the callback q?

Comment by alienmon on 2016-09-01:
@ahendrix Please answer my additional questions , I edited my question.

Comment by ahendrix on 2016-09-01:
I don't know the answers to your additional questions offhand. I suspect the only people who know are the ones who actually wrote the callback logic. I know callback dispatch works and drops messages correctly; if you really care about the finer details I'd suggest you read the code.

$\endgroup$

This site is temporarily in read-only mode and not accepting new answers.