Main MRPT website > C++ reference for MRPT 1.9.9
TUserOptionsChecker.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef TUSEROPTIONSCHECKER_H
11 #define TUSEROPTIONSCHECKER_H
12 
13 #include <mrpt/system/filesystem.h>
14 #include <mrpt/core/exceptions.h>
18 
26 
27 #include <string>
28 #include <iostream>
29 #include <vector>
30 
31 namespace mrpt
32 {
33 namespace graphslam
34 {
35 namespace apps
36 {
37 /**\brief Properties struct for both the Registration Decider and Optimizer
38  * classes
39  */
41 {
43  : name(""),
44  description(""),
45  is_mr_slam_class(false),
46  is_slam_2d(
47  true), // by default the decider/optimizer is considered 2D
48  is_slam_3d(false)
49  {
50  }
52  /**\brief Name of the decider or optimizer class
53  */
55  /**\brief General description of the decicder or optimizer class*/
57  /**\brief Class indicating if the current decider/optimizer class can be
58  * used
59  * in a multi-robot SLAM operation
60  */
62  bool is_slam_2d;
63  bool is_slam_3d;
64 };
65 
66 /**\brief Properties struct for the Registration Decider classes.
67  *
68  * \ingroup mrpt_graphslam_grp
69  */
71 {
74  /**\brief Type of decider.
75  *
76  * Available options are:
77  * - node
78  * - edge
79  */
81  /**\brief Rawlog formats that the decider can be used in */
83  /**\brief Measurements that the current decider class can utilize */
84  std::vector<std::string> observations_used;
85 };
86 
87 /**\brief Properties struct for the Optimizer classes.
88  *
89  * \ingroup mrpt_graphslam_grp
90  */
92 {
95 };
96 
97 /**\brief Class containing the declarations of supplementary methods that can
98  * be used in application-related code.
99  * Class instance can be handy for adding keeping the available
100  * deciders/optimizers in a compact manner and for verifying whether a given
101  * decider can be used.
102  *
103  * \ingroup mrpt_graphslam_grp
104  */
105 template <class GRAPH_t>
107 {
108  /**\name handy typedefs for the creation of deciders/optimzer instances from
109  * the corresponding strings
110  */
111  /**\{*/
112  using constraint_t = typename GRAPH_t::constraint_t;
113  using pose_t = typename GRAPH_t::constraint_t::type_value;
114  using node_regs_t = std::map<
115  std::string,
117  using edge_regs_t = std::map<
118  std::string,
120  using optimizers_t = std::map<
121  std::string,
123 
124  /**\}*/
125 
126  //
127  // methods
128  //
129  /**\brief Constructor */
131  /**\brief Destructor */
132  virtual ~TUserOptionsChecker();
133  /**\brief Create the necessary mappings from strings to the corresponding
134  * instance creation functors.
135  *
136  * Method is used for populating a map from string to instance creation
137  * function. The decider/optimzer can then be spawned according to the user
138  * selection.
139  *
140  */
141  virtual void createDeciderOptimizerMappings();
142  virtual void _createDeciderOptimizerMappings();
143  /**\brief Populate the available decider, optimizer classes available in
144  * user applications
145  */
146  virtual void populateDeciderOptimizerProperties();
147  /**\brief Check if the given registrator decider exists in the vector of
148  * deciders.
149  * \param[in] given_reg String specifying the type of decider - This should
150  * either be "node" or "edge"
151  * \return True if it exists, false otherwise
152  */
153  virtual bool checkRegistrationDeciderExists(
154  std::string given_reg, std::string reg_type) const;
155 
156  /**\brief Check if the given optimizer exists in the vector of optimizers.
157  * \return True if it exists, false otherwise
158  */
159  virtual bool checkOptimizerExists(std::string given_opt) const;
160 
161  /**\brief Print the registration deciders vector in a formatted manner to
162  * the
163  * standard output
164  * \param[in] reg_type Method prints both the node registration
165  * and edge registration deciders of the given vector unless specified
166  * otherwise. The available argument options are "node", "edge", "all"
167  */
168  virtual void dumpRegistrarsToConsole(std::string reg_type = "all") const;
169  /**\brief Print the optimizers vector in a formatted manner to the standard
170  * output.
171  */
172  virtual void dumpOptimizersToConsole() const;
173 
174  /**\name Methods for initializing decider/optimizer instances based on the
175  * user
176  * command line choices - http://stackoverflow.com/a/582456/2843583
177  *
178  * \warning Caller is responsible for deleting the initialized instances
179  */
180  /**\{*/
181  template <class T>
184  {
185  return new T;
186  }
187  template <class T>
190  {
191  return new T;
192  }
193  template <class T>
196  {
197  return new T;
198  }
199  /**}*/
200 
201  /**\name Mappings from registration decider/optimizer names to functors
202  * for creating instances of the corresponding classes
203  */
204  /**\{*/
208  /**\}*/
209 
210  /**\name Vectors containing descriptions about the available
211  * deciders/optimizers.
212  *
213  * Handy for displaying information to the user (e.g. in help text)
214  */
215  /**\{*/
216  std::vector<TRegistrationDeciderProps*> regs_descriptions;
217  std::vector<TOptimizerProps*> optimizers_descriptions;
218  /**\}*/
219 
222 };
223 } // namespace apps
224 } // namespace graphslam
225 } // namespace mrpt
227 
228 #endif /* end of include guard: TUSEROPTIONSCHECKER_H */
Class containing the declarations of supplementary methods that can be used in application-related co...
virtual bool checkRegistrationDeciderExists(std::string given_reg, std::string reg_type) const
Check if the given registrator decider exists in the vector of deciders.
Properties struct for the Registration Decider classes.
std::vector< std::string > observations_used
Measurements that the current decider class can utilize.
bool is_mr_slam_class
Class indicating if the current decider/optimizer class can be used in a multi-robot SLAM operation...
std::map< std::string, mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_T > *(*)()> edge_regs_t
virtual void populateDeciderOptimizerProperties()
Populate the available decider, optimizer classes available in user applications. ...
static mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_t > * createEdgeRegistrationDecider()
static mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_t > * createGraphSlamOptimizer()
typename GRAPH_T ::constraint_t::type_value pose_t
std::string description
General description of the decicder or optimizer class.
GLsizei const GLchar ** string
Definition: glext.h:4101
std::map< std::string, mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_T > *(*)()> node_regs_t
static mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_t > * createNodeRegistrationDecider()
virtual void createDeciderOptimizerMappings()
Create the necessary mappings from strings to the corresponding instance creation functors...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Interface for implementing graphSLAM optimizer classes.
virtual void dumpRegistrarsToConsole(std::string reg_type="all") const
Print the registration deciders vector in a formatted manner to the standard output.
Properties struct for both the Registration Decider and Optimizer classes.
std::map< std::string, mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_T > *(*)()> optimizers_t
std::string name
Name of the decider or optimizer class.
Properties struct for the Optimizer classes.
GLuint const GLchar * name
Definition: glext.h:4054
virtual bool checkOptimizerExists(std::string given_opt) const
Check if the given optimizer exists in the vector of optimizers.
std::string rawlog_format
Rawlog formats that the decider can be used in.
std::vector< TOptimizerProps * > optimizers_descriptions
std::vector< TRegistrationDeciderProps * > regs_descriptions
GLuint GLuint GLsizei GLenum type
Definition: glext.h:3528
virtual void dumpOptimizersToConsole() const
Print the optimizers vector in a formatted manner to the standard output.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019