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 
32 {
33 /**\brief Properties struct for both the Registration Decider and Optimizer
34  * classes
35  */
37 {
39  : name(""),
40  description(""),
41  is_mr_slam_class(false),
42  is_slam_2d(
43  true), // by default the decider/optimizer is considered 2D
44  is_slam_3d(false)
45  {
46  }
48  /**\brief Name of the decider or optimizer class
49  */
51  /**\brief General description of the decicder or optimizer class*/
53  /**\brief Class indicating if the current decider/optimizer class can be
54  * used
55  * in a multi-robot SLAM operation
56  */
58  bool is_slam_2d;
59  bool is_slam_3d;
60 };
61 
62 /**\brief Properties struct for the Registration Decider classes.
63  *
64  * \ingroup mrpt_graphslam_grp
65  */
67 {
70  /**\brief Type of decider.
71  *
72  * Available options are:
73  * - node
74  * - edge
75  */
77  /**\brief Rawlog formats that the decider can be used in */
79  /**\brief Measurements that the current decider class can utilize */
80  std::vector<std::string> observations_used;
81 };
82 
83 /**\brief Properties struct for the Optimizer classes.
84  *
85  * \ingroup mrpt_graphslam_grp
86  */
88 {
91 };
92 
93 /**\brief Class containing the declarations of supplementary methods that can
94  * be used in application-related code.
95  * Class instance can be handy for adding keeping the available
96  * deciders/optimizers in a compact manner and for verifying whether a given
97  * decider can be used.
98  *
99  * \ingroup mrpt_graphslam_grp
100  */
101 template <class GRAPH_t>
103 {
104  /**\name handy typedefs for the creation of deciders/optimzer instances from
105  * the corresponding strings
106  */
107  /**\{*/
108  using constraint_t = typename GRAPH_t::constraint_t;
109  using pose_t = typename GRAPH_t::constraint_t::type_value;
110  using node_regs_t = std::map<
111  std::string,
113  using edge_regs_t = std::map<
114  std::string,
116  using optimizers_t = std::map<
117  std::string,
119 
120  /**\}*/
121 
122  //
123  // methods
124  //
125  /**\brief Constructor */
127  /**\brief Destructor */
128  virtual ~TUserOptionsChecker();
129  /**\brief Create the necessary mappings from strings to the corresponding
130  * instance creation functors.
131  *
132  * Method is used for populating a map from string to instance creation
133  * function. The decider/optimzer can then be spawned according to the user
134  * selection.
135  *
136  */
137  virtual void createDeciderOptimizerMappings();
138  virtual void _createDeciderOptimizerMappings();
139  /**\brief Populate the available decider, optimizer classes available in
140  * user applications
141  */
142  virtual void populateDeciderOptimizerProperties();
143  /**\brief Check if the given registrator decider exists in the vector of
144  * deciders.
145  * \param[in] given_reg String specifying the type of decider - This should
146  * either be "node" or "edge"
147  * \return True if it exists, false otherwise
148  */
149  virtual bool checkRegistrationDeciderExists(
150  std::string given_reg, std::string reg_type) const;
151 
152  /**\brief Check if the given optimizer exists in the vector of optimizers.
153  * \return True if it exists, false otherwise
154  */
155  virtual bool checkOptimizerExists(std::string given_opt) const;
156 
157  /**\brief Print the registration deciders vector in a formatted manner to
158  * the
159  * standard output
160  * \param[in] reg_type Method prints both the node registration
161  * and edge registration deciders of the given vector unless specified
162  * otherwise. The available argument options are "node", "edge", "all"
163  */
164  virtual void dumpRegistrarsToConsole(std::string reg_type = "all") const;
165  /**\brief Print the optimizers vector in a formatted manner to the standard
166  * output.
167  */
168  virtual void dumpOptimizersToConsole() const;
169 
170  /**\name Methods for initializing decider/optimizer instances based on the
171  * user
172  * command line choices - http://stackoverflow.com/a/582456/2843583
173  *
174  * \warning Caller is responsible for deleting the initialized instances
175  */
176  /**\{*/
177  template <class T>
180  {
181  return new T;
182  }
183  template <class T>
186  {
187  return new T;
188  }
189  template <class T>
192  {
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 }
221 
222 #endif /* end of include guard: TUSEROPTIONSCHECKER_H */
223 
224 
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...
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020