Rosanswers logo

I want to ask a next question to somebody who is familiar with PCL in ROS.
What does sensor_msgs::PointCloud2 mean?
On this page (http://wiki.ros.org/pcl/Tutorials), Wiki instructs Hydro users to use pcl::PCLPointCloud2 instead of sensor_msgs::PointCloud2 in a callback function.
Actually, I can't build execute file of example.cpp on /pcl/Tutorials if I use sensor_msgs::PointCloud2.
Is sensor_msgs::PointCloud2 never used on Hydro?

Thank you in advance!

Originally posted by Ken_in_JAPAN on ROS Answers with karma: 894 on 2014-04-24

Post score: 0


1 Answer 1


Rosanswers logo

When it was first being developed, PCL had a very close relationship with ROS. It was only recently that PCL has become completely independent of ROS, after some code refactoring.

ROS has always had its own point cloud data structure (sensor_msgs::PointCloud and then sensor_msgs::PointCloud2), which was initially used at least partially by PCL. So pcl::PCLPointCloud2 exists today mostly for compatibility with ROS.

I am working with PCL in Hydro, so if you let me know where exactly you're having issues (either by asking a new question, which is better, or editing this one) I might be able to give you some pointers.

Originally posted by georgebrindeiro with karma: 1264 on 2014-04-24

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by Ken_in_JAPAN on 2014-04-24:
@georgebrindeiro, Thank you for replying early! The one of thing I want to know is how to pass ROS topic (that means sensor infomation) to callback function. I have thought that the role is sensor_msg::PointCloud. My idea is wrong, isn't it? I will rely on you when I have new issues. Thanks!

Comment by georgebrindeiro on 2014-04-27:
When using ROS, you use sensor_msgs::PointCloud2. When using PCL, you use PCL types. To convert from ROS to PCL cloud type, use the pcl_conversions::toPCL function. To convert back, use pcl_conversions::fromPCL. See http://wiki.ros.org/hydro/Migration#PCL

Comment by Athoesen on 2014-05-20:
Have you had any luck saving PCD files with ROS and PCL?

Comment by georgebrindeiro on 2014-05-22:
@Athoesen yeah, no problem. if you're having problems with that, though, you should probably start a new thread.


Your Answer

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