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-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 
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  typedef typename GRAPH_t::constraint_t constraint_t;
113  typedef typename GRAPH_t::constraint_t::type_value pose_t;
114  typedef std::map<
115  std::string,
118  typedef std::map<
119  std::string,
122  typedef std::map<
123  std::string,
126 
127  /**\}*/
128 
129  //
130  // methods
131  //
132  /**\brief Constructor */
134  /**\brief Destructor */
135  virtual ~TUserOptionsChecker();
136  /**\brief Create the necessary mappings from strings to the corresponding
137  * instance creation functors.
138  *
139  * Method is used for populating a map from string to instance creation
140  * function. The decider/optimzer can then be spawned according to the user
141  * selection.
142  *
143  */
144  virtual void createDeciderOptimizerMappings();
145  virtual void _createDeciderOptimizerMappings();
146  /**\brief Populate the available decider, optimizer classes available in
147  * user applications
148  */
149  virtual void populateDeciderOptimizerProperties();
150  /**\brief Check if the given registrator decider exists in the vector of
151  * deciders.
152  * \param[in] given_reg String specifying the type of decider - This should
153  * either be "node" or "edge"
154  * \return True if it exists, false otherwise
155  */
156  virtual bool checkRegistrationDeciderExists(
157  std::string given_reg, std::string reg_type) const;
158 
159  /**\brief Check if the given optimizer exists in the vector of optimizers.
160  * \return True if it exists, false otherwise
161  */
162  virtual bool checkOptimizerExists(std::string given_opt) const;
163 
164  /**\brief Print the registration deciders vector in a formatted manner to
165  * the
166  * standard output
167  * \param[in] reg_type Method prints both the node registration
168  * and edge registration deciders of the given vector unless specified
169  * otherwise. The available argument options are "node", "edge", "all"
170  */
171  virtual void dumpRegistrarsToConsole(std::string reg_type = "all") const;
172  /**\brief Print the optimizers vector in a formatted manner to the standard
173  * output.
174  */
175  virtual void dumpOptimizersToConsole() const;
176 
177  /**\name Methods for initializing decider/optimizer instances based on the
178  * user
179  * command line choices - http://stackoverflow.com/a/582456/2843583
180  *
181  * \warning Caller is responsible for deleting the initialized instances
182  */
183  /**\{*/
184  template <class T>
187  {
188  return new T;
189  }
190  template <class T>
193  {
194  return new T;
195  }
196  template <class T>
199  {
200  return new T;
201  }
202  /**}*/
203 
204  /**\name Mappings from registration decider/optimizer names to functors
205  * for creating instances of the corresponding classes
206  */
207  /**\{*/
211  /**\}*/
212 
213  /**\name Vectors containing descriptions about the available
214  * deciders/optimizers.
215  *
216  * Handy for displaying information to the user (e.g. in help text)
217  */
218  /**\{*/
219  std::vector<TRegistrationDeciderProps*> regs_descriptions;
220  std::vector<TOptimizerProps*> optimizers_descriptions;
221  /**\}*/
222 
225 };
226 }
227 }
228 } // END OF NAMESPACES
230 
231 #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()
std::string description
General description of the decicder or optimizer class.
GLsizei const GLchar ** string
Definition: glext.h:4101
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:4054
virtual bool checkOptimizerExists(std::string given_opt) const
Check if the given optimizer exists in the vector of optimizers.
std::map< std::string, mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_T > *(*)()> optimizers_t
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
std::map< std::string, mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_T > *(*)()> node_regs_t
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: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019