MRPT  2.0.4
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
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.

CGraphSlamHandler class instances deal with the following:

Definition at line 34 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=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. 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...
 
void getParamsAsString (std::string *str) const
 Fetch the general configuraiton variables for the current graphSLAM execution. More...
 
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::CGraphSlamEngine< GRAPH_T > * m_engine = nullptr
 
mrpt::graphslam::CWindowManagerm_win_manager = nullptr
 
mrpt::graphslam::CWindowObserverm_win_observer = nullptr
 
mrpt::gui::CDisplayWindow3Dm_win = nullptr
 
mrpt::system::COutputLoggerm_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. More...
 
bool m_do_save_results = true
 
bool m_has_set_fnames = false
 
bool m_enable_visuals
 

Constructor & Destructor Documentation

◆ CGraphSlamHandler()

template<class GRAPH_T >
CGraphSlamHandler< GRAPH_T >::CGraphSlamHandler ( mrpt::system::COutputLogger logger,
mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T > *  options_checker,
const bool  enable_visuals = true 
)

◆ ~CGraphSlamHandler()

template<class GRAPH_T >
CGraphSlamHandler< GRAPH_T >::~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 377 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]

template<class GRAPH_T >
std::string CGraphSlamHandler< GRAPH_T >::getParamsAsString

Definition at line 319 of file CGraphSlamHandler_impl.h.

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

◆ getParamsAsString() [2/2]

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

◆ initEngine()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::initEngine ( const std::string &  node_reg_str,
const std::string &  edge_reg_str,
const std::string &  optimizer_str 
)

◆ 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 100 of file CGraphSlamHandler_impl.h.

References ASSERTDEBMSG_, mrpt::system::createDirectory(), mrpt::system::deleteFilesInDirectory(), mrpt::system::directoryExists(), mrpt::system::fileNameStripInvalidChars(), mrpt::format(), 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()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::initVisualization

◆ printParams()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::printParams

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

See also
readConfigFname, getParamsAsString

Definition at line 276 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 434 of file CGraphSlamHandler_impl.h.

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

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

◆ readConfigFname()

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

◆ saveMap()

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

◆ saveResults()

template<class GRAPH_T >
void CGraphSlamHandler< GRAPH_T >::saveResults ( const std::string &  output_dir_fname)
protected

◆ 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 = true
protected

◆ m_enable_visuals

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

◆ m_engine

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::graphslam::CGraphSlamEngine<GRAPH_T>* CGraphSlamHandler< GRAPH_T >::m_engine = nullptr
protected

◆ 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 = false
protected

◆ m_ini_fname

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

◆ m_logger

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::system::COutputLogger* CGraphSlamHandler< GRAPH_T >::m_logger
protected

◆ 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 137 of file CGraphSlamHandler.h.

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

◆ m_output_dir_fname

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

◆ 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 = nullptr
protected

◆ m_win_manager

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::graphslam::CWindowManager* CGraphSlamHandler< GRAPH_T >::m_win_manager = nullptr
protected

◆ m_win_observer

template<class GRAPH_T = mrpt::graphs::CNetworkOfPoses2DInf>
mrpt::graphslam::CWindowObserver* CGraphSlamHandler< GRAPH_T >::m_win_observer = nullptr
protected



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 17:54:30 UTC 2020