10 #include <gtest/gtest.h> 14 #include <test_mrpt_common.h> 18 using post_tester_t = std::function<void(mrpt::apps::ICP_SLAM_App_Base&)>;
20 template <
class SLAM_CLASS>
22 const std::string& ini_filename,
const std::string& rawlog_filename,
27 const auto ini_fil = mrpt::UNITTEST_BASEDIR +
28 "/share/mrpt/config_files/icp-slam/"s + ini_filename;
31 const auto rawlog_fil =
32 mrpt::UNITTEST_BASEDIR +
"/share/mrpt/datasets/"s + rawlog_filename;
40 const char*
argv[] = {
"icp-slam",
ini_fil.c_str(), rawlog_fil.c_str()};
46 "MappingApplication",
"logOutput_dir",
49 "MappingApplication",
"SHOW_PROGRESS_3D_REAL_TIME",
false);
52 app.params.write(
"MappingApplication",
"SAVE_3D_SCENE",
false);
53 app.params.write(
"MappingApplication",
"LOG_FREQUENCY", 0);
56 cfg_changer(app.params);
62 catch (
const std::exception& e)
70 EXPECT_EQ(o.out_estimated_path.size(), 224U);
73 "[3.4548 -18.0399 0.000000 -86.48 0.000000 0.000000]");
76 <<
"actual pose =" << p.asString()
77 <<
"\nexpected pose=" << p_gt.
asString();
80 TEST(ICP_SLAM_App, MapFromRawlog_PointMap)
84 generic_icp_slam_test<mrpt::apps::ICP_SLAM_App_Rawlog>(
85 "icp-slam_demo_classic.ini",
86 "2006-01ENE-21-SENA_Telecom Faculty_one_loop_only.rawlog",
90 TEST(ICP_SLAM_App, MapFromRawlog_Grid)
94 generic_icp_slam_test<mrpt::apps::ICP_SLAM_App_Rawlog>(
95 "icp-slam_demo_classic_gridmatch.ini",
96 "2006-01ENE-21-SENA_Telecom Faculty_one_loop_only.rawlog",
100 TEST(ICP_SLAM_App, MapFromRawlog_LM)
104 generic_icp_slam_test<mrpt::apps::ICP_SLAM_App_Rawlog>(
105 "icp-slam_demo_LM.ini",
106 "2006-01ENE-21-SENA_Telecom Faculty_one_loop_only.rawlog",
EXPECT_LT(out.final_rmse, 3.0)
EXPECT_TRUE(mrpt::system::fileExists(ini_fil))
static CPose3D FromString(const std::string &s)
std::function< void(mrpt::apps::ICP_SLAM_App_Base &)> post_tester_t
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
ICP-SLAM virtual base class for application wrappers.
TEST(ICP_SLAM_App, MapFromRawlog_PointMap)
This class allows loading and storing values and vectors of different types from a configuration text...
std::string getTempFileName()
Returns the name of a proposed temporary file name.
const std::string ini_fil
Traits for SE(n), rigid-body transformations in R^n space.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]"...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
static auto tester_for_2006_01_21
std::function< void(mrpt::config::CConfigFileBase &)> config_changer_t
void generic_icp_slam_test(const std::string &ini_filename, const std::string &rawlog_filename, config_changer_t cfg_changer, post_tester_t post_tester)
CONTAINER::Scalar norm(const CONTAINER &v)