message_filter is not working for dnn_detect
Hello guys,
I wanna sync two topics with the aid of message_filters. The topics are /scan (LaserScan) and /dnn_objects (DetectedObjectArray) from the dnn_detect package, which gives me the bounding boxes, classes and confidence of the detected objects.
My code looks like follows:
import message_filters
from sensor_msgs.msg import LaserScan
from dnn_detect.msg import DetectedObjectArray
import rospy
rospy.init_node("msg_filter_testnode")
def callback(laser, dnn_obj):
print "first line in callback"
print "laser min range: ", laser.range_min
print "confidence first object: ", dnn_obj.objects[0].confidence
laser_sub = message_filters.Subscriber('/scan', LaserScan)
bounding_sub = message_filters.Subscriber('/dnn_objects', DetectedObjectArray)
ts = message_filters.TimeSynchronizer([laser_sub, bounding_sub], 10)
print "after time sync"
ts.registerCallback(callback)
print "after reg callback"
rospy.spin()
My problem is, the callback function won't be invoked and that is for sure because of the /dnn_objects topic. If I use the /dnn_images topic instead, everything works fine. I also used the ApproximateTimeSynchronizer class instead of TimeSynchronizer but nothing changed. The message type of /dnn_objects is DetectedObjectArray and has a header field, which is I guess a constraint for message_filters.
I would appreciate every help guys, thanks in advance!