Main MRPT website > C++ reference for MRPT 1.9.9
CRegistrationDeciderOrOptimizer.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 CREGISTRATIONDECIDEROROPTIMIZER_H
11 #define CREGISTRATIONDECIDEROROPTIMIZER_H
12 
14 #include <mrpt/obs/CSensoryFrame.h>
15 #include <mrpt/obs/CObservation.h>
18 #include <mrpt/utils/CTimeLogger.h>
20 
21 #include <string>
22 #include <map>
23 
24 namespace mrpt
25 {
26 namespace graphslam
27 {
28 /**\brief Interface for implementing node/edge registration deciders or
29  * optimizer classes.
30  *
31  * Specific interfaces - for implementing node/edge deciders / optimizers -
32  * can inherit from CRegistrationDeciderOrOptimizer so that they can make use
33  * of the generic methods defined in the latter.
34  *
35  * \note \b Convention: For the already implemented deciders/optimizers the
36  * following naming convention has been used:
37  * - NRD: Node Registration Decider class
38  * - ERD: Edge Registration Decider class
39  * - GSO: GraphSlam Optimizer class
40  *
41  * \ingroup mrpt_graphslam_grp
42  */
43 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
44 class CRegistrationDeciderOrOptimizer : public mrpt::utils::COutputLogger
45 {
46  public:
47  /**\Default Ctor*/
49  /**\Dtor*/
51  /**\brief Generic method for fetching the incremental action-observations
52  * (or
53  * observation-only) measurements
54  *
55  * \return True if operation was successful. Criteria for Success depend on
56  * the decider/optimizer implementing this method
57  */
58  virtual bool updateState(
60  mrpt::obs::CSensoryFrame::Ptr observations,
61  mrpt::obs::CObservation::Ptr observation) = 0;
62  /**\brief Fetch a CWindowManager pointer.
63  *
64  * CWindowManager instance should contain a CDisplayWindow3D* and,
65  * optionally, a CWindowObserver pointer so that interaction with the
66  * window is possible
67  */
68  virtual void setWindowManagerPtr(
69  mrpt::graphslam::CWindowManager* win_manager);
70 
71  /**\brief Fetch a std::mutex for locking the GRAPH_T
72  * resource.
73  *
74  * Handy for realising multithreading in the derived classes.
75  *
76  * \warning Beware that prior to the decider/optimizer public method call,
77  * the CCriticalSection will already be locked from CGraphSlamEngine_t
78  * instance, but this isn't effective in multithreaded implementations where
79  * the decider/optimizer itself has to lock the function at which the extra
80  * thread runs.
81  */
82  virtual void setCriticalSectionPtr(std::mutex* graph_section);
83  /**\brief Initialize visual objects in CDisplayWindow (e.g. \em add an
84  * object to scene).
85  *
86  * \exception std::exception If the method is called without having first
87  * provided a CDisplayWindow3D* to the class instance
88  *
89  * \sa setWindowManagerPtr, updateVisuals
90  */
91  virtual void initializeVisuals();
92  /**\brief Update the relevant visual features in CDisplayWindow.
93  *
94  *\exception std::exception If the method is called without having first
95  * provided a CDisplayWindow3D* to the class instance
96  *
97  * \sa setWindowManagerPtr, initializeVisuals
98  */
99  virtual void updateVisuals();
100  /**\brief Get a list of the window events that happened since the last call.
101  *
102  * Method in derived classes is automatically called from the
103  * CGraphSlamEngine_t instance. After that, decider/optimizer should just
104  * fetch the parameters that it is interested in.
105  */
106  virtual void notifyOfWindowEvents(
107  const std::map<std::string, bool>& events_occurred);
108  /**\brief Load the necessary for the decider/optimizer configuration
109  * parameters.
110  */
111  virtual void loadParams(const std::string& source_fname);
112  /**\brief Print the problem parameters - relevant to the decider/optimizer
113  * to the
114  * screen in a unified/compact way.
115  */
116  virtual void printParams() const;
117  /**\brief Fill the provided string with a detailed report of the
118  * decider/optimizer state.
119  *
120  * Report should include (part of) the following:
121  * - Timing of important methods
122  * - Properties fo class at the current time
123  * - Logging of commands until current time
124  */
125  virtual void getDescriptiveReport(std::string* report_str) const;
126 
127  /**\brief Fetch the graph on which the decider/optimizer will work on.
128  *
129  */
130  virtual void setGraphPtr(GRAPH_T* graph);
131 
132  /**\brief Initialize the COutputLogger, CTimeLogger instances given the
133  * name of the decider/optimizer at hand
134  */
135  virtual void initializeLoggers(const std::string& name);
136  virtual void setClassName(const std::string& name);
137  bool isMultiRobotSlamClass();
138 
139  std::string getClassName() const { return m_class_name; };
140  protected:
141  /**\brief Handy function for making all the visuals assertions in a
142  * compact manner
143  */
144  virtual void assertVisualsVars();
145  /**\brief Pointer to the graph that is under construction */
146  GRAPH_T* m_graph;
147  std::mutex* m_graph_section;
148 
149  /** \name Visuals-related variables methods
150  */
151  /**\{*/
152  /**\brief Pointer to the CWindowManager object used to store
153  * visuals-related instances
154  */
156  /**\brief Window to use */
158  /**\brief CWindowObserver object for monitoring various visual-oriented
159  * events.*/
162  /**\}*/
163 
164  /**\brief Time logger instance */
166  /**\brief Name of the class instance */
168  /**\brief Boolean indicating if the current class can be used in
169  * multi-robot SLAM operations
170  */
172 
173  /**\brief Separator string to be used in debugging messages
174  */
175  static const std::string header_sep;
176  static const std::string report_sep;
177 };
178 }
179 } // end of namespaces
180 
182 #endif /* end of include guard: CREGISTRATIONDECIDEROROPTIMIZER_H */
virtual void notifyOfWindowEvents(const std::map< std::string, bool > &events_occurred)
Get a list of the window events that happened since the last call.
mrpt::gui::CDisplayWindow3D * m_win
Window to use.
virtual void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
virtual bool updateState(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)=0
Generic method for fetching the incremental action-observations (or observation-only) measurements...
virtual void printParams() const
Print the problem parameters - relevant to the decider/optimizer to the screen in a unified/compact w...
static const std::string header_sep
Separator string to be used in debugging messages.
virtual void setCriticalSectionPtr(std::mutex *graph_section)
Fetch a std::mutex for locking the GRAPH_T resource.
mrpt::graphslam::CWindowObserver * m_win_observer
CWindowObserver object for monitoring various visual-oriented events.
bool is_mr_slam_class
Boolean indicating if the current class can be used in multi-robot SLAM operations.
virtual void setGraphPtr(GRAPH_T *graph)
Fetch the graph on which the decider/optimizer will work on.
mrpt::graphslam::CWindowManager * m_win_manager
Pointer to the CWindowManager object used to store visuals-related instances.
virtual void initializeVisuals()
Initialize visual objects in CDisplayWindow (e.g.
Interface for implementing node/edge registration deciders or optimizer classes.
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
virtual void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
virtual void initializeLoggers(const std::string &name)
Initialize the COutputLogger, CTimeLogger instances given the name of the decider/optimizer at hand...
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
virtual void setWindowManagerPtr(mrpt::graphslam::CWindowManager *win_manager)
Fetch a CWindowManager pointer.
GRAPH_T * m_graph
Pointer to the graph that is under construction.
virtual void assertVisualsVars()
Handy function for making all the visuals assertions in a compact manner.
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::shared_ptr< CActionCollection > Ptr
mrpt::utils::CTimeLogger m_time_logger
Time logger instance.
Monitor events in the visualization window.
virtual void updateVisuals()
Update the relevant visual features in CDisplayWindow.
GLuint const GLchar * name
Definition: glext.h:4054
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats.
Definition: CTimeLogger.h:45
Class acts as a container for storing pointers to mrpt::gui::CDisplayWindow3D, mrpt::graphslam::CWind...
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.



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