Ask Your Question

Revision history [back]

As you guessed, the type of the variable you are giving to the publisher is different; it will convert to sensor_msgs::PointCloud instead of pcl::PointCloud, so try the following

void callback(const ImageConstPtr& image, const PointCloud2ConstPtr& pt_cloud)
{
  PointCloud pt_cloud1;
  convertPointCloud2ToPointCloud(*pt_cloud, pt_cloud1);
  ptc_pub.publish(pt_cloud1);
}

ref: convertPointCloud2ToPointCloud