[ros-users] Get all topic messages

Jack O'Quin jack.oquin at gmail.com
Fri Apr 27 13:35:16 UTC 2012


On Fri, Apr 27, 2012 at 5:24 AM, marco.cognetti at libero.it
<marco.cognetti at libero.it> wrote:
> 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.
> I succeed to do it saving a vector and using the push_back function whenever
> the callback is invoked. I don't like so much this solution since if other
> methods invokes the spinOnce then the same data are saved on the vector....is
> there a smarter way?
>
> Thanks a lot for any answer,

This is a good question for answers.ros.org, please ask it there.

Thanks,
-- 
 joq



More information about the ros-users mailing list