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-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 #ifndef CGRAPHSLAMHANDLER_H
10 #define CGRAPHSLAMHANDLER_H
11 
14 #include <mrpt/core/exceptions.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 */
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 
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 */
CGraphSlamHandler::m_has_set_fnames
bool m_has_set_fnames
Definition: CGraphSlamHandler.h:146
filesystem.h
CGraphSlamHandler::m_save_graph
bool m_save_graph
Definition: CGraphSlamHandler.h:119
CGraphSlamHandler::m_save_3DScene_fname
std::string m_save_3DScene_fname
Definition: CGraphSlamHandler.h:128
exceptions.h
CGraphSlamHandler::execute
void execute()
Method to be called for parsing the rawlog file provided and for running graphSLAM using that informa...
Definition: CGraphSlamHandler_impl.h:395
CWindowManager.h
CGraphSlamHandler::m_ini_fname
std::string m_ini_fname
Definition: CGraphSlamHandler.h:123
CGraphSlamHandler::initEngine
void initEngine(const std::string &node_reg_str, const std::string &edge_reg_str, const std::string &optimizer_str)
Definition: CGraphSlamHandler_impl.h:258
CGraphSlamHandler::readConfigFname
void readConfigFname(const std::string &fname)
Read configuration variables for the current graphSLAM execution from a .ini file.
Definition: CGraphSlamHandler_impl.h:228
CGraphSlamEngine.h
CGraphSlamHandler::m_engine
mrpt::graphslam::CGraphSlamEngine< GRAPH_T > * m_engine
Pointer to the engine instance.
Definition: CGraphSlamHandler.h:139
CGraphSlamHandler::m_do_save_results
bool m_do_save_results
Definition: CGraphSlamHandler.h:145
CConfigFile.h
CGraphSlamHandler::m_user_decides_about_output_dir
bool m_user_decides_about_output_dir
Definition: CGraphSlamHandler.h:117
CGraphSlamHandler::m_save_map_fname
std::string m_save_map_fname
Definition: CGraphSlamHandler.h:129
CGraphSlamHandler::m_win_manager
mrpt::graphslam::CWindowManager * m_win_manager
Definition: CGraphSlamHandler.h:131
mrpt::graphslam::CWindowObserver
Monitor events in the visualization window.
Definition: CWindowObserver.h:27
CDisplayWindow3D.h
mrpt::graphslam::CWindowManager
Class acts as a container for storing pointers to mrpt::gui::CDisplayWindow3D, mrpt::graphslam::CWind...
Definition: CWindowManager.h:30
CGraphSlamHandler::m_win_observer
mrpt::graphslam::CWindowObserver * m_win_observer
Definition: CGraphSlamHandler.h:132
CGraphSlamHandler::getParamsAsString
std::string getParamsAsString() const
Definition: CGraphSlamHandler_impl.h:335
CGraphSlamHandler::setFNames
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.
Definition: CGraphSlamHandler_impl.h:212
mrpt::graphslam::apps::TUserOptionsChecker
Class containing the declarations of supplementary methods that can be used in application-related co...
Definition: TUserOptionsChecker.h:106
CGraphSlamHandler::m_options_checker
mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > * m_options_checker
TUserOptionsChecker instance whose task is to evaluate the Registration Decider, Optimizer instances ...
Definition: CGraphSlamHandler.h:143
CGraphSlamHandler::m_output_dir_fname
std::string m_output_dir_fname
Definition: CGraphSlamHandler.h:116
COutputLogger.h
CGraphSlamHandler
Manage variables and methods related to applications executing graphSLAM using the mrpt-graphslam API...
Definition: CGraphSlamHandler.h:36
TUserOptionsChecker.h
CGraphSlamHandler::m_rawlog_fname
std::string m_rawlog_fname
Definition: CGraphSlamHandler.h:124
CGraphSlamHandler::m_win
mrpt::gui::CDisplayWindow3D * m_win
Definition: CGraphSlamHandler.h:133
CGraphSlamHandler::setResultsDirName
void setResultsDirName(const std::string &dirname)
Override the results directory filename that was initially set in the .ini file.
Definition: CGraphSlamHandler_impl.h:345
CGraphSlamHandler::m_enable_visuals
bool m_enable_visuals
Definition: CGraphSlamHandler.h:147
CGraphSlamHandler_impl.h
CGraphSlamHandler::initOutputDir
void initOutputDir(const std::string &output_dir_fname="graphslam_results")
Initialize (clean up and create new files) the output directory.
Definition: CGraphSlamHandler_impl.h:111
CGraphSlamHandler::m_gt_fname
std::string m_gt_fname
Definition: CGraphSlamHandler.h:125
CGraphSlamHandler::initVisualization
void initVisualization()
Initialize visualization (e.g.
Definition: CGraphSlamHandler_impl.h:424
CGraphSlamHandler::m_save_graph_fname
std::string m_save_graph_fname
Definition: CGraphSlamHandler.h:127
CWindowObserver.h
CGraphSlamHandler::m_logger
mrpt::system::COutputLogger * m_logger
Definition: CGraphSlamHandler.h:135
mrpt::system::COutputLogger
Versatile class for consistent logging and management of output messages.
Definition: system/COutputLogger.h:117
CGraphSlamHandler::saveResults
void saveResults(const std::string &output_dir_fname)
Definition: CGraphSlamHandler_impl.h:354
CGraphSlamHandler::m_save_3DScene
bool m_save_3DScene
Definition: CGraphSlamHandler.h:120
CGraphSlamHandler::~CGraphSlamHandler
~CGraphSlamHandler()
Destructor.
Definition: CGraphSlamHandler_impl.h:48
CGraphSlamHandler::printParams
void printParams() const
Print in a formatted manner the general configuraiton variables for the current graphSLAM execution.
Definition: CGraphSlamHandler_impl.h:290
string
GLsizei const GLchar ** string
Definition: glext.h:4101
CGraphSlamHandler::queryObserverForEvents
bool queryObserverForEvents()
Query the CWindowObserver instance for any pressed keys that might be of interest (e....
Definition: CGraphSlamHandler_impl.h:454
CGraphSlamHandler::CGraphSlamHandler
CGraphSlamHandler(mrpt::system::COutputLogger *logger, mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > *options_checker, const bool enable_visuals)
Constructor.
Definition: CGraphSlamHandler_impl.h:20
mrpt::gui::CDisplayWindow3D
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
Definition: CDisplayWindow3D.h:117
mrpt::graphslam::CGraphSlamEngine
Main file for the GraphSlamEngine.
Definition: CGraphSlamEngine.h:154
CGraphSlamHandler::m_save_map
bool m_save_map
Definition: CGraphSlamHandler.h:121
CGraphSlamHandler::saveMap
void saveMap(const std::string &fname)
Definition: CGraphSlamHandler_impl.h:385



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST