Ask Your Question
3

Multiple subscribed topics in one callback

asked 2014-03-04 20:42:53 -0500

jpo gravatar image

updated 2014-03-04 20:54:32 -0500

Hi, I'm new to ROS and PCL as well so please excuse my trivial question.

I need to process a PointCloud topic and CameraInfo topic (project the cloud using the camera info). What is the best way to do that? I can see that I cannot have multiple topics as arguments in one callback, I found I can use the function "bind" but I am not sure if it is the right way for me...

Thanks in advance, jp

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-03-04 21:18:08 -0500

ahendrix gravatar image

In general, if you want to synchronize the input from two topics and process them in the same callback, you can use the message_filters time synchronizer API.

If you're looking specifically to receive a camera_info message and use the data in it for processing a camera image, it may be better to subscribe to the two topics separately and just save the most recent CameraInfo for use when processing images. This relaxes the timing requirements pretty significantly and means you don't have to run a complex synchronization filter.

You may also find the documentation on the CameraInfo message useful.

For typical uses you should be able to extract XYZ from a structured RGB Point cloud without resorting to CameraInfo.

edit flag offensive delete link more
1

answered 2014-03-04 21:19:40 -0500

davinci gravatar image

You can use a message filter to synchronize the topics. But the camera info usually doesn't change much so you can also set this information once.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2014-03-04 20:42:53 -0500

Seen: 5,074 times

Last updated: Mar 04 '14