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

Revision history [back]

click to hide/show revision 1
initial version

Based on your edit I would suggest to look into message_filters, specifically the Cache class.

From the wiki page:

Stores a time history of messages.

Given a stream of messages, the most recent N messages are cached in a ring buffer, from which time intervals of the cache can then be retrieved by the client. The timestamp of a message is determined from its header field.

So whenever you receive a message on the "slow" stream, look into your Cache and retrieve the message from the fast stream that corresponds to the same header.stamp.

If you'd like to automate this process you could even use a policy-based synchronizer, probably the ApproximateTime Policy. This will allow you to register a callback which will only be called when there are matching messages in both datastreams.

You might have to play with the buffer and/or slack time, depending on how disparate the two message rates are.