16 #include <mrpt/containers/yaml.h>
17 #include <mrpt/core/exceptions.h>
18 #include <mrpt/maps/CSimplePointsMap.h>
22 int main([[maybe_unused]]
int argc, [[maybe_unused]]
char** argv)
28 const auto inFile =
std::string(
"happy_buddha_decim.xyz.gz");
31 mrpt::maps::CSimplePointsMap::Ptr pts =
34 mrpt::containers::yaml params;
36 params[
"ncols"] = 100;
44 params[
"sigma"] = 0.1;
52 const auto viewPose = mrpt::poses::CPose3D(-0.2, 0, 0, 0, 0, 0);
53 pts->changeCoordinatesReference(viewPose);
58 std::tuple<mrpt::poses::CPose3D, mrpt::poses::CPose3D, double>>
61 {{.0, .0, .0, .0, .0, .0}, {.0, .0, .0, .0, .0, .0}, 1.0},
63 {{1.0, 1.0, .0, .0, .0, .0}, {1.0, 1.0, .0, .0, .0, .0}, 1.0},
65 {{.1, .1, .2, .0, .0, .0}, {.101, .1, .2, .0, .0, .0}, 0.93},
69 for (
const auto& p : testPairs)
71 const mrpt::poses::CPose3D& relPoseGT = std::get<0>(p);
72 const mrpt::poses::CPose3D& relPoseTest = std::get<1>(p);
73 const double expectedVal = std::get<2>(p);
75 auto p1 = mrpt::maps::CSimplePointsMap::Create();
76 p1->insertAnotherMap(pts.get(), mrpt::poses::CPose3D::Identity());
78 auto p2 = mrpt::maps::CSimplePointsMap::Create();
79 p2->insertAnotherMap(pts.get(), relPoseGT);
87 const auto res =
q.evaluate(pcG, pcL, relPoseTest, {});
88 const double quality =
res.quality;
90 if (std::abs(quality - expectedVal) > 0.1)
92 std::cerr <<
"Failed for test case:\n"
93 <<
" relPoseGT : " << relPoseGT <<
"\n"
94 <<
" relPoseTest : " << relPoseTest <<
"\n"
95 <<
" expectedVal : " << expectedVal <<
"\n"
96 <<
" quality : " << quality <<
"\n";
98 throw std::runtime_error(
"test failed (see cerr above)");
102 catch (std::exception& e)
104 std::cerr << mrpt::exception_to_str(e) <<
"\n";