10 #include <gtest/gtest.h> 14 #include <test_mrpt_common.h> 19 std::function<void(mrpt::apps::MonteCarloLocalization_Base&)>;
24 const std::string& ini_filename,
const std::string& rawlog_filename,
30 const auto ini_fil = mrpt::UNITTEST_BASEDIR +
31 "/share/mrpt/config_files/pf-localization/"s +
35 const auto rawlog_fil =
36 mrpt::UNITTEST_BASEDIR +
"/share/mrpt/datasets/"s + rawlog_filename;
40 mrpt::UNITTEST_BASEDIR +
"/share/mrpt/datasets/"s + map_filename;
48 const char*
argv[] = {
"pf-localization-slam",
ini_fil.c_str(),
75 catch (
const std::exception& e)
86 EXPECT_EQ(o.out_estimated_path.size(), 37U);
87 if (o.out_estimated_path.empty())
return;
91 "[15.89 -10.0 0.000000 4.8 0.000000 0.000000]");
103 std::cerr <<
"Final pose mismatch (will retry N times):\n" 112 TEST(MonteCarloLocalization_Rawlog, RunForSampleDataset_2D)
115 for (
int tries = 0; tries < 5; tries++)
118 "localization_demo.ini",
"localization_demo.rawlog",
119 "localization_demo.simplemap.gz",
130 TEST(MonteCarloLocalization_Rawlog, RunForSampleDataset_3D)
133 for (
int tries = 0; tries < 5; tries++)
136 "localization_demo.ini",
"localization_demo.rawlog",
137 "localization_demo.simplemap.gz",
mrpt::config::CConfigFileMemory params
Populated in initialize().
void run()
Runs with the current parameter set.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]"...
bool allow_quit_on_esc_key
If true, will watch the keyboard and quit when ESC is pushed.
std::function< void(mrpt::apps::ICP_SLAM_App_Base &)> post_tester_t
void setMinLoggingLevel(const VerbosityLevel level)
Set the minimum logging level for which the incoming logs are going to be taken into account...
bool fill_out_estimated_path
Whether to populate out_estimated_path.
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.
MonteCarlo (Particle filter) localization wrapper class, reading from a rawlog dataset.
void initialize(int argc, const char **argv)
Initializes the application from CLI parameters.
const std::string ini_fil
void generic_pf_test(const std::string &ini_filename, const std::string &rawlog_filename, const std::string &map_filename, config_changer_t cfg_changer, post_tester_t post_tester)
static bool tester_result_ok
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
Traits for SE(n), rigid-body transformations in R^n space.
static TPose3D FromString(const std::string &s)
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)
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
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...
MonteCarlo (Particle filter) localization wrapper class for CLI or custom applications: virtual base ...
#define ASSERT_FILE_EXISTS_(FIL)
static constexpr auto sect
Default name of the main configuration section in INI files for this app.
std::function< void(mrpt::config::CConfigFileBase &)> config_changer_t
TEST(MonteCarloLocalization_Rawlog, RunForSampleDataset_2D)
static auto tester_for_localization_demo