Rosanswers logo


After some work with standalone PCL, I'm running the first tests of PCL under ROS.

I have a question: I understand that pcl::PointCloud is the preferred type for point clouds, and I was able to register a callback to kinect streams using just this type (without conversions to/from sensor_msgs::PointCloud2)

Now I was trying to implement a service that returns PointClouds. In order to define a service I need to specify a message type, and I only see sensor_msgs/PointCloud and PointCloud2.

My question is: this means that PointCloud2 is still the preferred standard for PointCloud messages, or am I missing a more specific message type that allows to handle pcl::PointCloud arguments?

Should I always work with sensor_msgs/PointCloud2 messages when playing with services, and perform conversions to pcl::PointCloud inside my code?

thank you

Originally posted by Kilin on ROS Answers with karma: 56 on 2012-12-12

Post score: 1


1 Answer 1


Rosanswers logo

Short answer, yes. sensor_msgs/PointCloud2 is the message type to transmit point clouds; if you want to do pcl processing with them you'll need to convert them to pcl::PointCloud<T> using pcl::fromROSMsg and pcl::toROSMsg.

For the long answer, see the ROS/PCL overview and the tutorial. As indicated on the latter:

The sensor_msgs/PointCloud2 format was designed as a ROS message, and is the preferred choice for ROS applications.

The pcl/PointCloud<T> format represents the internal PCL point cloud format. For modularity and efficiency reasons, the format is templated on the point type, and PCL provides a list of templated common types which are SSE aligned.

Hope it helps!

Originally posted by Miguel S. with karma: 1114 on 2012-12-12

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by Neil Traft on 2014-07-24:
With Hydro and the introduction of pcl::PCLPointCloud2 (as well as automatic serializers to convert b/w types), is this still true? Does pcl::PCLPointCloud2 trump pcl::PointCloud<T>?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.