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

Rospy message_filter ApproximateTimeSynchronizer issue

asked 2019-08-31 22:45:35 -0600

Ajith gravatar image

updated 2019-08-31 22:55:08 -0600

Hi All,

I installed ROS melodic version in Ubuntu 18.04. I'm running a rosbag in the background to mock cameras in messages rostopics. I set the camera names in rosparams and iterated through it to capture each camera topics. I'm using message_filter ApproximateTimeSynchronizerto get time synchronized data as mentioned in the official documentation,

But most of the time the callback function to ApproximateTimeSynchronizer is not being called/is having too much delay. The code snippet I'm using is given below:

def  camera_callback(*args):
    pass # Other logic comes here
rospy.init_node('my_listener', anonymous=True) 
camera_object_data = []
for camera_name in rospy.get_param('/my/cameras'):
        '/{}/hd/camera_info'.format(camera_name), CameraInfo))
        '/{}/hd/image_color_rect'.format(camera_name), Image))
        '/{}/qhd/image_depth_rect'.format(camera_name), Image))
        '/{}/qhd/points'.format(camera_name), PointCloud2)
 topic_list = [filter_obj for filter_obj in camera_object_data]
 ts = message_filters.ApproximateTimeSynchronizer(topic_list, 10, 1,  allow_headerless=True)

What am I doing wrong here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-04 07:07:15 -0600

Choco93 gravatar image

You can try increasing the slop value as defined here, and just for sanity check maybe check what is the actual time difference in the headers of your topics.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-08-31 22:45:35 -0600

Seen: 640 times

Last updated: Sep 04 '19