I want to call the callback function when messages with the same timestamp come from both rgb and depth topics

asked 2020-12-10 01:33:30 -0500

first-penguin gravatar image

Hi. I am using realsense-ros. I want to call the callback function when messages with the same timestamp come from both rgb(/camera/color/image_raw ) and depth(/camera/depth/image_rect_raw) topics. I set enable_sync and align_depth in rs_camera.launch to true. I then used message_filters to synchronize the two topics.

message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nodeHandle_, cameraTopicName, cameraQueueSize); message_filters::Subscriber<sensor_msgs::Image> depth_sub(nodeHandle_, depthTopicName, depthQueueSize); message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::Image> sync(rgb_sub, depth_sub, 10); sync.registerCallback(&TkdnnObjectDetector::cameraCallback, this);

After doing this, I tried to run it, but the cameraCallback function was never called. Do you have any advice? Thanks!

edit retag flag offensive close merge delete