record topics with time synchronizer

asked 2018-04-10 01:56:15 -0600

khadija gravatar image

updated 2018-04-16 00:10:36 -0600

Hello every one

I want to record 4 topics with time synchronization. I found message_filter in ROS documentation that talk about this as a following:

import message_filters
from sensor_msgs.msg import Image, CameraInfo

def callback(image, camera_info):
  # Solve all of perception here...

image_sub = message_filters.Subscriber('image', Image)
info_sub = message_filters.Subscriber('camera_info', CameraInfo)

ts = message_filters.TimeSynchronizer([image_sub, info_sub], 10)
ts.registerCallback(callback)
rospy.spin()

could anyone tell me what should I put in callback function? should I read a previous recording bag? or I have to record a bag within this function? and If I have to record my bag inside a callback function what is the appropriate python command to use for the record??

edit retag flag offensive close merge delete