ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
To clarify fergs' answer, it looks like you've done
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
but not
#include <pcl_ros/point_cloud.h>
The pcl/XXX
headers define pcl::PointCloud
and pcl::PointXYZ
types used by PCL. However, PCL is a stand-alone library that knows nothing about ROS. If you include only those headers, ROS doesn't know what to do with pcl::PointCloud
, because it's not a native ROS message type. Thus the ROS serialization code barfs.
pcl_ros/point_cloud.h
contains the glue code that tells ROS how to serialize/deserialize pcl::PointCloud
. This code serializes pcl::PointCloud
into exactly the same over-the-wire format as the ROS-native sensor_msgs/PointCloud2
message type, which is why you can use them interchangeably in your subscriber code.
If you exactly cut-and-paste the subscribing example, does it work?