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 
)

Definition at line 18 of file CGraphSlamHandler_impl.h.

References ASSERTDEB_, CGraphSlamHandler< GRAPH_T >::initVisualization(), CGraphSlamHandler< GRAPH_T >::m_enable_visuals, CGraphSlamHandler< GRAPH_T >::m_logger, and CGraphSlamHandler< GRAPH_T >::m_options_checker.

Here is the call graph for this function:

◆ ~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.

Here is the call graph for this function:

◆ getParamsAsString() [1/2]

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

◆ getParamsAsString() [2/2]

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

Definition at line 319 of file CGraphSlamHandler_impl.h.

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

Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initVisualization()

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

Initialize visualization (e.g.

the CDisplayWindow instance that shows the overall graphSLAM execution)

Definition at line 405 of file CGraphSlamHandler_impl.h.

References mrpt::gui::CDisplayWindow3D::get3DSceneAndLock(), mrpt::system::COutputLogger::logFmt(), mrpt::system::LVL_DEBUG, CGraphSlamHandler< GRAPH_T >::m_logger, CGraphSlamHandler< GRAPH_T >::m_win, CGraphSlamHandler< GRAPH_T >::m_win_manager, CGraphSlamHandler< GRAPH_T >::m_win_observer, mrpt::system::CObserver::observeBegin(), mrpt::graphslam::CWindowManager::setCDisplayWindow3DPtr(), mrpt::gui::CDisplayWindow3D::setPos(), mrpt::graphslam::CWindowManager::setWindowObserverPtr(), and mrpt::gui::CDisplayWindow3D::unlockAccess3DScene().

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

Here is the call graph for this function:
Here is the caller graph for this function:

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

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

Here is the call graph for this function:

◆ 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readConfigFname()

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

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

See also
printParams

Definition at line 216 of file CGraphSlamHandler_impl.h.

References ASSERTDEBMSG_, mrpt::system::fileExists(), mrpt::format(), mrpt::system::COutputLogger::logFmt(), mrpt::system::LVL_INFO, CGraphSlamHandler< GRAPH_T >::m_logger, CGraphSlamHandler< GRAPH_T >::m_output_dir_fname, CGraphSlamHandler< GRAPH_T >::m_save_3DScene, CGraphSlamHandler< GRAPH_T >::m_save_3DScene_fname, CGraphSlamHandler< GRAPH_T >::m_save_graph, CGraphSlamHandler< GRAPH_T >::m_save_graph_fname, CGraphSlamHandler< GRAPH_T >::m_save_map, CGraphSlamHandler< GRAPH_T >::m_save_map_fname, CGraphSlamHandler< GRAPH_T >::m_user_decides_about_output_dir, mrpt::config::CConfigFileBase::read_bool(), and mrpt::config::CConfigFileBase::read_string().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveMap()

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

Definition at line 367 of file CGraphSlamHandler_impl.h.

References mrpt::maps::COccupancyGridMap2D::Create(), and CGraphSlamHandler< GRAPH_T >::m_engine.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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() 
)

Set the relevant filenames for instantiating CGraphSlamEngine instance.

Definition at line 202 of file CGraphSlamHandler_impl.h.

References CGraphSlamHandler< GRAPH_T >::m_gt_fname, CGraphSlamHandler< GRAPH_T >::m_has_set_fnames, CGraphSlamHandler< GRAPH_T >::m_ini_fname, CGraphSlamHandler< GRAPH_T >::m_rawlog_fname, and CGraphSlamHandler< GRAPH_T >::readConfigFname().

Here is the call graph for this function:

◆ setResultsDirName()

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

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

Definition at line 327 of file CGraphSlamHandler_impl.h.

References mrpt::system::fileNameStripInvalidChars(), mrpt::system::COutputLogger::logFmt(), mrpt::system::LVL_WARN, CGraphSlamHandler< GRAPH_T >::m_logger, and CGraphSlamHandler< GRAPH_T >::m_output_dir_fname.

Here is the call graph for this function:

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.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020