[ros-users] Get sporadic messages from periodic publisher

Francesco Corucci f.corucci at gmail.com
Mon Dec 10 15:53:15 UTC 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20121210/2c7982ae/attachment-0003.html>


More information about the ros-users mailing list