mirror of https://github.com/koide3/small_gicp.git
RegistrationPCL test
This commit is contained in:
parent
98a8ee34e6
commit
b69ea8fdc1
|
|
@ -64,7 +64,7 @@ if(BUILD_BENCHMARKS)
|
|||
add_compile_definitions(BUILD_WITH_TBB)
|
||||
endif()
|
||||
if (BUILD_WITH_PCL)
|
||||
find_package(PCL REQUIRED COMPONENTS registration)
|
||||
find_package(PCL REQUIRED)
|
||||
add_compile_definitions(BUILD_WITH_PCL)
|
||||
endif()
|
||||
if (BUILD_WITH_IRIDESCENCE)
|
||||
|
|
@ -171,7 +171,7 @@ endif()
|
|||
##########
|
||||
if(BUILD_TESTS)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(PCL REQUIRED COMPONENTS registration)
|
||||
find_package(PCL REQUIRED)
|
||||
find_package(TBB REQUIRED)
|
||||
|
||||
include(FetchContent)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <pcl/impl/pcl_base.hpp>
|
||||
#include <pcl/search/impl/search.hpp>
|
||||
#include <pcl/search/impl/kdtree.hpp>
|
||||
#include <pcl/search/impl/flann_search.hpp>
|
||||
#include <pcl/registration/impl/registration.hpp>
|
||||
|
||||
#include <small_gicp/pcl/pcl_registration.hpp>
|
||||
|
||||
#include <small_gicp/pcl/pcl_proxy.hpp>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <small_gicp/util/normal_estimation_omp.hpp>
|
||||
#include <small_gicp/pcl/pcl_point.hpp>
|
||||
#include <small_gicp/pcl/pcl_point_traits.hpp>
|
||||
#include <small_gicp/pcl/pcl_registration.hpp>
|
||||
#include <small_gicp/pcl/pcl_registration_impl.hpp>
|
||||
#include <small_gicp/points/point_cloud.hpp>
|
||||
|
||||
#include <small_gicp/factors/icp_factor.hpp>
|
||||
|
|
@ -173,6 +175,41 @@ TEST_F(RegistrationTest, LoadCheck) {
|
|||
EXPECT_FALSE(source_pcl->empty());
|
||||
}
|
||||
|
||||
// PCL interface test
|
||||
TEST_F(RegistrationTest, PCLInterfaceTest) {
|
||||
RegistrationPCL<pcl::PointNormalCovariance, pcl::PointNormalCovariance> registration;
|
||||
registration.setRegistrationType("GICP");
|
||||
registration.setMaxCorrespondenceDistance(1.0);
|
||||
|
||||
// Forward align
|
||||
registration.setInputTarget(target_pcl);
|
||||
registration.setInputSource(source_pcl);
|
||||
|
||||
pcl::PointCloud<pcl::PointNormalCovariance> aligned;
|
||||
registration.align(aligned);
|
||||
|
||||
EXPECT_EQ(aligned.size(), source_pcl->size());
|
||||
EXPECT_TRUE(compare_transformation(T_target_source, Eigen::Isometry3d(registration.getFinalTransformation().cast<double>())));
|
||||
|
||||
// Swap and backward align
|
||||
registration.swapSourceAndTarget();
|
||||
registration.align(aligned);
|
||||
|
||||
EXPECT_EQ(aligned.size(), target_pcl->size());
|
||||
EXPECT_TRUE(compare_transformation(T_target_source.inverse(), Eigen::Isometry3d(registration.getFinalTransformation().cast<double>())));
|
||||
|
||||
// Clear and forward align
|
||||
registration.clearTarget();
|
||||
registration.clearSource();
|
||||
|
||||
registration.setInputTarget(target_pcl);
|
||||
registration.setInputSource(source_pcl);
|
||||
registration.align(aligned);
|
||||
|
||||
EXPECT_EQ(aligned.size(), source_pcl->size());
|
||||
EXPECT_TRUE(compare_transformation(T_target_source, Eigen::Isometry3d(registration.getFinalTransformation().cast<double>())));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
RegistrationTest,
|
||||
RegistrationTest,
|
||||
|
|
|
|||
Loading…
Reference in New Issue