title: Surface Normal estimation with ROS using PCL
body: <p>I am trying to use PCL with ROS to estimated the surface normal of published point cloud form gazebo simulator; this is my callback function however, I got the following errors.  Could you please help..</p>
  
  <p>I followed the PCL tutorial for normal estimation and it works fine to me.</p>
  
  <pre><code>void     cloud_cb (const sensor_msgs::PointCloud2ConstPtr&amp; cloud_msg)
      { 
   // Container for original &amp; filtered data
   pcl::PCLPointCloud2* cloud = new pcl::PCLPointCloud2; 
   pcl::PCLPointCloud2ConstPtr cloudPtr(cloud);    
  //  pcl::PCLPointCloud2 cloud_filtered;
  
  
   // Convert to PCL data type
   pcl_conversions::toPCL(*cloud_msg, *cloud);
  
  
  
   // Create the normal estimation class, and pass the input dataset to 
   pcl::NormalEstimation&lt;pcl::PointXYZ, pcl::Normal&gt; ne;
   ne.setInputCloud (cloud);
  
  
  // Create an empty kdtree representation, and pass it to the normal  estimation object.
   // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
   pcl::search::KdTree&lt;pcl::PointXYZ&gt;::Ptr tree (new pcl::search::KdTree&lt;pcl::PointXYZ&gt; ());
   ne.setSearchMethod (tree);
  
   // Output datasets
   pcl::PointCloud&lt;pcl::Normal&gt;::Ptr cloud_normals (new pcl::PointCloud&lt;pcl::Normal&gt;);
  
   // Use all neighbors in a sphere of radius 3cm
   ne.setRadiusSearch (0.03);
  
   // Compute the features
   ne.compute (*cloud_normals);
  
  
   // cloud_normals-&gt;points.size () should have the same size as the input cloud-&gt;points.size ()*
   // visualize normals
   pcl::visualization::PCLVisualizer viewer("PCL Viewer");
   viewer.setBackgroundColor (0.0, 0.0, 0.5);
   viewer.addPointCloudNormals&lt;pcl::PointXYZ,pcl::Normal&gt;(cloud, cloud_normals);
  
   while (!viewer.wasStopped ())  // THE ORGINAL !viewer.wasStopped () 
           {
             viewer.spinOnce ();
           }
  
  
  
  
  
  
  
   // Convert to ROS data type
   sensor_msgs::PointCloud2 output;
   pcl_conversions::moveFromPCL(cloud, output);
  
  
  
  
  
   // Publish the data.
   pub.publish (output);    }
  </code></pre>
  
  <p>error: no matching function for call to ‘pcl::NormalEstimation::setInputCloud(pcl::PCLPointCloud2*&amp;)’
        ne.setInputCloud (cloud);</p>
  
  <p>error: no matching function for call to ‘pcl::visualization::PCLVisualizer::addPointCloudNormals(pcl::PCLPointCloud2*&amp;, pcl::PointCloud::Ptr&amp;)’
        viewer.addPointCloudNormals(cloud, cloud_normals);</p>
  
  <p>error: wrong number of template arguments (2, should be 1)
        viewer.addPointCloudNormals(cloud, cloud_normals);
                                                                                   ^</p>
  
  <p>error: no matching function for call to ‘moveFromPCL(pcl::PCLPointCloud2*&amp;, sensor_msgs::PointCloud2&amp;)’
        pcl_conversions::moveFromPCL(cloud, output);</p>