MRPT  1.9.9
CGraphSlamHandler< GRAPH_T > Class Template Reference

Detailed Description

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

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

As a quick overview, 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)

Definition at line 36 of file CGraphSlamHandler.h.

#include <mrpt/graphslam/apps_related/CGraphSlamHandler.h>

Public Member Functions

 CGraphSlamHandler (mrpt::system::COutputLogger *logger, mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > *options_checker, const bool enable_visuals)
 Constructor. More...
 
 ~CGraphSlamHandler ()
 Destructor. More...
 
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. More...
 
void printParams () const
 Print in a formatted manner the general configuraiton variables for the current graphSLAM execution. More...
 
void initVisualization ()
 Initialize visualization (e.g. More...
 
void execute ()
 Method to be called for parsing the rawlog file provided and for running graphSLAM using that information. More...
 
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. More...
 
Fetch the general configuraiton variables for

the current graphSLAM execution

void getParamsAsString (std::string *str) const
 
std::string getParamsAsString () const
 

Protected Member Functions

void initOutputDir (const std::string &output_dir_fname="graphslam_results")
 Initialize (clean up and create new files) the output directory. More...
 
bool queryObserverForEvents ()
 Query the CWindowObserver instance for any pressed keys that might be of interest (e.g. More...
 
void readConfigFname (const std::string &fname)
 Read configuration variables for the current graphSLAM execution from a .ini file. More...
 
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::CWindowManagerm_win_manager
 
mrpt::graphslam::CWindowObserverm_win_observer
 
mrpt::gui::CDisplayWindow3Dm_win
 
mrpt::system::COutputLoggerm_logger
 
mrpt::graphslam::CGraphSlamEngine< GRAPH_T > * m_engine
 Pointer to the engine instance. More...
 
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. More...
 
bool m_do_save_results
 
bool m_has_set_fnames
 
bool m_enable_visuals
 

Constructor & Destructor Documentation

◆ CGraphSlamHandler()

◆ ~CGraphSlamHandler()

Member Function Documentation

◆ execute()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::execute ( )

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

Definition at line 395 of file CGraphSlamHandler_impl.h.

References mrpt::serialization::archiveFrom(), ASSERTDEB_, mrpt::system::COutputLogger::logFmt(), mrpt::system::LVL_WARN, CGraphSlamHandler< GRAPH_T >::m_engine, CGraphSlamHandler< GRAPH_T >::m_logger, and CGraphSlamHandler< GRAPH_T >::m_rawlog_fname.

◆ getParamsAsString() [1/2]

◆ getParamsAsString() [2/2]

template<class GRAPH_T >
std::string CGraphSlamHandler< GRAPH_T >::getParamsAsString ( ) const

Definition at line 335 of file CGraphSlamHandler_impl.h.

Referenced by CGraphSlamHandler< GRAPH_T >::printParams().

◆ initEngine()

◆ initOutputDir()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::initOutputDir ( const std::string output_dir_fname = "graphslam_results")
protected

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.

Parameters
[in]Nameof the output directory to be used
See also
CGraphSlamEngine::initResultsFile

Definition at line 111 of file CGraphSlamHandler_impl.h.

References ASSERTDEBMSG_, mrpt::system::createDirectory(), mrpt::system::deleteFilesInDirectory(), mrpt::system::directoryExists(), mrpt::system::fileNameStripInvalidChars(), getCurrentTime(), mrpt::system::COutputLogger::logFmt(), mrpt::system::LVL_INFO, CGraphSlamHandler< GRAPH_T >::m_logger, CGraphSlamHandler< GRAPH_T >::m_user_decides_about_output_dir, MRPT_END, MRPT_START, mrpt::system::renameFile(), mrpt::system::timeToString(), and mrpt::system::trim().

Referenced by CGraphSlamHandler< GRAPH_T >::~CGraphSlamHandler().

◆ initVisualization()

◆ printParams()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::printParams ( ) const

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

See also
readConfigFname, getParamsAsString

Definition at line 290 of file CGraphSlamHandler_impl.h.

References CGraphSlamHandler< GRAPH_T >::getParamsAsString(), and CGraphSlamHandler< GRAPH_T >::m_engine.

◆ queryObserverForEvents()

template<class GRAPH_T >
bool CGraphSlamHandler< GRAPH_T >::queryObserverForEvents ( )
protected

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

Definition at line 454 of file CGraphSlamHandler_impl.h.

References CGraphSlamHandler< GRAPH_T >::m_win_observer, and mrpt::graphslam::CWindowObserver::returnEventsStruct().

Referenced by CGraphSlamHandler< GRAPH_T >::~CGraphSlamHandler().

◆ readConfigFname()

◆ saveMap()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::saveMap ( const std::string fname)
protected

◆ saveResults()

◆ setFNames()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::setFNames ( const std::string ini_fname,
const std::string rawlog_fname,
const std::string ground_truth_fname = std::string() 
)

◆ setResultsDirName()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::setResultsDirName ( const std::string dirname)

Member Data Documentation

◆ m_do_save_results

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_do_save_results
protected

◆ m_enable_visuals

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_enable_visuals
protected

◆ m_engine

◆ m_gt_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_gt_fname
protected

◆ m_has_set_fnames

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_has_set_fnames
protected

◆ m_ini_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_ini_fname
protected

◆ m_logger

◆ m_options_checker

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::graphslam::apps::TUserOptionsChecker<GRAPH_T>* CGraphSlamHandler< GRAPH_T >::m_options_checker
protected

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

Definition at line 143 of file CGraphSlamHandler.h.

Referenced by CGraphSlamHandler< GRAPH_T >::CGraphSlamHandler(), and CGraphSlamHandler< GRAPH_T >::initEngine().

◆ m_output_dir_fname

◆ m_rawlog_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_rawlog_fname
protected

◆ m_save_3DScene

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_save_3DScene
protected

◆ m_save_3DScene_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_save_3DScene_fname
protected

◆ m_save_graph

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_save_graph
protected

◆ m_save_graph_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_save_graph_fname
protected

◆ m_save_map

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_save_map
protected

◆ m_save_map_fname

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
std::string CGraphSlamHandler< GRAPH_T >::m_save_map_fname
protected

◆ m_user_decides_about_output_dir

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
bool CGraphSlamHandler< GRAPH_T >::m_user_decides_about_output_dir
protected

◆ m_win

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::gui::CDisplayWindow3D* CGraphSlamHandler< GRAPH_T >::m_win
protected

◆ m_win_manager

◆ m_win_observer




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020