Main MRPT website > C++ reference for MRPT 1.5.9
CGraphSlamHandler.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2 
3  | Mobile Robot Programming Toolkit (MRPT) |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
7  | See: http://www.mrpt.org/Authors - All rights reserved. |
8  | Released under BSD License. See details in http://www.mrpt.org/License |
9  +---------------------------------------------------------------------------+ */
10 #ifndef CGRAPHSLAMHANDLER_H
11 #define CGRAPHSLAMHANDLER_H
12 
14 #include <mrpt/utils/CConfigFile.h>
15 #include <mrpt/utils/mrpt_macros.h>
17 #include <mrpt/system/filesystem.h>
18 #include <mrpt/system/threads.h>
19 
25 
26 #include <string>
27 #include <sstream>
28 #include <iostream>
29 
30 /**\brief Manage variables and methods related to applications executing
31  * graphSLAM using the mrpt-graphslam API.
32  *
33  * As a quick overview, CGraphSlamHandler class instances deal with the following:
34  * - Manage user interaction with the visuals (e.g. CDisplayWindow instance)
35  * - Manage general user options (e.g. user output directory preferences)
36  */
37 template<class GRAPH_T=mrpt::graphs::CNetworkOfPoses2DInf>
39 {
40  public:
41  /**\brief Constructor */
43  mrpt::utils::COutputLogger* logger,
45  const bool enable_visuals/*=true*/);
46  /**\brief Destructor */
48  /**\brief Set the relevant filenames for instantiating CGraphSlamEngine
49  * instance
50  */
51  void setFNames (
52  const std::string& ini_fname,
53  const std::string& rawlog_fname,
54  const std::string& ground_truth_fname=std::string());
55  /**\brief Print in a formatted manner the general configuraiton variables for
56  * the current graphSLAM execution
57  *
58  * \sa readConfigFname, getParamsAsString
59  */
60  void printParams() const;
61  /**\name Fetch the general configuraiton variables for
62  * the current graphSLAM execution
63  */
64  /**\{*/
65  void getParamsAsString(std::string* str) const;
67  /**\}*/
68  /**\brief Initialize visualization (e.g. the CDisplayWindow instance that
69  * shows the overall graphSLAM execution)
70  */
71  void initVisualization();
72  /**\brief Method to be called for parsing the rawlog file provided and for
73  * running graphSLAM using that information
74  */
75  void execute();
76  void initEngine(
77  const std::string& node_reg_str,
78  const std::string& edge_reg_str,
79  const std::string& optimizer_str);
80  /**\brief Override the results directory filename that was initially set in
81  * the .ini file.
82  */
83  void setResultsDirName(const std::string& dirname);
84 
85  protected:
86  /**\brief Initialize (clean up and create new files) the output directory.
87  *
88  * If directory already exists (most probably from previous runs), the user
89  * is given 3 options:
90  * - Remove the current directory contents
91  * - Rename (and keep) the current directory contents
92  * - Manually handle the conflict
93  *
94  * User can also set the .ini parameter user_decides_about_output_dir flag
95  * to false, if he doesn't care about the previous results directory. In
96  * this case the 1st choice is picked.
97  *
98  * \param[in] Name of the output directory to be used
99  *
100  * \sa CGraphSlamEngine::initResultsFile
101  */
102  void initOutputDir(const std::string& output_dir_fname="graphslam_results");
103  /**\brief Query the CWindowObserver instance for any pressed keys that might
104  * be of interest (e.g. <C-c>)
105  *
106  * \return True if graphslam execution is to be continued normally
107  */
108  bool queryObserverForEvents();
109  /**\brief Read configuration variables for the current graphSLAM execution
110  * from a .ini file
111  *
112  * \sa printParams
113  */
114  void readConfigFname(const std::string& fname);
115  void saveResults(
116  const std::string& output_dir_fname);
117  void saveMap(const std::string& fname);
118 
121 
125 
129 
133 
137 
138  mrpt::utils::COutputLogger* m_logger;
139 
140  /**\brief Pointer to the engine instance
141  */
143  /**\brief TUserOptionsChecker instance whose task is to evaluate the
144  * Registration Decider, Optimizer instances that are given by the user.
145  */
147 
151 
152 };
153 
154 #include "CGraphSlamHandler_impl.h"
155 
156 #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:3919
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.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020