Unknown PCL surface normal in Lidar processing

asked 2019-11-05 07:26:14 -0600

kiro26 gravatar image


I'm working with ROS melodic and PCL library and want to segment and detect an object using RANSAC model. While looking for some tutorial there were only showing simple application of plane and sphere. http://pointclouds.org/documentation/...

I want to try some model like cone but the class parameter is more than two

pcl::SampleConsensusModelCone< PointT, PointNT >

pointT and PointNT. There is not much explanation what should PointNT is. I was trying to simply put a PointType data as an input.

void ObjectDetection::callback(const sensor_msgs::PointCloud2ConstPtr& pointCloudMsg) { ROS_INFO("I heard"); // pointcloud converting PclCloudPtr cone_cloud(new PclCloud) ,final_cloud(new PclCloud); pcl::fromROSMsg(*pointCloudMsg, *cone_cloud); pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients ());

if (cone_cloud != nullptr)
    std::vector<pcl::PointIndices> cluster_indices;
    euclideanSegment(cone_cloud, cluster_indices);
    std::vector<int> inliers;
    for (std::vector<pcl::PointIndices>::const_iterator

it = cluster_indices.begin (); it != cluster_indices.end (); ++it) { PclCloudPtr temp_cloud (new PclCloud); pcl::PointCloud<pcl::normal>::Ptr cloud_normal (new pcl::PointCloud<pcl::normal>); pcl::PointCloud<pcl::pointnormal>::Ptr cloud_with_normals (new pcl::PointCloud<pcl::pointnormal>); extractSegmentCluster(cone_cloud, cluster_indices, 0, temp_cloud); estimateNormal(cone_cloud, cloud_normal); pcl::concatenateFields(temp_cloud, *cloud_normal, *cloud_with_normals); // cone model pcl::SampleConsensusModelCone<pcl::pointxyz,pcl::pointnormal>::Ptr model_cone (new pcl::SampleConsensusModelCone<pcl::pointxyz, pcl::pointnormal=""> (temp_cloud)); model_cone->setMinMaxOpeningAngle(BIG_CONE_ANGLE_-5, SMALL_CONE_ANGLE_+5); ROS_INFO_STREAM("pointcloud model cone received"); pcl::RandomSampleConsensus<pcl::pointxyz> ransac (model_cone); ransac.setDistanceThreshold (.1); ransac.computeModel(); ransac.getInliers(inliers);

        pcl::copyPointCloud (*temp_cloud, inliers, *final_cloud);

        sensor_msgs::PointCloud2 cluster_output;

cluster_output); cluster_output.header.frame_id = "velodyne"; pub_.publish(cluster_output); // ROS_INFO_STREAM("PointCloud representing the Cluster: " << cloud_cluster->points.size () << " data points."); }

else {
    ROS_INFO_STREAM("Cone Segmentation failed");


While I tried to run this. I got error that:

[pcl::SampleConsensusModelCone::computeModelCoefficients] No input dataset containing normals was given!

I tried to put point_cloud_with_normal as argument but it still doesn't work.

edit retag flag offensive close merge delete