Main MRPT website > C++ reference for MRPT 1.5.6
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-2017, 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/utils/mrpt_macros.h>
18 
27 
28 #include <string>
29 #include <iostream>
30 #include <vector>
31 
32 namespace mrpt { namespace graphslam { namespace apps {
33 
34 /**\brief Properties struct for both the Registration Decider and Optimizer
35  * classes
36  */
39  name(""),
40  description(""),
41  is_mr_slam_class(false),
42  is_slam_2d(true), // by default the decider/optimizer is considered 2D
43  is_slam_3d(false) {}
45 
46  /**\brief Name of the decider or optimizer class
47  */
49  /**\brief General description of the decicder or optimizer class*/
51  /**\brief Class indicating if the current decider/optimizer class can be used
52  * in a multi-robot SLAM operation
53  */
55  bool is_slam_2d;
56  bool is_slam_3d;
57 
58 };
59 
60 /**\brief Properties struct for the Registration Decider classes.
61  *
62  * \ingroup mrpt_graphslam_grp
63  */
66 {
68  type(""),
69  rawlog_format("") {}
71 
72  /**\brief Type of decider.
73  *
74  * Available options are:
75  * - node
76  * - edge
77  */
79  /**\brief Rawlog formats that the decider can be used in */
81  /**\brief Measurements that the current decider class can utilize */
82  std::vector<std::string> observations_used;
83 };
84 
85 /**\brief Properties struct for the Optimizer classes.
86  *
87  * \ingroup mrpt_graphslam_grp
88  */
91 {
94 };
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  /**\name handy typedefs for the creation of deciders/optimzer instances from
108  * the corresponding strings
109  */
110  /**\{*/
111  typedef typename GRAPH_t::constraint_t constraint_t;
112  typedef typename GRAPH_t::constraint_t::type_value pose_t;
113  typedef std::map<
114  std::string,
116  typedef std::map<
117  std::string,
119  typedef std::map<
120  std::string,
122 
123  /**\}*/
124 
125  //
126  // methods
127  //
128  /**\brief Constructor */
130  /**\brief Destructor */
131  virtual ~TUserOptionsChecker();
132  /**\brief Create the necessary mappings from strings to the corresponding
133  * instance creation functors.
134  *
135  * Method is used for populating a map from string to instance creation
136  * function. The decider/optimzer can then be spawned according to the user
137  * selection.
138  *
139  */
140  virtual void createDeciderOptimizerMappings();
141  virtual void _createDeciderOptimizerMappings();
142  /**\brief Populate the available decider, optimizer classes available in
143  * user applications
144  */
145  virtual void populateDeciderOptimizerProperties();
146  /**\brief Check if the given registrator decider exists in the vector of
147  * deciders.
148  * \param[in] given_reg String specifying the type of decider - This should
149  * either be "node" or "edge"
150  * \return True if it exists, false otherwise
151  */
152  virtual bool checkRegistrationDeciderExists(
153  std::string given_reg,
154  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(
160  std::string given_opt) const;
161 
162  /**\brief Print the registration deciders vector in a formatted manner to 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 user
175  * command line choices - http://stackoverflow.com/a/582456/2843583
176  *
177  * \warning Caller is responsible for deleting the initialized instances
178  */
179  /**\{*/
180  template<class T>
183  return new T;
184  }
185  template<class T>
188  return new T;
189  }
190  template<class T>
193  return new T;
194  }
195  /**}*/
196 
197  /**\name Mappings from registration decider/optimizer names to functors
198  * for creating instances of the corresponding classes
199  */
200  /**\{*/
204  /**\}*/
205 
206  /**\name Vectors containing descriptions about the available
207  * deciders/optimizers.
208  *
209  * Handy for displaying information to the user (e.g. in help text)
210  */
211  /**\{*/
212  std::vector<TRegistrationDeciderProps*> regs_descriptions;
213  std::vector<TOptimizerProps*> optimizers_descriptions;
214  /**\}*/
215 
218 
219 };
220 
221 
222 } } } // END OF NAMESPACES
224 
225 #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...
virtual void populateDeciderOptimizerProperties()
Populate the available decider, optimizer classes available in user applications. ...
std::map< std::string, mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_T > *(*)()> edge_regs_t
std::map< std::string, mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_T > *(*)()> node_regs_t
static mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_t > * createEdgeRegistrationDecider()
static mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_t > * createGraphSlamOptimizer()
std::string description
General description of the decicder or optimizer class.
GLsizei const GLchar ** string
Definition: glext.h:3919
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.
GRAPH_t::constraint_t::type_value pose_t
std::string name
Name of the decider or optimizer class.
Properties struct for the Optimizer classes.
GLuint const GLchar * name
Definition: glext.h:3891
std::map< std::string, mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_T > *(*)()> optimizers_t
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:3512
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.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019