why message_filters is not working ?
System information OS: Ubuntu 18.04 ROS version: Melodic I am trying to implement message_filters in ROS, python3, melodic. I dont seem to understand why it's not working, no error in console, it stays as it is.
import rospy
import message_filters
from sensor_msgs.msg import Image, CameraInfo
def callback(image, camera_info):
print(image)
print("5"*10)
print(camera_info)
rospy.init_node("nod", anonymous = True)
image_sub = message_filters.Subscriber('/openmv_cam/image', Image)
info_sub = message_filters.Subscriber('/openmv_cam/camera_info', CameraInfo)
ts = message_filters.ApproximateTimeSynchronizer([image_sub, info_sub], 10, 0,2)
ts.registerCallback(callback)
rospy.spin()
PS: just copy pasted this from other examples. also used TimeSynchronizer , still no output !! It doesn't throw any error, shows no output !! also tried on machine with just python2, still no output !!
pardon me for writing code like this, no karma points here!!
Asked by Manish_ez on 2022-08-22 05:04:15 UTC
Answers
melodic
is tightly integrated with python2. If you really need python3 (specifically 3.8.10), you should usenoetic
.you appear to be passing the wrong number of args to the ApproximateTimeSynchronizer constructor. ) Note: 200 milliseconds is "0.2".
Asked by Mike Scheutzow on 2022-08-22 18:54:41 UTC
Comments
Yeah i changed the values in ApproximateTimeSynchronizer to 1, 1 rather that 10,0.2
Asked by Manish_ez on 2022-08-24 02:49:17 UTC
I would next verify that messages are being published on those 2 input topics, and that the header timestamp is similar between both. If the header timestamp is 0, the filter is not going to work.
Asked by Mike Scheutzow on 2022-08-24 07:10:48 UTC
Comments