MRPT  2.0.1
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
This class implements a config file-like interface over a memory-stored string list.
Virtual interface for applications that initialize from CLI parameters.
void prepareGT(const mrpt::math::CMatrixDouble &GT)
This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses). ...
mrpt::config::CConfigFileMemory params
Populated in initialize().
void run()
Runs with the current parameter set.
std::chrono::time_point< Clock > time_point
Definition: Clock.h:25
bool allow_quit_on_esc_key
If true, will watch the keyboard and quit when ESC is pushed.
bool fill_out_estimated_path
Whether to populate out_estimated_path.
mrpt::poses::CPose3DInterpolator out_estimated_path
Controlled by flag fill_out_estimated_path
Versatile class for consistent logging and management of output messages.
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 char * argv[]
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:39
Implementation of BaseAppDataSource for reading from a rawlog file.
This class stores a time-stamped trajectory in SE(3) (CPose3D poses).
MonteCarlo (Particle filter) localization wrapper class for CLI or custom applications: virtual base ...
const int argc
void impl_initialize(int argc, const char **argv) override
static constexpr auto sect
Default name of the main configuration section in INI files for this app.
Virtual interface for offline datasets (rawlog) or live sensors.
void getGroundTruth(mrpt::poses::CPose2D &expectedPose, size_t rawlogEntry, const mrpt::math::CMatrixDouble &GT, const Clock::time_point &cur_time)



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020