22 #include "Eigen/Geometry" 30 #include "gtest/gtest.h" 34 namespace scan_matching {
37 class RealTimeCorrelativeScanMatcherTest :
public ::testing::Test {
39 RealTimeCorrelativeScanMatcherTest()
41 MapLimits(0.05,
Eigen::Vector2d(0.05, 0.25), CellLimits(6, 6))) {
45 "insert_free_space = true, " 46 "hit_probability = 0.7, " 47 "miss_probability = 0.4, " 50 common::make_unique<ProbabilityGridRangeDataInserter2D>(
52 parameter_dictionary.get()));
62 sensor::RangeData{Eigen::Vector3f::Zero(),
point_cloud_, {}},
68 "linear_search_window = 0.6, " 69 "angular_search_window = 0.16, " 70 "translation_delta_cost_weight = 0., " 71 "rotation_delta_cost_weight = 0., " 74 common::make_unique<RealTimeCorrelativeScanMatcher2D>(
76 parameter_dictionary.get()));
83 std::unique_ptr<RealTimeCorrelativeScanMatcher2D>
87 TEST_F(RealTimeCorrelativeScanMatcherTest,
88 ScorePerfectHighResolutionCandidate) {
89 const std::vector<sensor::PointCloud> scans =
93 std::vector<Candidate2D> candidates;
94 candidates.emplace_back(0, 0, 0, SearchParameters(0, 0, 0., 0.));
98 EXPECT_EQ(0, candidates[0].scan_index);
99 EXPECT_EQ(0, candidates[0].x_index_offset);
100 EXPECT_EQ(0, candidates[0].y_index_offset);
102 EXPECT_NEAR(0.7, candidates[0].score, 1e-2);
105 TEST_F(RealTimeCorrelativeScanMatcherTest,
106 ScorePartiallyCorrectHighResolutionCandidate) {
107 const std::vector<sensor::PointCloud> scans =
111 std::vector<Candidate2D> candidates;
112 candidates.emplace_back(0, 0, 1, SearchParameters(0, 0, 0., 0.));
116 EXPECT_EQ(0, candidates[0].scan_index);
117 EXPECT_EQ(0, candidates[0].x_index_offset);
118 EXPECT_EQ(1, candidates[0].y_index_offset);
120 EXPECT_LT(0.7 * 3. / 7., candidates[0].score);
121 EXPECT_GT(0.7, candidates[0].score);
std::vector< DiscreteScan2D > DiscretizeScans(const MapLimits &map_limits, const std::vector< sensor::PointCloud > &scans, const Eigen::Translation2f &initial_translation)
proto::ProbabilityGridRangeDataInserterOptions2D CreateProbabilityGridRangeDataInserterOptions2D(common::LuaParameterDictionary *parameter_dictionary)
std::unique_ptr< LuaParameterDictionary > MakeDictionary(const std::string &code)
sensor::PointCloud point_cloud_
std::vector< sensor::PointCloud > GenerateRotatedScans(const sensor::PointCloud &point_cloud, const SearchParameters &search_parameters)
std::vector< Eigen::Vector3f > PointCloud
std::unique_ptr< ProbabilityGridRangeDataInserter2D > range_data_inserter_
ProbabilityGrid probability_grid_
std::unique_ptr< RealTimeCorrelativeScanMatcher2D > real_time_correlative_scan_matcher_
proto::RealTimeCorrelativeScanMatcherOptions CreateRealTimeCorrelativeScanMatcherOptions(common::LuaParameterDictionary *const parameter_dictionary)