21

I want to know the difference(s) between pcl::PCLPointCloud2 and pcl::PointCloud in PointCloud Library (PCL). There is a function to convert from one to another, but the documentation is very poor. I would like to know, which one is newer?

p.s. (I am not talking about ROS)

NKN
  • 6,482
  • 6
  • 36
  • 55
  • 3
    To save others time, the conversion functions are `pcl::toPCLPointCloud2` and `pcl::fromPCLPointCloud2` ([source](http://docs.pointclouds.org/trunk/namespacepcl.html)). – Gabriel Devillers Aug 23 '17 at 14:49

2 Answers2

4
  1. PCL has replaced the "sensor_msgs::PointCloud2" type to "pcl::PCLPointCloud2".

  2. PointCLoud2 is a ROS message type.

=> So you had to use the PCLPointCloud2 type in PCL when you want to have interactions with ROS.

elaheh r
  • 474
  • 3
  • 11
  • take a look at these documentations: ROS: http://wiki.ros.org/hydro/Migration#PCL PCL: https://github.com/PointCloudLibrary/pcl/wiki/Remove-ROS – elaheh r Jan 26 '14 at 08:53
  • from Radu B. Rusu: "we're hoping to deprecate *_msgs/* (and thus PointCloud2 too) in the near future, in the 2.x trunk. " – elaheh r Jan 26 '14 at 08:55
  • 1
    Thanks for the answer, but for example in the "read PCD" tutorial of the PointCloud I read: "Alternatively, you can read a PCLPointCloud2 blob (available only in PCL 1.x). Due to the dynamic nature of point clouds, we prefer to read them as binary blobs, and then convert to the actual representation that we want to use.", Does it mean that PCLPointCloud2 is obsolete? – NKN Jan 28 '14 at 08:48
0

When you subscribe or publish, you don't need to convert them. #include "pcl_ros/point_cloud.h" will do that for you (called serialization). For more detail, take a look here: http://wiki.ros.org/pcl/Overview#Subscribing_to_different_point_cloud_message_types. Look for the paragraph starting at "If you have a pcl::PointCloud object, you don't have to convert it to a message:"

draw
  • 4,696
  • 6
  • 31
  • 37