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



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST