Python ApproximateTimeSynchronizer callback working but no sync
Hi All:
I am using message_filters (python) ApproximateTimeSynchronizer to sync two topics in a class; one custom rpy msg (tat_bry) and output from robot_localization's navsat_transform (/gps/filtered). Both nodes appear in the default (/) namespace. The callback (see code snippet below) seems to be working as my roslog text message comes through "syncing'. When echoes for both topics, are initiated, there appears a difference in sequence numbers of around 5 and a disparity between topics of a maximum of slightly more than .06s using a 'slop' of 0.033s. After reading the documentation for both the C++ and Python version, I chose this value as 1/2 of the 16Hz frequency of 0.0625/s or about 0.033s.
After many forms of experimenting with queue sizes, and 'slop' parameters, changing input frequencies and namespaces to no avail; I cannot produce a synchronized set between the two topics. I wonder after looking at the affected portion of the node diagram, it appears that echoing the topics may be taking place prior to the synchronization?
Is there a way to echo the resultant output stream of the callback (after sync)? Are the topics spread too far to sync using this filter? I've used this filter before and did not seem to have this issue.
Using Ubuntu 14.04LTs, Indigo
Any insight is greatly appreciated.
B2256
class AflSync():
def __init__(self):
self.got_new_msg = False
self.tat_bry_msg = TatBry()
self.sync_msg = Sync_orb()
# Create subscribers and publishers
# subscriber to message_filters module and assigning to local class variable
self.sub_gps = Subscriber("gps/filtered", NavSatFix)
self.sub_rpy = Subscriber("tat_bry", TatBry)
# Synchronize topics
ts = ApproximateTimeSynchronizer([self.sub_gps, self.sub_rpy], 2, 0.033)
ts.registerCallback(self.cb_aflsync)
def cb_aflsync(self, sync_msg, tat_bry_msg):
r = rospy.Rate(16) # 16hz
rospy.loginfo('syncing')
# Main while loop.
while not rospy.is_shutdown():
r.sleep()
Still cannot get returned sync messages. Queue length or slop- neither seems to matter, yet the loginfo prints?? What else can affect this?