Asus Xtion depth and rgb synchronization

asked 2013-12-15 01:09:45 -0600

Dyna gravatar image

updated 2013-12-15 02:37:20 -0600

Hi everybody,

I'm trying to synchronize the depth and the rgb images of my Asus Xtion. I use ApproximateTime filter for synchronizing my images, but it doesn't work, my callback function is never called....some help would be appreciate...

I look at my topics with rostopic hz. When I do not run my code, the messages arrive at about 30 Hz (normal), when I run my code, the frequency 0.45Hz falls on both topics ....

Here is my code :

int main(int argc, char** argv)
  ros::init(argc, argv, "sync_cam");
  ros::NodeHandle nh;

  printf("Main ? \n");
  image_transport::SubscriberFilter sub_cam_rgb_img ;
  image_transport::SubscriberFilter sub_cam_depth_img ;

  image_transport::ImageTransport rgb_it(nh);
  image_transport::ImageTransport depth_it(nh);

  sub_cam_rgb_img.subscribe(rgb_it, "/camera/rgb/image_color",   10);
  sub_cam_depth_img.subscribe(depth_it, "/camera/depth/image_raw", 10);

  typedef sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image> MySyncPolicy;

  Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub_cam_rgb_img, sub_cam_depth_img);
  sync.registerCallback(boost::bind(&callback, _1, _2));

  ros::spin() ;   

  return 0;
edit retag flag offensive close merge delete