Template Class CGraphSlamHandler

Class Documentation

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
class CGraphSlamHandler

Manage variables and methods related to applications executing graphSLAM using the mrpt-graphslam API.

CGraphSlamHandler class instances deal with the following:

  • Manage user interaction with the visuals (e.g. CDisplayWindow instance)

  • Manage general user options (e.g. user output directory preferences)

Unnamed Group

void getParamsAsString(std::string *str) const

Fetch the general configuraiton variables for the current graphSLAM execution

std::string getParamsAsString() const

Public Functions

CGraphSlamHandler(mrpt::system::COutputLogger *logger, mrpt::graphslam::apps::TUserOptionsChecker<GRAPH_T> *options_checker, const bool enable_visuals = true)
~CGraphSlamHandler()
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 printParams() const

Print in a formatted manner the general configuraiton variables for the current graphSLAM execution.

void initVisualization()

Initialize visualization (e.g. the CDisplayWindow instance that shows the overall graphSLAM execution)

void execute()

Method to be called for parsing the rawlog file provided and for running graphSLAM using that information.

void initEngine(const std::string &node_reg_str, const std::string &edge_reg_str, const std::string &optimizer_str)
void setResultsDirName(const std::string &dirname)

Override the results directory filename that was initially set in the .ini file.

Protected Functions

void initOutputDir(const std::string &output_dir_fname = "graphslam_results")

Initialize (clean up and create new files) the output directory.

If directory already exists (most probably from previous runs), the user is given 3 options:

  • Remove the current directory contents

  • Rename (and keep) the current directory contents

  • Manually handle the conflict

User can also set the .ini parameter user_decides_about_output_dir flag to false, if he doesn’t care about the previous results directory. In this case the 1st choice is picked.

See also

CGraphSlamEngine::initResultsFile

Parameters:

Name[in] of the output directory to be used

bool queryObserverForEvents()

Query the CWindowObserver instance for any pressed keys that might be of interest (e.g. <C-c>)

Returns:

True if graphslam execution is to be continued normally

void readConfigFname(const std::string &fname)

Read configuration variables for the current graphSLAM execution from a .ini file.

See also

printParams

void saveResults(const std::string &output_dir_fname)
void saveMap(const std::string &fname)

Protected Attributes

std::string m_output_dir_fname
bool m_user_decides_about_output_dir
bool m_save_graph
bool m_save_3DScene
bool m_save_map
std::string m_ini_fname
std::string m_rawlog_fname
std::string m_gt_fname
std::string m_save_graph_fname
std::string m_save_3DScene_fname
std::string m_save_map_fname
mrpt::graphslam::CGraphSlamEngine<GRAPH_T> *m_engine = nullptr
mrpt::graphslam::CWindowManager *m_win_manager = nullptr
mrpt::graphslam::CWindowObserver *m_win_observer = nullptr
mrpt::gui::CDisplayWindow3D *m_win = nullptr
mrpt::system::COutputLogger *m_logger
mrpt::graphslam::apps::TUserOptionsChecker<GRAPH_T> *m_options_checker

TUserOptionsChecker instance whose task is to evaluate the Registration Decider, Optimizer instances that are given by the user.

bool m_do_save_results = true
bool m_has_set_fnames = false
bool m_enable_visuals