0
$\begingroup$

Rosanswers logo

Hi all, it is a simple question but I see that there is no topic on it. I have a topic on which a publisher is publishing data (string) with a queue of 10 messages.

On the other side, I want to subscribe it through a subscriber (with queue 5). Is there a way to get all messages (or at least the first 5) published on this topic? I tried with a callback function of the subscriber taking a vector with no results.

Thanks a lot for any answering,

Neostek


Originally posted by Neostek on ROS Answers with karma: 156 on 2012-04-26

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

AFAIK there is no direct way.

It may be possible if you can reimplement your own callback queue although. Or play with the existing callback queueus to do that but it will not be straight-forward. See rocpp API for more information

[My impression is that you try to rebuild a communication protocol over the ROS topics. I.e. sending messages in small chunks you reassemble at the end. If this is the case, I highly recommend that you avoid doing that. ROS topics are not designed to work that way. Just send one big message containing all the information you want to transmit. ROS will then do the hard work for you.]


Originally posted by Thomas with karma: 4478 on 2012-04-27

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

The point is that I publish on this topic different type of data and I want to store in memory the last X ones since I want to read them only with a certain frequency. I think the best solution is to modify my callback function in such a way it stores data with a simple array. Thanks a lot for your reply!


Originally posted by Neostek with karma: 156 on 2012-04-27

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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