Python ApproximateTimeSynchronizer not working
Dear all,
I want to subscribe to synchronized depth and rgb images using message_filters and ApproximateTImeSynchoronizer.
def rgb_callback(image):
rospy.loginfo("got RGB image")
def depth_callback(image):
rospy.loginfo("got DEPTH image")
def scan_callback(image,depth):
rospy.loginfo("got synched images")
def hand_tracker():
rospy.init_node('hand_tracker')
image_sub=message_filters.Subscriber('/kinect2/hd/image_color_rect',Image)
depth_sub=message_filters.Subscriber('/kinect2/hd/image_dept_rect',Image)
rospy.Subscriber('/kinect2/hd/image_color_rect',Image,rgb_callback)
rospy.Subscriber('/kinect2/hd/image_depth_rect',Image,depth_callback)
ts=message_filters.ApproximateTimeSynchronizer([image_sub,depth_sub],10,1)
ts.registerCallback(scan_callback)
try:
rospy.spin()
except KeyboardInterrupt:
print "Shutting down"
The problem is that rgb callback and depth callback are called, but the scan_callback using ApproximateTimeSynchronizer not. Is it a bug or is there something I am doing wrong?