#ifndef FAST_GICP_FAST_GICP_MP_HPP #define FAST_GICP_FAST_GICP_MP_HPP #include #include #include #include #include #include #include namespace fast_gicp { template class FastGICPMultiPoints : public pcl::Registration { public: using Scalar = float; using Matrix4 = typename pcl::Registration::Matrix4; using PointCloudSource = typename pcl::Registration::PointCloudSource; using PointCloudSourcePtr = typename PointCloudSource::Ptr; using PointCloudSourceConstPtr = typename PointCloudSource::ConstPtr; using PointCloudTarget = typename pcl::Registration::PointCloudTarget; using PointCloudTargetPtr = typename PointCloudTarget::Ptr; using PointCloudTargetConstPtr = typename PointCloudTarget::ConstPtr; using pcl::Registration::reg_name_; using pcl::Registration::input_; using pcl::Registration::target_; using pcl::Registration::nr_iterations_; using pcl::Registration::max_iterations_; using pcl::Registration::final_transformation_; using pcl::Registration::transformation_epsilon_; using pcl::Registration::converged_; using pcl::Registration::corr_dist_threshold_; FastGICPMultiPoints(); virtual ~FastGICPMultiPoints() override; void setNumThreads(int n); void setRotationEpsilon(double eps); void setCorrespondenceRandomness(int k); void setRegularizationMethod(RegularizationMethod method); virtual void setInputSource(const PointCloudSourceConstPtr& cloud) override; virtual void setInputTarget(const PointCloudTargetConstPtr& cloud) override; protected: virtual void computeTransformation(PointCloudSource& output, const Matrix4& guess) override; private: bool is_converged(const Eigen::Matrix& delta) const; void update_correspondences(const Eigen::Matrix& x); Eigen::VectorXf loss_ls(const Eigen::Matrix& x, Eigen::MatrixXf* J) const; template bool calculate_covariances(const pcl::shared_ptr>& cloud, pcl::search::KdTree& kdtree, std::vector>& covariances); private: int num_threads_; int k_correspondences_; double rotation_epsilon_; double neighbor_search_radius_; RegularizationMethod regularization_method_; pcl::search::KdTree source_kdtree; pcl::search::KdTree target_kdtree; std::vector> source_covs; std::vector> target_covs; std::vector> correspondences; std::vector> sq_distances; }; } // namespace fast_gicp #endif