Main MRPT website > C++ reference for MRPT 1.9.9
CGraphSlamHandler.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 #ifndef CGRAPHSLAMHANDLER_H
10 #define CGRAPHSLAMHANDLER_H
11 
13 #include <mrpt/utils/CConfigFile.h>
14 #include <mrpt/utils/mrpt_macros.h>
16 #include <mrpt/system/filesystem.h>
17 
22 
23 #include <string>
24 #include <sstream>
25 #include <iostream>
26 
27 /**\brief Manage variables and methods related to applications executing
28  * graphSLAM using the mrpt-graphslam API.
29  *
30  * As a quick overview, CGraphSlamHandler class instances deal with the
31  * following:
32  * - Manage user interaction with the visuals (e.g. CDisplayWindow instance)
33  * - Manage general user options (e.g. user output directory preferences)
34  */
35 template <class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
37 {
38  public:
39  /**\brief Constructor */
41  mrpt::utils::COutputLogger* logger,
43  const bool enable_visuals /*=true*/);
44  /**\brief Destructor */
46  /**\brief Set the relevant filenames for instantiating CGraphSlamEngine
47  * instance
48  */
49  void setFNames(
50  const std::string& ini_fname, const std::string& rawlog_fname,
51  const std::string& ground_truth_fname = std::string());
52  /**\brief Print in a formatted manner the general configuraiton variables
53  * for
54  * the current graphSLAM execution
55  *
56  * \sa readConfigFname, getParamsAsString
57  */
58  void printParams() const;
59  /**\name Fetch the general configuraiton variables for
60  * the current graphSLAM execution
61  */
62  /**\{*/
63  void getParamsAsString(std::string* str) const;
65  /**\}*/
66  /**\brief Initialize visualization (e.g. the CDisplayWindow instance that
67  * shows the overall graphSLAM execution)
68  */
69  void initVisualization();
70  /**\brief Method to be called for parsing the rawlog file provided and for
71  * running graphSLAM using that information
72  */
73  void execute();
74  void initEngine(
75  const std::string& node_reg_str, const std::string& edge_reg_str,
76  const std::string& optimizer_str);
77  /**\brief Override the results directory filename that was initially set in
78  * the .ini file.
79  */
80  void setResultsDirName(const std::string& dirname);
81 
82  protected:
83  /**\brief Initialize (clean up and create new files) the output directory.
84  *
85  * If directory already exists (most probably from previous runs), the user
86  * is given 3 options:
87  * - Remove the current directory contents
88  * - Rename (and keep) the current directory contents
89  * - Manually handle the conflict
90  *
91  * User can also set the .ini parameter user_decides_about_output_dir flag
92  * to false, if he doesn't care about the previous results directory. In
93  * this case the 1st choice is picked.
94  *
95  * \param[in] Name of the output directory to be used
96  *
97  * \sa CGraphSlamEngine::initResultsFile
98  */
99  void initOutputDir(
100  const std::string& output_dir_fname = "graphslam_results");
101  /**\brief Query the CWindowObserver instance for any pressed keys that might
102  * be of interest (e.g. <C-c>)
103  *
104  * \return True if graphslam execution is to be continued normally
105  */
106  bool queryObserverForEvents();
107  /**\brief Read configuration variables for the current graphSLAM execution
108  * from a .ini file
109  *
110  * \sa printParams
111  */
112  void readConfigFname(const std::string& fname);
113  void saveResults(const std::string& output_dir_fname);
114  void saveMap(const std::string& fname);
115 
118 
122 
126 
130 
134 
135  mrpt::utils::COutputLogger* m_logger;
136 
137  /**\brief Pointer to the engine instance
138  */
140  /**\brief TUserOptionsChecker instance whose task is to evaluate the
141  * Registration Decider, Optimizer instances that are given by the user.
142  */
144 
148 };
149 
150 #include "CGraphSlamHandler_impl.h"
151 
152 #endif /* end of include guard: CGRAPHSLAMHANDLER_H */
void setResultsDirName(const std::string &dirname)
Override the results directory filename that was initially set in the .ini file.
void readConfigFname(const std::string &fname)
Read configuration variables for the current graphSLAM execution from a .ini file.
void printParams() const
Print in a formatted manner the general configuraiton variables for the current graphSLAM execution...
std::string m_rawlog_fname
std::string m_save_graph_fname
void saveResults(const std::string &output_dir_fname)
bool queryObserverForEvents()
Query the CWindowObserver instance for any pressed keys that might be of interest (e...
std::string m_output_dir_fname
std::string m_save_map_fname
std::string getParamsAsString() const
void initVisualization()
Initialize visualization (e.g.
CGraphSlamHandler(mrpt::utils::COutputLogger *logger, mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > *options_checker, const bool enable_visuals)
Constructor.
Manage variables and methods related to applications executing graphSLAM using the mrpt-graphslam API...
Main file for the GraphSlamEngine.
void saveMap(const std::string &fname)
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::graphslam::CWindowManager * m_win_manager
void execute()
Method to be called for parsing the rawlog file provided and for running graphSLAM using that informa...
mrpt::gui::CDisplayWindow3D * m_win
mrpt::utils::COutputLogger * m_logger
Monitor events in the visualization window.
void setFNames(const std::string &ini_fname, const std::string &rawlog_fname, const std::string &ground_truth_fname=std::string())
Set the relevant filenames for instantiating CGraphSlamEngine instance.
void initEngine(const std::string &node_reg_str, const std::string &edge_reg_str, const std::string &optimizer_str)
std::string m_save_3DScene_fname
mrpt::graphslam::CGraphSlamEngine< GRAPH_T > * m_engine
Pointer to the engine instance.
void initOutputDir(const std::string &output_dir_fname="graphslam_results")
Initialize (clean up and create new files) the output directory.
mrpt::graphslam::CWindowObserver * m_win_observer
~CGraphSlamHandler()
Destructor.
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.
mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > * m_options_checker
TUserOptionsChecker instance whose task is to evaluate the Registration Decider, Optimizer instances ...



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