Main MRPT website > C++ reference for MRPT 1.5.7
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>
19 #include <mrpt/utils/CTimeLogger.h>
21 
22 #include <string>
23 #include <map>
24 
25 namespace mrpt { namespace graphslam {
26 
27 /**\brief Interface for implementing node/edge registration deciders or
28  * optimizer classes.
29  *
30  * Specific interfaces - for implementing node/edge deciders / optimizers -
31  * can inherit from CRegistrationDeciderOrOptimizer so that they can make use
32  * of the generic methods defined in the latter.
33  *
34  * \note \b Convention: For the already implemented deciders/optimizers the
35  * following naming convention has been used:
36  * - NRD: Node Registration Decider class
37  * - ERD: Edge Registration Decider class
38  * - GSO: GraphSlam Optimizer class
39  *
40  * \ingroup mrpt_graphslam_grp
41  */
42 template<class GRAPH_T=typename mrpt::graphs::CNetworkOfPoses2DInf>
44  public mrpt::utils::COutputLogger
45 {
46  public:
47 
48  /**\Default Ctor*/
50  /**\Dtor*/
52  /**\brief Generic method for fetching the incremental action-observations (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(
59  mrpt::obs::CActionCollectionPtr action,
60  mrpt::obs::CSensoryFramePtr observations,
61  mrpt::obs::CObservationPtr 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 mrpt::synch::CCriticalSection 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(
83  mrpt::synch::CCriticalSection* graph_section);
84  /**\brief Initialize visual objects in CDisplayWindow (e.g. \em add an
85  * object to scene).
86  *
87  * \exception std::exception If the method is called without having first
88  * provided a CDisplayWindow3D* to the class instance
89  *
90  * \sa setWindowManagerPtr, updateVisuals
91  */
92  virtual void initializeVisuals();
93  /**\brief Update the relevant visual features in CDisplayWindow.
94  *
95  *\exception std::exception If the method is called without having first
96  * provided a CDisplayWindow3D* to the class instance
97  *
98  * \sa setWindowManagerPtr, initializeVisuals
99  */
100  virtual void updateVisuals();
101  /**\brief Get a list of the window events that happened since the last call.
102  *
103  * Method in derived classes is automatically called from the
104  * CGraphSlamEngine_t instance. After that, decider/optimizer should just
105  * fetch the parameters that it is interested in.
106  */
107  virtual void notifyOfWindowEvents(
108  const std::map<std::string, bool>& events_occurred);
109  /**\brief Load the necessary for the decider/optimizer configuration parameters.
110  */
111  virtual void loadParams(const std::string& source_fname);
112  /**\brief Print the problem parameters - relevant to the decider/optimizer to the
113  * screen in a unified/compact way.
114  */
115  virtual void printParams() const;
116  /**\brief Fill the provided string with a detailed report of the
117  * decider/optimizer state.
118  *
119  * Report should include (part of) the following:
120  * - Timing of important methods
121  * - Properties fo class at the current time
122  * - Logging of commands until current time
123  */
124  virtual void getDescriptiveReport(std::string* report_str) const;
125 
126  /**\brief Fetch the graph on which the decider/optimizer will work on.
127  *
128  */
129  virtual void setGraphPtr(GRAPH_T* graph);
130 
131  /**\brief Initialize the COutputLogger, CTimeLogger instances given the
132  * name of the decider/optimizer at hand
133  */
134  virtual void initializeLoggers(const std::string& name);
135  virtual void setClassName(const std::string& name);
136  bool isMultiRobotSlamClass();
137 
138  std::string getClassName() const { return m_class_name; };
139 
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;
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.
This class provides simple critical sections functionality.
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 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.
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.
virtual bool updateState(mrpt::obs::CActionCollectionPtr action, mrpt::obs::CSensoryFramePtr observations, mrpt::obs::CObservationPtr observation)=0
Generic method for fetching the incremental action-observations (or observation-only) measurements...
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...
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:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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:3891
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats.
Definition: CTimeLogger.h:41
Class acts as a container for storing pointers to mrpt::gui::CDisplayWindow3D, mrpt::graphslam::CWind...
virtual void setCriticalSectionPtr(mrpt::synch::CCriticalSection *graph_section)
Fetch a mrpt::synch::CCriticalSection for locking the GRAPH_T resource.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019