ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

pointCloud2 to pcl::pointcloud conversion

asked 2016-10-24 05:12:40 -0500

orsonl gravatar image

I am using velodyne VLP16. The information I am getting from it is "unordered" pointCloud2. I am having a trouble to translate it to pcl::pointcloud. According to the code provided online [here] ( ). I can simply get the x,y, and z value of the point from pointCloud2 by using a pcl function without giving the function any information regarding the sensor I am using(layer no. etc). Why is this the case?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-10-26 04:38:34 -0500

orsonl gravatar image

I have figured it out thanks to joq's comment. In the /velodyne/velodyne_pointcloud/include/velodyne_pointcloud there is a header file point_types.h. If you are writing a subscribe for velodyne_point you will need to include this header file so pcl_converter is able to interpret the topic and convert is to pcl::pointcloud. The callback function of the subscriber will do the conversion on the fly as it receives velodyne_point.

edit flag offensive delete link more

answered 2016-10-24 10:42:51 -0500

joq gravatar image

The code you mention does use a PCL point cloud. The for loop iterates over the entire cloud. Each inMsg->points[i] object contains x, y, z, and ring, as shown.

I am not yet sure what else you are asking.

edit flag offensive delete link more



Sir, from your comments on the two questions I posted, I am able to clarify my question. In the The node subscribes to /velodyne_points which is pointCloud2. I can't find the place where this topic is translated to a pcl point cloud.

orsonl gravatar image orsonl  ( 2016-10-24 12:39:49 -0500 )edit

That happens under the covers using pcl_conversions. I'm not sure exactly how that works.

joq gravatar image joq  ( 2016-10-24 14:52:55 -0500 )edit

Understood. I will look into it and let you know if I figure it out

orsonl gravatar image orsonl  ( 2016-10-25 00:46:34 -0500 )edit

I have other questions. x,y,z reading is in meter right? Is the origin the Velodyne sensor?

orsonl gravatar image orsonl  ( 2016-10-30 08:18:30 -0500 )edit

Yes, the ROS standard is for all distances to be in meters. The origin is the TF frame named in the message header's frame_id. By default that is the velodyne frame.

joq gravatar image joq  ( 2016-10-31 10:00:03 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-10-24 05:12:40 -0500

Seen: 1,195 times

Last updated: Oct 26 '16