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

Synchronise point Cloud and RGB Image from the same camera

asked 2014-03-30 23:01:34 -0500

Maya gravatar image

updated 2014-03-30 23:02:08 -0500

Hello,

I possess a Xtion camera and I'm trying to retrieve the Point Cloud AND the rgb image at the same time through a Callback Function. I tried using message_filters to do this as such :

message_filters::Subscriber<sensor_msgs::PointCloud2> cloud_sub(nh, "/camera/depth/points_xyzrgb", 100);
message_filters::Subscriber<sensor_msgs::Image> image_sub(nh, "/camera/rgb/image", 100);
message_filters::TimeSynchronizer<sensor_msgs::PointCloud2, sensor_msgs::Image> sync(cloud_sub, image_sub, 10);
sync.registerCallback(boost::bind(&Main::doWork, main, _1, _2));

The code is working but since the message are not published at the exact same time (it is actually my guess of why the callback is never call), the Callback is never called and nothing happen.

My second idea would have been to store the rgb data each time the call back for this image is called and compared the time stamp of this image with the PointCloud one, for them not to be to far apart. But it's not a very elegant solution and I'm wondering if nothing better exist to do that in ROS. I would love to be able to give messages filter a space in which it can consider two messages to be published at the same time but I didn't find a way to do it in the doc.

I know already that I can find the rgb image from the pointCloud but the calculation are more intensive if I do it that way...

Thanks for you help and time !

edit retag flag offensive close merge delete

Comments

Now I got the same problem.

The code is still working without error/warning, but I can not get any information. I checked the code and found the Callback is never called. Could you give me some suggestions?

Thanks!

aihanbing gravatar image aihanbing  ( 2018-12-27 02:09:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-04-01 02:13:30 -0500

Wolf gravatar image

If your code is not working because the messages are not publish at exact the same time, as you suggested, have you considered using approximate time policy? See:

http://wiki.ros.org/message_filters#A...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-03-30 23:01:34 -0500

Seen: 2,707 times

Last updated: Apr 01 '14