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

why message_filters is not working ?

asked 2022-08-22 05:06:41 -0600

Manish_ez gravatar image

updated 2022-08-24 02:28:40 -0600

gvdhoorn gravatar image

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!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-22 18:54:41 -0600

Mike Scheutzow gravatar image

updated 2022-08-22 19:09:49 -0600

  1. melodic is tightly integrated with python2. If you really need python3 (specifically 3.8.10), you should use noetic.

  2. you appear to be passing the wrong number of args to the ApproximateTimeSynchronizer constructor. ) Note: 200 milliseconds is "0.2".

edit flag offensive delete link more

Comments

Yeah i changed the values in ApproximateTimeSynchronizer to 1, 1 rather that 10,0.2

Manish_ez gravatar image Manish_ez  ( 2022-08-24 02:49:17 -0600 )edit

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.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-08-24 07:10:48 -0600 )edit

Question Tools

Stats

Asked: 2022-08-22 05:04:15 -0600

Seen: 115 times

Last updated: Aug 24 '22