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

PCL : Use Camera Topic instead of PCD File

asked 2015-08-04 13:23:49 -0600

fatstudentsweating gravatar image

Hello guys,

i'm really struggling with my mind while reading the PCL Documentation on . I want to process the registered depth cloud stream of my XTion Pro Live in a cpp file. So i found this : which says

"since we use ROS subscribers and publishers in our code snippet above, we can ignore the loading and saving of point cloud data using the PCD format."

That tutorial talks about a Voxel Snippet in Cpp, on the PCL website

What i don't get is : in the PCL Tutorial, it's all about loading a PCD file (it that right ?) and processing that file. But i want to process a live XYZRGB Stream from the Camera. Would i have to convert the stream (pointcloud_to_pcd then pcd_to_pointcloud) everytime to a PCD file ? Or is it possible to input the Topic of my Camera ?

I'm not getting the logic behind all this yet

I hope someone can rescue me in this mind Jungle Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-08-05 01:54:25 -0600

You can directly process on the topic, otherwise, it would not make any sense. In the tutorial they are using PCD so that you can do it without a camera.

In the PCL tutorials link you have posted, , there is a minimum example on how to do this. You just have to subscribe to:

ros::Subscriber sub = nh.subscribe ("input", 1, cloud_cb); with a callback of type

void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)

and that is it. There is even an example on how to process the cloud with a filter.

edit flag offensive delete link more


Hello Javi, Thanks a lot ! If I can process directly on a topic, will all frames of the camera be processed ? I mean if there are like 15 Point Clouds streaming, will each one be processed ? Simultaneously? This is kind of confusing for me :D sorry if my questions seem weird

fatstudentsweating gravatar image fatstudentsweating  ( 2015-08-05 05:57:28 -0600 )edit

Unfortunately not all frame will be processed. If the callback is busy doing some processing, it will not be called when a new image arrives (I am not 100% sure that it is like this). But I am sure that you can lose some frames. For that, callbacks should remain as simple as possible.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-08-05 06:18:17 -0600 )edit

Question Tools

1 follower


Asked: 2015-08-04 13:23:49 -0600

Seen: 476 times

Last updated: Aug 05 '15