Error: Euclidean Cluster Extraction, Cannot publish the cloud cluster

asked 2017-04-11 08:08:09 -0500

jiglesiasc gravatar image

Hello I'm working with the camera Kinect and ROS. What I want to do is to pass the Euclidean Cluster Extraction algorithm ,which is already programmed by PCL, and then publish the cluster point cloud as a topic to see it in RVIZ. The algorithm works well but I don't achieve to see the point cloud in RVIZ. I get the next error.

I think that is has something to do with the way of saving the information. Here's the code.

pcl::PointCloud<pcl::pointxyz>::Ptr cloud_cluster (new pcl::PointCloud<pcl::pointxyz>); for (std::vector<pcl::pointindices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it) { for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit) cloud_cluster->points.push_back (cloud_rem_noise->points[pit]); // cloud_cluster->width = cloud_cluster->points.size (); cloud_cluster->height = 1; cloud_cluster->is_dense = true; std::cout << "PointCloud representing the Cluster: " << cloud_cluster->points.size () << " data points." << std::endl; }

// Convert to ROS data type sensor_msgs::PointCloud2 output; pcl::toPCLPointCloud2 (cloud_cluster, *cloud_plane_PCL2); pcl_conversions::fromPCL(cloud_plane_PCL2, output); // Publish the data pub.publish (output); pub.publish (output);

Thaks in advance

edit retag flag offensive close merge delete