MRPT  2.0.3
MonteCarloLocalization_App.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
18 
19 namespace mrpt::apps
20 {
21 /** MonteCarlo (Particle filter) localization wrapper class for CLI or custom
22  * applications: virtual base class, which can be used as base for custom
23  * user robotic applications.
24  *
25  * \ingroup mrpt_apps_grp
26  */
29  virtual public mrpt::apps::BaseAppDataSource
30 {
31  public:
33 
34  /** Default name of the main configuration section in INI files for this app
35  */
36  constexpr static auto sect = "LocalizationExperiment";
37 
38  /** @name Main API
39  * @{ */
40 
41  /** Initializes the application from CLI parameters. Refer to the manpage of
42  * pf-localization. Throws on errors.
43  */
44  void initialize(int argc, const char** argv);
45 
46  inline void initialize(int argc, char** argv)
47  {
48  initialize(argc, const_cast<const char**>(argv));
49  }
50 
51  /** Runs with the current parameter set. Throws on errors. */
52  void run();
53 
54  /** @} */
55 
56  /** @name Parameters and options. See: initialize()
57  * @{ */
58 
59  /** Populated in initialize(). Can be replaced or manipulated by the user
60  * after that and before run() to change the parameters loaded from INI
61  * file. */
63 
64  /** If true, will watch the keyboard and quit when ESC is pushed. */
65  bool allow_quit_on_esc_key = true;
66 
67  /** Whether to populate out_estimated_path */
69 
70  /** @} */
71 
72  /** @name Outputs and result variables
73  * @{ */
74 
75  /** Controlled by flag `fill_out_estimated_path` */
77 
78  /** @} */
79 
80  protected:
81  template <class MONTECARLO_TYPE>
82  void do_pf_localization();
83 
84  void getGroundTruth(
85  mrpt::poses::CPose2D& expectedPose, size_t rawlogEntry,
86  const mrpt::math::CMatrixDouble& GT, const Clock::time_point& cur_time);
87  void prepareGT(const mrpt::math::CMatrixDouble& GT);
88 
90 };
91 
92 /** MonteCarlo (Particle filter) localization wrapper class, reading from a
93  * rawlog dataset.
94  *
95  * \ingroup mrpt_apps_grp
96  */
98  public DataSourceRawlog
99 {
100  public:
102 
103  protected:
104  void impl_initialize(int argc, const char** argv) override;
105  std::string impl_get_usage() const override
106  {
107  return "pf-localization <config_file> [dataset.rawlog]";
108  }
109 };
110 
111 } // namespace mrpt::apps
mrpt::apps::MonteCarloLocalization_Base::GT_path
mrpt::poses::CPose2DInterpolator GT_path
Definition: MonteCarloLocalization_App.h:89
mrpt::apps::MonteCarloLocalization_Base::out_estimated_path
mrpt::poses::CPose3DInterpolator out_estimated_path
Controlled by flag fill_out_estimated_path
Definition: MonteCarloLocalization_App.h:76
mrpt::apps::DataSourceRawlog
Implementation of BaseAppDataSource for reading from a rawlog file.
Definition: DataSourceRawlog.h:22
CConfigFileMemory.h
mrpt::apps::MonteCarloLocalization_Base::initialize
void initialize(int argc, const char **argv)
Initializes the application from CLI parameters.
Definition: MonteCarloLocalization_App.cpp:63
mrpt::apps::MonteCarloLocalization_Base::getGroundTruth
void getGroundTruth(mrpt::poses::CPose2D &expectedPose, size_t rawlogEntry, const mrpt::math::CMatrixDouble &GT, const Clock::time_point &cur_time)
Definition: MonteCarloLocalization_App.cpp:1151
mrpt::apps::MonteCarloLocalization_Base::allow_quit_on_esc_key
bool allow_quit_on_esc_key
If true, will watch the keyboard and quit when ESC is pushed.
Definition: MonteCarloLocalization_App.h:65
CPose2DInterpolator.h
mrpt::apps::MonteCarloLocalization_Base
MonteCarlo (Particle filter) localization wrapper class for CLI or custom applications: virtual base ...
Definition: MonteCarloLocalization_App.h:27
mrpt::apps::MonteCarloLocalization_Base::fill_out_estimated_path
bool fill_out_estimated_path
Whether to populate out_estimated_path.
Definition: MonteCarloLocalization_App.h:68
mrpt::apps::MonteCarloLocalization_Base::do_pf_localization
void do_pf_localization()
Definition: MonteCarloLocalization_App.cpp:165
BaseAppDataSource.h
mrpt::apps::BaseAppDataSource
Virtual interface for offline datasets (rawlog) or live sensors.
Definition: BaseAppDataSource.h:21
CPose3DInterpolator.h
mrpt::apps::MonteCarloLocalization_Rawlog::impl_get_usage
std::string impl_get_usage() const override
Definition: MonteCarloLocalization_App.h:105
mrpt::poses::CPose3DInterpolator
This class stores a time-stamped trajectory in SE(3) (CPose3D poses).
Definition: CPose3DInterpolator.h:47
mrpt::apps::MonteCarloLocalization_Base::prepareGT
void prepareGT(const mrpt::math::CMatrixDouble &GT)
Definition: MonteCarloLocalization_App.cpp:1222
mrpt::apps::MonteCarloLocalization_Base::initialize
void initialize(int argc, char **argv)
Definition: MonteCarloLocalization_App.h:46
mrpt::apps::MonteCarloLocalization_Rawlog
MonteCarlo (Particle filter) localization wrapper class, reading from a rawlog dataset.
Definition: MonteCarloLocalization_App.h:97
COutputLogger.h
mrpt::apps::MonteCarloLocalization_Base::run
void run()
Runs with the current parameter set.
Definition: MonteCarloLocalization_App.cpp:1257
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:39
mrpt::apps
Definition: BaseAppDataSource.h:15
mrpt::apps::MonteCarloLocalization_Base::MonteCarloLocalization_Base
MonteCarloLocalization_Base()
Definition: MonteCarloLocalization_App.cpp:57
argv
const char * argv[]
Definition: RawlogGrabberApp_unittest.cpp:40
mrpt::poses::CPose2DInterpolator
This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses).
Definition: CPose2DInterpolator.h:48
mrpt::apps::MonteCarloLocalization_Base::sect
constexpr static auto sect
Default name of the main configuration section in INI files for this app.
Definition: MonteCarloLocalization_App.h:36
mrpt::Clock::time_point
std::chrono::time_point< Clock > time_point
Definition: Clock.h:25
mrpt::system::COutputLogger
Versatile class for consistent logging and management of output messages.
Definition: system/COutputLogger.h:117
BaseAppInitializableCLI.h
argc
const int argc
Definition: RawlogGrabberApp_unittest.cpp:41
mrpt::apps::MonteCarloLocalization_Rawlog::MonteCarloLocalization_Rawlog
MonteCarloLocalization_Rawlog()
Definition: MonteCarloLocalization_App.cpp:1281
mrpt::apps::MonteCarloLocalization_Rawlog::impl_initialize
void impl_initialize(int argc, const char **argv) override
Definition: MonteCarloLocalization_App.cpp:1286
DataSourceRawlog.h
mrpt::apps::BaseAppInitializableCLI
Virtual interface for applications that initialize from CLI parameters.
Definition: BaseAppInitializableCLI.h:19
mrpt::config::CConfigFileMemory
This class implements a config file-like interface over a memory-stored string list.
Definition: config/CConfigFileMemory.h:36
mrpt::apps::MonteCarloLocalization_Base::params
mrpt::config::CConfigFileMemory params
Populated in initialize().
Definition: MonteCarloLocalization_App.h:62
mrpt::math::CMatrixDynamic< double >



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020