[ros-users] Get sporadic messages from periodic publisher

Lorenz Mösenlechner moesenle at in.tum.de
Mon Dec 10 16:04:13 UTC 2012


Hi,

I think this kind of question is best asked on answers.ros.org. Also
make sure you have a look at the support page here:
http://ros.org/wiki/Support

Lorenz

On Mon, Dec 10, 2012 at 4:53 PM, Francesco Corucci <f.corucci at gmail.com> wrote:
> Hi everyone,
>
> I've just started working with ros, this is my first post here :-)
>
> I'd like to ask a question: I have a publisher that publishes a kinect
> stream at a certain rate.
>
> Until now I've always needed to process every snapshot, so I just subscribed
> to the topic and process each message in my callback.
>
> I was thinking that sometimes it could be useful for a client to get single
> messages, sporadically, from a periodic publisher. Is there an easy way to
> do that?
>
> I could skip messages in my callback until I want to grab one, but I'd like
> to avoid the overhead of the calls I don't need.
>
> I guess I could play with subscribe/ubsubscribe on demand, but I imagine it
> would be very slow.
>
> The better way that I was able to think is to modify the publisher, adding a
> service that, when called, returns just the last message.
> This way it could be possible to have a periodic publisher that could also
> be used as a "sporadic" publisher. Is this the best solution, or there's
> something simpler, that doesn't need to modify the publisher?
>
> To simplify, I want to use the same publisher as sporadic for some clients,
> as periodic for some others.
>
> Thank you :-)
>
>
> -- Francesco
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



-- 
Lorenz Mösenlechner            | moesenle at in.tum.de
Technische Universität München | Karlstraße 45
80335 München                  | Germany
http://ias.cs.tum.edu/         | Tel: +49 (89) 289-26910



More information about the ros-users mailing list