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

Revision history [back]

In main() where you create sub1 and sub2 try increasing the queue_size from 1 to 5 or 10. This will allow the approximate algorithm enough samples to find which messages are closest in time. Alternatively, try reducing the queue_size passed to the sync_policy. You are using 100 and could try dropping that to about 10.

Also, instead of wrapping spinOnce() inside a while loop you can replace the entire while loop with a single call to ros::spin().