[ros-users] callback function on one topic with different message types

Josh Faust jfaust at willowgarage.com
Tue Mar 23 18:29:04 UTC 2010


On Tue, Mar 23, 2010 at 8:49 AM, Radu Bogdan Rusu <rusu at willowgarage.com>wrote:

> Though _not_ recommended, and if you really _cannot_ define multiple
> message types and multiple topics, _and_ if you
> only get one of the two types of messages for the entire duration while
> your node is up, you can get rid of the flag,
> and just subscribe to the same topic twice using different callbacks and
> different message types. The callback that
> answers first should invalidate the other. You can see an example of this
> working in point_cloud_converter.
>
>
If this works it's only by accident, and is not guaranteed to work in the
future.  I strongly recommend you don't rely on it (including in
point_cloud_converter).

Actually, a quick test shows that it does not work (first subscription wins)
so relying on it is definitely a bad idea.

Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100323/35a39b65/attachment-0003.html>


More information about the ros-users mailing list