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 */
filesystem.h
mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_t >
CPose3DPDFGaussianInf.h
CNetworkOfPoses.h
mrpt::graphslam::apps::TUserOptionsChecker::_createDeciderOptimizerMappings
virtual void _createDeciderOptimizerMappings()
Definition: TUserOptionsChecker_impl.h:75
mrpt::graphslam::apps::TUserOptionsChecker::optimizers_descriptions
std::vector< TOptimizerProps * > optimizers_descriptions
Definition: TUserOptionsChecker.h:217
exceptions.h
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps
Properties struct for both the Registration Decider and Optimizer classes.
Definition: TUserOptionsChecker.h:40
mrpt::graphslam::apps::TUserOptionsChecker::checkRegistrationDeciderExists
virtual bool checkRegistrationDeciderExists(std::string given_reg, std::string reg_type) const
Check if the given registrator decider exists in the vector of deciders.
Definition: TUserOptionsChecker_impl.h:226
CFixedIntervalsNRD.h
mrpt::graphslam::apps::TUserOptionsChecker::optimizers_map
optimizers_t optimizers_map
Definition: TUserOptionsChecker.h:207
mrpt::graphslam::apps::TUserOptionsChecker< mrpt::graphs::CNetworkOfPoses2DInf >::edge_regs_t
std::map< std::string, mrpt::graphslam::deciders::CEdgeRegistrationDecider< mrpt::graphs::CNetworkOfPoses2DInf > *(*)()> edge_regs_t
Definition: TUserOptionsChecker.h:119
mrpt::graphslam::apps::TUserOptionsChecker::dumpOptimizersToConsole
virtual void dumpOptimizersToConsole() const
Print the optimizers vector in a formatted manner to the standard output.
Definition: TUserOptionsChecker_impl.h:187
mrpt::graphslam::apps::TUserOptionsChecker::populateDeciderOptimizerProperties
virtual void populateDeciderOptimizerProperties()
Populate the available decider, optimizer classes available in user applications.
Definition: TUserOptionsChecker_impl.h:310
mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_t >
mrpt::graphslam::optimizers::CGraphSlamOptimizer
Interface for implementing graphSLAM optimizer classes.
Definition: CGraphSlamOptimizer.h:39
mrpt::graphslam::apps::TUserOptionsChecker::node_regs_map
node_regs_t node_regs_map
Definition: TUserOptionsChecker.h:205
mrpt::graphslam::apps::TRegistrationDeciderProps::~TRegistrationDeciderProps
~TRegistrationDeciderProps()
Definition: TUserOptionsChecker.h:73
mrpt::graphslam::apps::TUserOptionsChecker::TUserOptionsChecker
TUserOptionsChecker()
Constructor.
Definition: TUserOptionsChecker_impl.h:18
mrpt::graphslam::apps::TRegistrationDeciderProps::type
std::string type
Type of decider.
Definition: TUserOptionsChecker.h:80
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::~TRegistrationDeciderOrOptimizerProps
~TRegistrationDeciderOrOptimizerProps()
Definition: TUserOptionsChecker.h:51
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::is_mr_slam_class
bool is_mr_slam_class
Class indicating if the current decider/optimizer class can be used in a multi-robot SLAM operation.
Definition: TUserOptionsChecker.h:61
CICPCriteriaERD.h
mrpt::graphslam::apps::TUserOptionsChecker::createEdgeRegistrationDecider
static mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_t > * createEdgeRegistrationDecider()
Definition: TUserOptionsChecker.h:189
mrpt::graphslam::apps::TUserOptionsChecker< mrpt::graphs::CNetworkOfPoses2DInf >::constraint_t
typename mrpt::graphs::CNetworkOfPoses2DInf ::constraint_t constraint_t
Definition: TUserOptionsChecker.h:112
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
type
GLuint GLuint GLsizei GLenum type
Definition: glext.h:3528
mrpt::graphslam::apps::TUserOptionsChecker::edge_regs_map
edge_regs_t edge_regs_map
Definition: TUserOptionsChecker.h:206
mrpt::graphslam::apps::TRegistrationDeciderProps::TRegistrationDeciderProps
TRegistrationDeciderProps()
Definition: TUserOptionsChecker.h:72
name
GLuint const GLchar * name
Definition: glext.h:4054
mrpt::graphslam::apps::TRegistrationDeciderProps::observations_used
std::vector< std::string > observations_used
Measurements that the current decider class can utilize.
Definition: TUserOptionsChecker.h:84
mrpt::graphslam::apps::TUserOptionsChecker
Class containing the declarations of supplementary methods that can be used in application-related co...
Definition: TUserOptionsChecker.h:106
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::description
std::string description
General description of the decicder or optimizer class.
Definition: TUserOptionsChecker.h:56
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::name
std::string name
Name of the decider or optimizer class.
Definition: TUserOptionsChecker.h:54
mrpt::graphslam::apps::TUserOptionsChecker::createGraphSlamOptimizer
static mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_t > * createGraphSlamOptimizer()
Definition: TUserOptionsChecker.h:195
mrpt::graphslam::apps::TUserOptionsChecker< mrpt::graphs::CNetworkOfPoses2DInf >::pose_t
typename mrpt::graphs::CNetworkOfPoses2DInf ::constraint_t::type_value pose_t
Definition: TUserOptionsChecker.h:113
mrpt::graphslam::apps::TUserOptionsChecker< mrpt::graphs::CNetworkOfPoses2DInf >::node_regs_t
std::map< std::string, mrpt::graphslam::deciders::CNodeRegistrationDecider< mrpt::graphs::CNetworkOfPoses2DInf > *(*)()> node_regs_t
Definition: TUserOptionsChecker.h:116
CEmptyNRD.h
CICPCriteriaNRD.h
mrpt::graphslam::apps::TUserOptionsChecker::sep_header
const std::string sep_header
Definition: TUserOptionsChecker.h:220
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::is_slam_2d
bool is_slam_2d
Definition: TUserOptionsChecker.h:62
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::TRegistrationDeciderOrOptimizerProps
TRegistrationDeciderOrOptimizerProps()
Definition: TUserOptionsChecker.h:42
mrpt::graphslam::apps::TOptimizerProps::TOptimizerProps
TOptimizerProps()
Definition: TUserOptionsChecker.h:93
mrpt::graphslam::apps::TRegistrationDeciderOrOptimizerProps::is_slam_3d
bool is_slam_3d
Definition: TUserOptionsChecker.h:63
mrpt::graphslam::apps::TUserOptionsChecker::createDeciderOptimizerMappings
virtual void createDeciderOptimizerMappings()
Create the necessary mappings from strings to the corresponding instance creation functors.
Definition: TUserOptionsChecker_impl.h:45
CPosePDFGaussianInf.h
CLevMarqGSO.h
mrpt::graphslam::apps::TUserOptionsChecker::dumpRegistrarsToConsole
virtual void dumpRegistrarsToConsole(std::string reg_type="all") const
Print the registration deciders vector in a formatted manner to the standard output.
Definition: TUserOptionsChecker_impl.h:115
CLoopCloserERD.h
CEmptyERD.h
mrpt::graphslam::apps::TUserOptionsChecker::createNodeRegistrationDecider
static mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_t > * createNodeRegistrationDecider()
Definition: TUserOptionsChecker.h:183
TUserOptionsChecker_impl.h
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::graphslam::apps::TUserOptionsChecker::checkOptimizerExists
virtual bool checkOptimizerExists(std::string given_opt) const
Check if the given optimizer exists in the vector of optimizers.
Definition: TUserOptionsChecker_impl.h:274
mrpt::graphslam::apps::TUserOptionsChecker::regs_descriptions
std::vector< TRegistrationDeciderProps * > regs_descriptions
Definition: TUserOptionsChecker.h:216
mrpt::graphslam::apps::TUserOptionsChecker< mrpt::graphs::CNetworkOfPoses2DInf >::optimizers_t
std::map< std::string, mrpt::graphslam::optimizers::CGraphSlamOptimizer< mrpt::graphs::CNetworkOfPoses2DInf > *(*)()> optimizers_t
Definition: TUserOptionsChecker.h:122
mrpt::graphslam::apps::TRegistrationDeciderProps::rawlog_format
std::string rawlog_format
Rawlog formats that the decider can be used in.
Definition: TUserOptionsChecker.h:82
mrpt::graphslam::apps::TOptimizerProps
Properties struct for the Optimizer classes.
Definition: TUserOptionsChecker.h:91
mrpt::graphslam::apps::TOptimizerProps::~TOptimizerProps
~TOptimizerProps()
Definition: TUserOptionsChecker.h:94
mrpt::graphslam::apps::TUserOptionsChecker::sep_subheader
const std::string sep_subheader
Definition: TUserOptionsChecker.h:221
mrpt::graphslam::apps::TUserOptionsChecker::~TUserOptionsChecker
virtual ~TUserOptionsChecker()
Destructor.
Definition: TUserOptionsChecker_impl.h:24
mrpt::graphslam::apps::TRegistrationDeciderProps
Properties struct for the Registration Decider classes.
Definition: TUserOptionsChecker.h:70



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST