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

Revision history [back]

If you're only interested in the latest messages and want to drop the rest, just set a queue_size of 1, when you create the subscriber.

Otherwise, you'll have to write your own data structure (queue, stack, std::vector) and continually spin to fill your data structure from the callbacks and process it in your own thread. Be careful of thread safety.