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

This seems like something that would not require separate CallbackQueues, but can be solved with "global variables" or message_filters (more specifically: Cache.

If you want to keep it simple: in every callback, first store the incoming msg into a global variable (or any variable that exists in a scope other than the local callback/function scope), then print your log message. Do this for all callbacks.

Any time any of the callbacks receives a message, the log message will be printed with the "last" received value of the other subscriptions. You might want to see whether you'd have to lock any of the variables to avoid reading (printing) stale data, but that would be an optimisation (almost).

As to Cache: if your messages have a header: store each incoming msg in a Cache, lookup corresponding (or latest messages for the other subscriptions), then print the log message.