#ifndef FAST_GICP_NDT_CUDA_IMPL_HPP #define FAST_GICP_NDT_CUDA_IMPL_HPP #include #include namespace fast_gicp { template NDTCuda::NDTCuda() : LsqRegistration() { this->reg_name_ = "NDTCuda"; ndt_cuda_.reset(new cuda::NDTCudaCore()); } template NDTCuda::~NDTCuda() {} template void NDTCuda::setDistanceMode(NDTDistanceMode mode) { ndt_cuda_->set_distance_mode(mode); } template void NDTCuda::setResolution(double resolution) { ndt_cuda_->set_resolution(resolution); } template void NDTCuda::setNeighborSearchMethod(NeighborSearchMethod method, double radius) { ndt_cuda_->set_neighbor_search_method(method, radius); } template void NDTCuda::swapSourceAndTarget() { ndt_cuda_->swap_source_and_target(); input_.swap(target_); } template void NDTCuda::clearSource() { input_.reset(); } template void NDTCuda::clearTarget() { target_.reset(); } template void NDTCuda::setInputSource(const PointCloudSourceConstPtr& cloud) { if (cloud == input_) { return; } pcl::Registration::setInputSource(cloud); std::vector> points(cloud->size()); std::transform(cloud->begin(), cloud->end(), points.begin(), [=](const PointSource& pt) { return pt.getVector3fMap(); }); ndt_cuda_->set_source_cloud(points); } template void NDTCuda::setInputTarget(const PointCloudTargetConstPtr& cloud) { if (cloud == target_) { return; } pcl::Registration::setInputTarget(cloud); std::vector> points(cloud->size()); std::transform(cloud->begin(), cloud->end(), points.begin(), [=](const PointTarget& pt) { return pt.getVector3fMap(); }); ndt_cuda_->set_target_cloud(points); } template void NDTCuda::computeTransformation(PointCloudSource& output, const Matrix4& guess) { ndt_cuda_->create_voxelmaps(); LsqRegistration::computeTransformation(output, guess); } template double NDTCuda::linearize(const Eigen::Isometry3d& trans, Eigen::Matrix* H, Eigen::Matrix* b) { ndt_cuda_->update_correspondences(trans); return ndt_cuda_->compute_error(trans, H, b); } template double NDTCuda::compute_error(const Eigen::Isometry3d& trans) { return ndt_cuda_->compute_error(trans, nullptr, nullptr); } } // namespace fast_gicp #endif