【发布时间】:2019-10-20 22:40:39
【问题描述】:
我正在尝试使用带有 ROS 的 PCL 来估计已发布的点云形式凉亭模拟器的表面法线;这是我的回调函数,但是,我收到了以下错误。你能帮忙吗..
我按照 PCL 教程进行正常估计,它对我来说很好。
void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud_msg)
{
// Container for original & 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<pcl::PointXYZ, pcl::Normal> 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<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
ne.setSearchMethod (tree);
// Output datasets
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);
// Use all neighbors in a sphere of radius 3cm
ne.setRadiusSearch (0.03);
// Compute the features
ne.compute (*cloud_normals);
// cloud_normals->points.size () should have the same size as the input cloud->points.size ()*
// visualize normals
pcl::visualization::PCLVisualizer viewer("PCL Viewer");
viewer.setBackgroundColor (0.0, 0.0, 0.5);
viewer.addPointCloudNormals<pcl::PointXYZ,pcl::Normal>(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); }
错误:没有匹配函数调用‘pcl::NormalEstimation::setInputCloud(pcl::PCLPointCloud2*&)’ ne.setInputCloud (云);
错误:没有匹配函数调用‘pcl::visualization::PCLVisualizer::addPointCloudNormals(pcl::PCLPointCloud2*&, pcl::PointCloud::Ptr&)’ viewer.addPointCloudNormals(cloud, cloud_normals);
错误:模板参数的数量错误(2,应该是 1) viewer.addPointCloudNormals(云,cloud_normals); ^
错误:没有匹配函数调用‘moveFromPCL(pcl::PCLPointCloud2*&, sensor_msgs::PointCloud2&)’ pcl_conversions::moveFromPCL(云,输出);
【问题讨论】:
-
我已经很久没有使用ROS了,但是我认为您也应该向the ROS community咨询有关ROS的问题。