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 */
Manage variables and methods related to applications executing graphSLAM using the mrpt-graphslam API...
std::string m_save_map_fname
void setResultsDirName(const std::string &dirname)
Override the results directory filename that was initially set in the .ini file.
void execute()
Method to be called for parsing the rawlog file provided and for running graphSLAM using that informa...
mrpt::graphslam::CGraphSlamEngine< GRAPH_T > * m_engine
Pointer to the engine instance.
mrpt::gui::CDisplayWindow3D * m_win
mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > * m_options_checker
TUserOptionsChecker instance whose task is to evaluate the Registration Decider, Optimizer instances ...
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.
std::string m_rawlog_fname
mrpt::graphslam::CWindowObserver * m_win_observer
std::string m_save_3DScene_fname
void readConfigFname(const std::string &fname)
Read configuration variables for the current graphSLAM execution from a .ini file.
void saveResults(const std::string &output_dir_fname)
void initEngine(const std::string &node_reg_str, const std::string &edge_reg_str, const std::string &optimizer_str)
CGraphSlamHandler(mrpt::system::COutputLogger *logger, mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > *options_checker, const bool enable_visuals)
Constructor.
void initVisualization()
Initialize visualization (e.g.
void saveMap(const std::string &fname)
void initOutputDir(const std::string &output_dir_fname="graphslam_results")
Initialize (clean up and create new files) the output directory.
std::string m_save_graph_fname
void printParams() const
Print in a formatted manner the general configuraiton variables for the current graphSLAM execution.
mrpt::graphslam::CWindowManager * m_win_manager
mrpt::system::COutputLogger * m_logger
std::string getParamsAsString() const
std::string m_output_dir_fname
~CGraphSlamHandler()
Destructor.
bool queryObserverForEvents()
Query the CWindowObserver instance for any pressed keys that might be of interest (e....
Main file for the GraphSlamEngine.
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.
Versatile class for consistent logging and management of output messages.
GLsizei const GLchar ** string
Definition: glext.h:4101
Class containing the declarations of supplementary methods that can be used in application-related co...



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