Ask Your Question

What does sensor_msgs::PointCloud2 mean?

asked 2014-04-24 12:41:59 -0500

Ken_in_JAPAN gravatar image

updated 2014-04-24 13:04:35 -0500

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 ( ), 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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-24 13:21:45 -0500

updated 2014-04-24 13:22:03 -0500

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.

edit flag offensive delete link more


@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!

Ken_in_JAPAN gravatar image Ken_in_JAPAN  ( 2014-04-24 13:52:14 -0500 )edit

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

georgebrindeiro gravatar image georgebrindeiro  ( 2014-04-27 07:10:51 -0500 )edit

Have you had any luck saving PCD files with ROS and PCL?

Athoesen gravatar image Athoesen  ( 2014-05-20 09:18:03 -0500 )edit

@Athoesen yeah, no problem. if you're having problems with that, though, you should probably start a new thread.

georgebrindeiro gravatar image georgebrindeiro  ( 2014-05-22 11:27:46 -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: 2014-04-24 12:41:59 -0500

Seen: 728 times

Last updated: Apr 24 '14