TimeSynchronizer stops working with rosbay looping
I am working with TimeSynchronizer in python to exactly sync images from 2 cameras that i recorded with rosbay. Now when playing the rosbag with the --loop option, every time the rosbag ends and restarts my program stops working and no callbacks are being called. My guess is, that the number of recorded frames for both cameras do not exactly match and since I am using a queue-size of 1 to optimize delays, the synchronizer fails to find a corresponding packet.
Any ideas?
image_sub1 = message_filters.Subscriber("/stereo/left/image_mono", Image)
image_sub2 = message_filters.Subscriber("/stereo/right/image_mono", Image)
sync = functools.partial(message_filters.TimeSynchronizer)
ts = sync([image_sub1, image_sub2], 1)
ts.registerCallback(self.calculate)
I'm not sure how this is implemented, but maybe the TimeSynchronizer assumes that time only increases, thus looping makes this impossible to work.