0
$\begingroup$

Rosanswers logo

2 different nodes are listening to a msg with the same topic. 1 node (written in C++) gets the msg and print its content in an expected, minimum delay. But the other (python) node shows the older content and I have no idea why this delay occurs. I'd appreciate any ideas.

Codes (partial, they show where I compare the values):

Coincident or not, the difference is the language (C++ vs Python), and extension (Codes in python is separated into parent and sub class). But I don't know if these factors matter (and hopefully they do not).

All nodes run on the same machine (Ubuntu 11.04, electric, Intel i7 quad).


Update 11/2/11) I'm now comparing timestamp and approx. 30 seconds after starting program, the difference of timestamps from both nodes are 8 ROS seconds.


Originally posted by 130s on ROS Answers with karma: 10937 on 2011-11-01

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Solved by myself - changing subscriber's queue_size works out for me. Using the code example on my environment I described in the question, I increased it from 1 to 5 in the problematic code (the one in python). Btw the queue_size in the publisher is not showing influence here.

PS. However I still don't get why...I've read documents including this QA though. Is my understanding below correct...? I'll give a vote if someone corrects it.

Increasing queue_size means the number of msgs processed in one callback increases, and that number could be greater than calling callback during exactly same length of period.


Originally posted by 130s with karma: 10937 on 2011-11-02

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by 130s on 2011-11-02:
@tfoote thank you, that makes perfect sense to me. Now I feel this queuing architecture might not be ROS specific but instead more common in general distributed system, and also suppose that could be because the documents out there don't explain detail.

Comment by tfoote on 2011-11-02:
All messages being received are put into a queue. When this queue has data in it, your callbacks will be called. However if data comes in faster than your callback executes, the queue will fill up. It looks like you had your queue length set to 1000. Meaning you could be 1000 messages behind.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.