ndt_cuda.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef FAST_GICP_NDT_CUDA_HPP
  2. #define FAST_GICP_NDT_CUDA_HPP
  3. #include <Eigen/Core>
  4. #include <Eigen/Geometry>
  5. #include <pcl/point_types.h>
  6. #include <pcl/point_cloud.h>
  7. #include <pcl/search/kdtree.h>
  8. #include <pcl/registration/registration.h>
  9. #include <fast_gicp/gicp/lsq_registration.hpp>
  10. #include <fast_gicp/gicp/gicp_settings.hpp>
  11. #include <fast_gicp/ndt/ndt_settings.hpp>
  12. namespace fast_gicp {
  13. namespace cuda {
  14. class NDTCudaCore;
  15. }
  16. template <typename PointSource, typename PointTarget>
  17. class NDTCuda : public LsqRegistration<PointSource, PointTarget> {
  18. public:
  19. using Scalar = float;
  20. using Matrix4 = typename pcl::Registration<PointSource, PointTarget, Scalar>::Matrix4;
  21. using PointCloudSource = typename pcl::Registration<PointSource, PointTarget, Scalar>::PointCloudSource;
  22. using PointCloudSourcePtr = typename PointCloudSource::Ptr;
  23. using PointCloudSourceConstPtr = typename PointCloudSource::ConstPtr;
  24. using PointCloudTarget = typename pcl::Registration<PointSource, PointTarget, Scalar>::PointCloudTarget;
  25. using PointCloudTargetPtr = typename PointCloudTarget::Ptr;
  26. using PointCloudTargetConstPtr = typename PointCloudTarget::ConstPtr;
  27. protected:
  28. using pcl::Registration<PointSource, PointTarget, Scalar>::reg_name_;
  29. using pcl::Registration<PointSource, PointTarget, Scalar>::input_;
  30. using pcl::Registration<PointSource, PointTarget, Scalar>::target_;
  31. using pcl::Registration<PointSource, PointTarget, Scalar>::corr_dist_threshold_;
  32. public:
  33. NDTCuda();
  34. virtual ~NDTCuda() override;
  35. void setDistanceMode(NDTDistanceMode mode);
  36. void setResolution(double resolution);
  37. void setNeighborSearchMethod(NeighborSearchMethod method, double radius = -1.0);
  38. virtual void swapSourceAndTarget() override;
  39. virtual void clearSource() override;
  40. virtual void clearTarget() override;
  41. virtual void setInputSource(const PointCloudSourceConstPtr& cloud) override;
  42. virtual void setInputTarget(const PointCloudTargetConstPtr& cloud) override;
  43. protected:
  44. virtual void computeTransformation(PointCloudSource& output, const Matrix4& guess) override;
  45. virtual double linearize(const Eigen::Isometry3d& trans, Eigen::Matrix<double, 6, 6>* H, Eigen::Matrix<double, 6, 1>* b) override;
  46. virtual double compute_error(const Eigen::Isometry3d& trans) override;
  47. protected:
  48. std::unique_ptr<cuda::NDTCudaCore> ndt_cuda_;
  49. };
  50. } // namespace fast_gicp
  51. #endif