ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Collect messages

asked 2014-06-03 10:05:37 -0500

crpizarr gravatar image

I need to collect messages from a topic, that is, subscribe to a topic, and then do something with some condition about the message is met (a flag on the message) with all the messages recibed previously. Since the callbacks are functions (and well-made functions should't have state), I don't see a straightforward way to do this. So, what can I do?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-03 11:21:23 -0500

dornhege gravatar image

You're gonna have to collect your messages somehow, e.g. in a class that has the callback.

ROS provides a cache that does this by time: A simple deque might also be sufficient.

edit flag offensive delete link more


In the end I used a class to collect the messages. Thanks

crpizarr gravatar image crpizarr  ( 2014-06-03 21:06:34 -0500 )edit

Question Tools

1 follower


Asked: 2014-06-03 10:05:37 -0500

Seen: 222 times

Last updated: Jun 03 '14