ubuntu20.04编译ntd_omp的问题
ROS2移植过程中也会出现,工作中遇见几次了,记录以下。
报错
需修改 gicp_omp.h 以下的代码:
typedef pcl::PointCloud<PointSource> PointCloudSource;
typedef typename PointCloudSource::Ptr PointCloudSourcePtr;
typedef typename PointCloudSource::ConstPtr PointCloudSourceConstPtr;
typedef pcl::PointCloud<PointTarget> PointCloudTarget;
typedef typename PointCloudTarget::Ptr PointCloudTargetPtr;
typedef typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr;
typedef pcl::PointIndices::Ptr PointIndicesPtr;
typedef pcl::PointIndices::ConstPtr PointIndicesConstPtr;
typedef std::vector< Eigen::Matrix3d, Eigen::aligned_allocator<Eigen::Matrix3d> > MatricesVector;
typedef boost::shared_ptr< MatricesVector > MatricesVectorPtr;
typedef boost::shared_ptr< const MatricesVector > MatricesVectorConstPtr;
typedef typename pcl::Registration<PointSource, PointTarget>::KdTree InputKdTree;
typedef typename pcl::Registration<PointSource, PointTarget>::KdTreePtr InputKdTreePtr;
typedef boost::shared_ptr< GeneralizedIterativeClosestPoint<PointSource, PointTarget> > Ptr;
typedef boost::shared_ptr< const GeneralizedIterativeClosestPoint<PointSource, PointTarget> > ConstPtr;
typedef Eigen::Matrix<double, 6, 1> Vector6d;
修改为
using PointCloudSource = pcl::PointCloud<PointSource>;
using PointCloudSourcePtr = typename PointCloudSource::Ptr;
using PointCloudSourceConstPtr = typename PointCloudSource::ConstPtr;
using PointCloudTarget = pcl::PointCloud<PointTarget>;
using PointCloudTargetPtr = typename PointCloudTarget::Ptr;
using PointCloudTargetConstPtr = typename PointCloudTarget::ConstPtr;
using PointIndicesPtr = pcl::PointIndices::Ptr;
using PointIndicesConstPtr = pcl::PointIndices::ConstPtr;
using MatricesVector = std::vector< Eigen::Matrix3d, Eigen::aligned_allocator<Eigen::Matrix3d> >;
using MatricesVectorPtr = boost::shared_ptr< MatricesVector >;
using MatricesVectorConstPtr = boost::shared_ptr< const MatricesVector >;
using InputKdTree = typename pcl::Registration<PointSource, PointTarget>::KdTree;
using InputKdTreePtr = typename pcl::Registration<PointSource, PointTarget>::KdTreePtr;
using Ptr = boost::shared_ptr< GeneralizedIterativeClosestPoint<PointSource, PointTarget> >;
using ConstPtr = boost::shared_ptr< const GeneralizedIterativeClosestPoint<PointSource, PointTarget> >;
using Vector6d = Eigen::Matrix<double, 6, 1>;
修改另一处代码:
rigid_transformation_estimation_ =
boost::bind (&GeneralizedIterativeClosestPoint<PointSource, PointTarget>::estimateRigidTransformationBFGS,
this, _1, _2, _3, _4, _5);
修改为:
rigid_transformation_estimation_ = [this](const PointCloudSource &cloud_src,
const std::vector<int> &indices_src,
const PointCloudTarget &cloud_tgt,
const std::vector<int> &indices_tgt,
Eigen::Matrix4f &transformation_matrix)
{
estimateRigidTransformationBFGS(cloud_src,indices_src,cloud_tgt,indices_tgt,transformation_matrix);
};
修改另一处代码:
boost::function<void(const pcl::PointCloud<PointSource> &cloud_src,
const std::vector<int> &src_indices,
const pcl::PointCloud<PointTarget> &cloud_tgt,
const std::vector<int> &tgt_indices,
Eigen::Matrix4f &transformation_matrix)> rigid_transformation_estimation_;
修改为:
std::function<void(const pcl::PointCloud<PointSource> &cloud_src,
const std::vector<int> &src_indices,
const pcl::PointCloud<PointTarget> &cloud_tgt,
const std::vector<int> &tgt_indices,
Eigen::Matrix4f &transformation_matrix)> rigid_transformation_estimation_;