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

Just in case someone has some trouble getting going with this, here's an example:

from message_filters import ApproximateTimeSynchronizer, Subscriber

def gotimage(image, camerainfo):
    assert image.header.stamp == camerainfo.header.stamp
    print "got an Image and CameraInfo"

image_sub = Subscriber("/wide_stereo/left/image_rect_color", sensor_msgs.msg.Image)
camera_sub = Subscriber("/wide_stereo/left/camera_info", sensor_msgs.msg.CameraInfo)

ats = ApproximateTimeSynchronizer([image_sub, camera_sub], queue_size=5, slop=0.1))
ats.registerCallback(gotimage)

I adapted this from the docs.