Main MRPT website > C++ reference for MRPT 1.9.9
CHMTSLAM_main.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, 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 
10 /** An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
11  *
12  * The main entry points for a user are pushAction() and pushObservations().
13  *Several parameters can be modified
14  * through m_options.
15  *
16  * The mathematical models of this approach have been reported in:
17  * - Blanco J.L., Fernandez-Madrigal J.A., and Gonzalez J.,
18  * "Towards a Unified Bayesian Approach to Hybrid Metric-Topological
19  *SLAM",
20  * in IEEE Transactions on Robotics (TRO), Vol. 24, No. 2, April 2008.
21  * - ...
22  *
23  * More information in the wiki page: http://www.mrpt.org/HMT-SLAM
24  *
25  */
26 
27 #include "hmtslam-precomp.h" // Precomp header
28 
29 #include <mrpt/utils/CFileStream.h>
30 #include <mrpt/utils/CConfigFile.h>
32 #include <mrpt/system/filesystem.h>
34 
35 #include <mrpt/system/os.h>
36 
37 using namespace mrpt::slam;
38 using namespace mrpt::hmtslam;
39 using namespace mrpt::utils;
40 using namespace mrpt::obs;
41 using namespace mrpt::maps;
42 using namespace mrpt::opengl;
43 using namespace std;
44 
46 
47 // Initialization of static members:
48 int64_t CHMTSLAM::m_nextAreaLabel = 0;
49 TPoseID CHMTSLAM::m_nextPoseID = 0;
50 THypothesisID CHMTSLAM::m_nextHypID = COMMON_TOPOLOG_HYP + 1;
51 
52 /*---------------------------------------------------------------
53  Constructor
54  ---------------------------------------------------------------*/
55 CHMTSLAM::CHMTSLAM()
56 {
57  // Initialize data structures:
58  // ----------------------------
59  m_terminateThreads = false;
60  m_terminationFlag_LSLAM = m_terminationFlag_TBI =
61  m_terminationFlag_3D_viewer = false;
62 
63  // Create threads:
64  // -----------------------
65  m_hThread_LSLAM = std::thread(&CHMTSLAM::thread_LSLAM, this);
66  m_hThread_TBI = std::thread(&CHMTSLAM::thread_TBI, this);
67  m_hThread_3D_viewer = std::thread(&CHMTSLAM::thread_3D_viewer, this);
68 
69  // Other variables:
70  m_LSLAM_method = nullptr;
71 
72  // Register default LC detectors:
73  // --------------------------------
74  registerLoopClosureDetector(
75  "gridmaps", &CTopLCDetector_GridMatching::createNewInstance);
76  registerLoopClosureDetector(
77  "fabmap", &CTopLCDetector_FabMap::createNewInstance);
78 
79  // Prepare an empty map:
80  initializeEmptyMap();
81 }
82 
83 /*---------------------------------------------------------------
84  Destructor
85  ---------------------------------------------------------------*/
86 CHMTSLAM::~CHMTSLAM()
87 {
88  // Signal to threads that we are closing:
89  // -------------------------------------------
90  m_terminateThreads = true;
91 
92  // Wait for threads:
93  // ----------------------------------
94  MRPT_LOG_DEBUG("[CHMTSLAM::destructor] Waiting for threads end...\n");
95 
96  m_hThread_3D_viewer.join();
97  m_hThread_LSLAM.join();
98  m_hThread_TBI.join();
99 
100  MRPT_LOG_DEBUG("[CHMTSLAM::destructor] All threads finished.\n");
101 
102  // Save the resulting H.Map if logging
103  // --------------------------------------
104  if (!m_options.LOG_OUTPUT_DIR.empty())
105  {
106  try
107  {
108  /* // Update the last area(s) in the HMAP:
109  updateHierarchicalMapFromRBPF();
110 
111  // Save:
112  os::sprintf(auxFil,1000,"%s/hierarchicalMap.hmap",m_options.logOutputDirectory.c_str());
113 
114  CFileStream f(auxFil,fomWrite);
115  f << m_knownAreas;
116  */
117  }
118  catch (std::exception& e)
119  {
121  mrpt::format(
122  "Ignoring exception at ~CHMTSLAM():\n%s", e.what()));
123  }
124  catch (...)
125  {
126  MRPT_LOG_WARN("Ignoring untyped exception at ~CHMTSLAM()");
127  }
128  }
129 
130  // Delete data structures:
131  // ----------------------------------
132  clearInputQueue();
133 
134  // Others:
135  if (m_LSLAM_method)
136  {
137  delete m_LSLAM_method;
138  m_LSLAM_method = nullptr;
139  }
140 
141  // Delete TLC-detectors
142  {
143  std::lock_guard<std::mutex> lock(m_topLCdets_cs);
144 
145  // Clear old list:
146  for (std::deque<CTopLCDetectorBase*>::iterator it = m_topLCdets.begin();
147  it != m_topLCdets.end(); ++it)
148  delete *it;
149  m_topLCdets.clear();
150  }
151 }
152 
153 /*---------------------------------------------------------------
154  clearInputQueue
155  ---------------------------------------------------------------*/
156 void CHMTSLAM::clearInputQueue()
157 {
158  // Wait for critical section
159  {
160  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
161 
162  while (!m_inputQueue.empty())
163  {
164  // delete m_inputQueue.front();
165  m_inputQueue.pop();
166  };
167  }
168 }
169 
170 /*---------------------------------------------------------------
171  pushAction
172  ---------------------------------------------------------------*/
173 void CHMTSLAM::pushAction(const CActionCollection::Ptr& acts)
174 {
175  if (m_terminateThreads)
176  {
177  // Discard it:
178  // delete acts;
179  return;
180  }
181 
182  { // Wait for critical section
183  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
184  m_inputQueue.push(acts);
185  }
186 }
187 
188 /*---------------------------------------------------------------
189  pushObservations
190  ---------------------------------------------------------------*/
191 void CHMTSLAM::pushObservations(const CSensoryFrame::Ptr& sf)
192 {
193  if (m_terminateThreads)
194  {
195  // Discard it:
196  // delete sf;
197  return;
198  }
199 
200  { // Wait for critical section
201  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
202  m_inputQueue.push(sf);
203  }
204 }
205 
206 /*---------------------------------------------------------------
207  pushObservation
208  ---------------------------------------------------------------*/
209 void CHMTSLAM::pushObservation(const CObservation::Ptr& obs)
210 {
211  if (m_terminateThreads)
212  { // Discard it:
213  // delete obs;
214  return;
215  }
216 
217  // Add a CSensoryFrame with the obs:
218  CSensoryFrame::Ptr sf = mrpt::make_aligned_shared<CSensoryFrame>();
219  sf->insert(
220  obs); // memory will be freed when deleting the SF in other thread
221 
222  { // Wait for critical section
223  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
224  m_inputQueue.push(sf);
225  }
226 }
227 
228 /*---------------------------------------------------------------
229  loadOptions
230  ---------------------------------------------------------------*/
231 void CHMTSLAM::loadOptions(const mrpt::utils::CConfigFileBase& cfg)
232 {
233  m_options.loadFromConfigFile(cfg, "HMT-SLAM");
234 
235  m_options.defaultMapsInitializers.loadFromConfigFile(cfg, "MetricMaps");
236 
237  m_options.pf_options.loadFromConfigFile(cfg, "PARTICLE_FILTER");
238 
239  m_options.KLD_params.loadFromConfigFile(cfg, "KLD");
240 
241  m_options.AA_options.loadFromConfigFile(cfg, "GRAPH_CUT");
242 
243  // Topological Loop Closure detector options:
244  m_options.TLC_grid_options.loadFromConfigFile(cfg, "TLC_GRIDMATCHING");
245  m_options.TLC_fabmap_options.loadFromConfigFile(cfg, "TLC_FABMAP");
246 
247  m_options.dumpToConsole();
248 }
249 
250 /*---------------------------------------------------------------
251  loadOptions
252  ---------------------------------------------------------------*/
253 void CHMTSLAM::loadOptions(const std::string& configFile)
254 {
255  ASSERT_(mrpt::system::fileExists(configFile));
256  CConfigFile cfg(configFile);
257  loadOptions(cfg);
258 }
259 
260 /*---------------------------------------------------------------
261  TOptions
262  ---------------------------------------------------------------*/
263 CHMTSLAM::TOptions::TOptions()
264 {
265  LOG_OUTPUT_DIR = "";
266  LOG_FREQUENCY = 1;
267 
268  SLAM_METHOD = lsmRBPF_2DLASER;
269 
270  SLAM_MIN_DIST_BETWEEN_OBS = 1.0f;
271  SLAM_MIN_HEADING_BETWEEN_OBS = DEG2RAD(25.0f);
272 
273  MIN_ODOMETRY_STD_XY = 0;
274  MIN_ODOMETRY_STD_PHI = 0;
275 
276  VIEW3D_AREA_SPHERES_HEIGHT = 10.0f;
277  VIEW3D_AREA_SPHERES_RADIUS = 1.0f;
278 
279  random_seed = 1234;
280 
281  TLC_detectors.clear();
282 
283  stds_Q_no_odo.resize(3);
284  stds_Q_no_odo[0] = stds_Q_no_odo[1] = 0.10f;
285  stds_Q_no_odo[2] = DEG2RAD(4.0f);
286 }
287 
288 /*---------------------------------------------------------------
289  loadFromConfigFile
290  ---------------------------------------------------------------*/
291 void CHMTSLAM::TOptions::loadFromConfigFile(
292  const mrpt::utils::CConfigFileBase& source, const std::string& section)
293 {
294  MRPT_LOAD_CONFIG_VAR(LOG_OUTPUT_DIR, string, source, section);
295  MRPT_LOAD_CONFIG_VAR(LOG_FREQUENCY, int, source, section);
296 
298  SLAM_METHOD, int, TLSlamMethod, source, section);
299 
300  MRPT_LOAD_CONFIG_VAR(SLAM_MIN_DIST_BETWEEN_OBS, float, source, section);
301  MRPT_LOAD_CONFIG_VAR_DEGREES(SLAM_MIN_HEADING_BETWEEN_OBS, source, section);
302 
303  MRPT_LOAD_CONFIG_VAR(MIN_ODOMETRY_STD_XY, float, source, section);
304  MRPT_LOAD_CONFIG_VAR_DEGREES(MIN_ODOMETRY_STD_PHI, source, section);
305 
306  MRPT_LOAD_CONFIG_VAR(VIEW3D_AREA_SPHERES_HEIGHT, float, source, section);
307  MRPT_LOAD_CONFIG_VAR(VIEW3D_AREA_SPHERES_RADIUS, float, source, section);
308 
309  MRPT_LOAD_CONFIG_VAR(random_seed, int, source, section);
310 
311  stds_Q_no_odo[2] = RAD2DEG(stds_Q_no_odo[2]);
312  source.read_vector(section, "stds_Q_no_odo", stds_Q_no_odo, stds_Q_no_odo);
313  ASSERT_(stds_Q_no_odo.size() == 3)
314 
315  stds_Q_no_odo[2] = DEG2RAD(stds_Q_no_odo[2]);
316 
317  std::string sTLC_detectors =
318  source.read_string(section, "TLC_detectors", "", true);
319 
320  mrpt::system::tokenize(sTLC_detectors, ", ", TLC_detectors);
321 
322  std::cout << "TLC_detectors: " << TLC_detectors.size() << std::endl;
323 
324  // load other sub-classes:
325  AA_options.loadFromConfigFile(source, section);
326 }
327 
328 /*---------------------------------------------------------------
329  dumpToTextStream
330  ---------------------------------------------------------------*/
331 void CHMTSLAM::TOptions::dumpToTextStream(mrpt::utils::CStream& out) const
332 {
333  out.printf("\n----------- [CHMTSLAM::TOptions] ------------ \n\n");
334 
335  LOADABLEOPTS_DUMP_VAR(LOG_OUTPUT_DIR, string);
336  LOADABLEOPTS_DUMP_VAR(LOG_FREQUENCY, int);
337 
338  LOADABLEOPTS_DUMP_VAR(SLAM_METHOD, int);
339 
340  LOADABLEOPTS_DUMP_VAR(SLAM_MIN_DIST_BETWEEN_OBS, float);
341  LOADABLEOPTS_DUMP_VAR_DEG(SLAM_MIN_HEADING_BETWEEN_OBS);
342 
343  LOADABLEOPTS_DUMP_VAR(MIN_ODOMETRY_STD_XY, float);
344  LOADABLEOPTS_DUMP_VAR_DEG(MIN_ODOMETRY_STD_PHI);
345 
346  LOADABLEOPTS_DUMP_VAR(random_seed, int);
347 
348  AA_options.dumpToTextStream(out);
349  pf_options.dumpToTextStream(out);
350  KLD_params.dumpToTextStream(out);
351  defaultMapsInitializers.dumpToTextStream(out);
352  TLC_grid_options.dumpToTextStream(out);
353  TLC_fabmap_options.dumpToTextStream(out);
354 }
355 
356 /*---------------------------------------------------------------
357  isInputQueueEmpty
358  ---------------------------------------------------------------*/
359 bool CHMTSLAM::isInputQueueEmpty()
360 {
361  bool res;
362 
363  { // Wait for critical section
364  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
365  res = m_inputQueue.empty();
366  }
367  return res;
368 }
369 
370 /*---------------------------------------------------------------
371  inputQueueSize
372  ---------------------------------------------------------------*/
373 size_t CHMTSLAM::inputQueueSize()
374 {
375  size_t res;
376  { // Wait for critical section
377  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
378  res = m_inputQueue.size();
379  }
380  return res;
381 }
382 
383 /*---------------------------------------------------------------
384  getNextObjectFromInputQueue
385  ---------------------------------------------------------------*/
386 CSerializable::Ptr CHMTSLAM::getNextObjectFromInputQueue()
387 {
389 
390  { // Wait for critical section
391  std::lock_guard<std::mutex> lock(m_inputQueue_cs);
392  if (!m_inputQueue.empty())
393  {
394  obj = m_inputQueue.front();
395  m_inputQueue.pop();
396  }
397  }
398  return obj;
399 }
400 
401 /*---------------------------------------------------------------
402  initializeEmptyMap
403  ---------------------------------------------------------------*/
404 void CHMTSLAM::initializeEmptyMap()
405 {
406  THypothesisIDSet LMH_hyps;
407  THypothesisID newHypothID = generateHypothesisID();
408 
409  LMH_hyps.insert(COMMON_TOPOLOG_HYP);
410  LMH_hyps.insert(newHypothID);
411 
412  // ------------------------------------
413  // CLEAR HIERARCHICAL MAP
414  // ------------------------------------
415  CHMHMapNode::TNodeID firstAreaID;
416  {
417  std::lock_guard<std::mutex> lock(m_map_cs);
418 
419  // Initialize hierarchical structures:
420  // -----------------------------------------------------
421  m_map.clear();
422 
423  // Create a single node for the starting area:
424  CHMHMapNode::Ptr firstArea =
425  mrpt::make_aligned_shared<CHMHMapNode>(&m_map);
426  firstAreaID = firstArea->getID();
427 
428  firstArea->m_hypotheses = LMH_hyps;
430  new CMultiMetricMap(&m_options.defaultMapsInitializers));
431 
432  firstArea->m_nodeType.setType("Area");
433  firstArea->m_label = generateUniqueAreaLabel();
434  firstArea->m_annotations.set(
435  NODE_ANNOTATION_METRIC_MAPS, emptyMap, newHypothID);
436  firstArea->m_annotations.setElemental(
438  } // end of lock m_map_cs
439 
440  // ------------------------------------
441  // CLEAR LIST OF HYPOTHESES
442  // ------------------------------------
443  {
444  std::lock_guard<std::mutex> lock(m_LMHs_cs);
445 
446  // Add to the list:
447  m_LMHs.clear();
448  CLocalMetricHypothesis& newLMH = m_LMHs[newHypothID];
449  newLMH.m_parent = this;
450 
451  newLMH.m_currentRobotPose =
452  POSEID_INVALID; // Special case: map is empty
453  newLMH.m_log_w = 0;
454  newLMH.m_ID = newHypothID;
455 
456  newLMH.m_neighbors.clear();
457  newLMH.m_neighbors.insert(firstAreaID);
458 
459  newLMH.clearRobotPoses();
460  } // end of cs
461 
462  // ------------------------------------------
463  // Create the local SLAM algorithm object
464  // -----------------------------------------
465  switch (m_options.SLAM_METHOD)
466  {
467  case lsmRBPF_2DLASER:
468  {
469  if (m_LSLAM_method) delete m_LSLAM_method;
470  m_LSLAM_method = new CLSLAM_RBPF_2DLASER(this);
471  }
472  break;
473  default:
475  "Invalid selection for LSLAM method: %i",
476  (int)m_options.SLAM_METHOD);
477  };
478 
479  // ------------------------------------
480  // Topological LC detectors:
481  // ------------------------------------
482  {
483  std::lock_guard<std::mutex> lock(m_topLCdets_cs);
484 
485  // Clear old list:
486  for (std::deque<CTopLCDetectorBase*>::iterator it = m_topLCdets.begin();
487  it != m_topLCdets.end(); ++it)
488  delete *it;
489  m_topLCdets.clear();
490 
491  // Create new list:
492  // 1: Occupancy Grid matching.
493  // 2: Cummins' image matching.
494  for (vector_string::const_iterator d = m_options.TLC_detectors.begin();
495  d != m_options.TLC_detectors.end(); ++d)
496  m_topLCdets.push_back(loopClosureDetector_factory(*d));
497  }
498 
499  // ------------------------------------
500  // Other variables:
501  // ------------------------------------
502  m_LSLAM_queue.clear();
503 
504  // ------------------------------------
505  // Delete log files:
506  // ------------------------------------
507  if (!m_options.LOG_OUTPUT_DIR.empty())
508  {
509  mrpt::system::deleteFilesInDirectory(m_options.LOG_OUTPUT_DIR);
510  mrpt::system::createDirectory(m_options.LOG_OUTPUT_DIR);
511  mrpt::system::createDirectory(m_options.LOG_OUTPUT_DIR + "/HMAP_txt");
512  mrpt::system::createDirectory(m_options.LOG_OUTPUT_DIR + "/HMAP_3D");
513  mrpt::system::createDirectory(m_options.LOG_OUTPUT_DIR + "/LSLAM_3D");
514  mrpt::system::createDirectory(m_options.LOG_OUTPUT_DIR + "/ASSO");
516  m_options.LOG_OUTPUT_DIR + "/HMTSLAM_state");
517  }
518 }
519 
520 /*---------------------------------------------------------------
521  generateUniqueAreaLabel
522  ---------------------------------------------------------------*/
523 std::string CHMTSLAM::generateUniqueAreaLabel()
524 {
525  return format("%li", (long int)(m_nextAreaLabel++));
526 }
527 
528 /*---------------------------------------------------------------
529  generatePoseID
530  ---------------------------------------------------------------*/
531 TPoseID CHMTSLAM::generatePoseID() { return m_nextPoseID++; }
532 /*---------------------------------------------------------------
533  generateHypothesisID
534  ---------------------------------------------------------------*/
535 THypothesisID CHMTSLAM::generateHypothesisID() { return m_nextHypID++; }
536 /*---------------------------------------------------------------
537  getAs3DScene
538  ---------------------------------------------------------------*/
539 void CHMTSLAM::getAs3DScene(COpenGLScene& scene3D)
540 {
541  MRPT_UNUSED_PARAM(scene3D);
542 }
543 
544 /*---------------------------------------------------------------
545  abortedDueToErrors
546  ---------------------------------------------------------------*/
547 bool CHMTSLAM::abortedDueToErrors()
548 {
549  return m_terminationFlag_LSLAM || m_terminationFlag_TBI ||
550  m_terminationFlag_3D_viewer;
551 }
552 
553 /*---------------------------------------------------------------
554  registerLoopClosureDetector
555  ---------------------------------------------------------------*/
556 void CHMTSLAM::registerLoopClosureDetector(
557  const std::string& name, CTopLCDetectorBase* (*ptrCreateObject)(CHMTSLAM*))
558 {
559  m_registeredLCDetectors[name] = ptrCreateObject;
560 }
561 
562 /*---------------------------------------------------------------
563  loopClosureDetector_factory
564  ---------------------------------------------------------------*/
565 CTopLCDetectorBase* CHMTSLAM::loopClosureDetector_factory(
566  const std::string& name)
567 {
568  MRPT_START
570  m_registeredLCDetectors.find(name);
571  if (it == m_registeredLCDetectors.end())
573  "Invalid value for TLC_detectors: %s", name.c_str());
574  return it->second(this);
575  MRPT_END
576 }
577 
578 /*---------------------------------------------------------------
579  saveState
580  ---------------------------------------------------------------*/
581 bool CHMTSLAM::saveState(CStream& out) const
582 {
583  try
584  {
585  out << *this;
586  return true;
587  }
588  catch (...)
589  {
590  return false;
591  }
592 }
593 
594 /*---------------------------------------------------------------
595  loadState
596  ---------------------------------------------------------------*/
597 bool CHMTSLAM::loadState(CStream& in)
598 {
599  try
600  {
601  in >> *this;
602  return true;
603  }
604  catch (...)
605  {
606  return false;
607  }
608 }
609 
610 /*---------------------------------------------------------------
611  readFromStream
612  ---------------------------------------------------------------*/
613 void CHMTSLAM::readFromStream(mrpt::utils::CStream& in, int version)
614 {
615  switch (version)
616  {
617  case 0:
618  {
619  // Acquire all critical sections before!
620  // -------------------------------------------
621  // std::map< THypothesisID, CLocalMetricHypothesis >::const_iterator
622  // it;
623 
624  // std::lock_guard<std::mutex> LMHs( & m_LMHs_cs );
625  // for (it=m_LMHs.begin();it!=m_LMHs.end();it++)
626  // it->second.m_lock.lock();
627 
628  std::lock_guard<std::mutex> lock_map(m_map_cs);
629 
630  // Data:
631  in >> m_nextAreaLabel >> m_nextPoseID >> m_nextHypID;
632 
633  // The HMT-MAP:
634  in >> m_map;
635 
636  // The LMHs:
637  in >> m_LMHs;
638 
639  // Save options??? Better allow changing them...
640 
641  // Release all critical sections:
642  // for (it=m_LMHs.begin();it!=m_LMHs.end();it++)
643  // it->second.m_lock.lock();
644  }
645  break;
646  default:
648  };
649 }
650 
651 /*---------------------------------------------------------------
652  writeToStream
653  Implements the writing to a CStream capability of
654  CSerializable objects
655  ---------------------------------------------------------------*/
656 void CHMTSLAM::writeToStream(mrpt::utils::CStream& out, int* version) const
657 {
658  if (version)
659  *version = 0;
660  else
661  {
662  // Acquire all critical sections before!
663  // -------------------------------------------
664  // std::map< THypothesisID, CLocalMetricHypothesis >::const_iterator it;
665 
666  // std::lock_guard<std::mutex> LMHs( & m_LMHs_cs );
667  // for (it=m_LMHs.begin();it!=m_LMHs.end();it++)
668  // it->second.m_lock.lock();
669 
670  std::lock_guard<std::mutex> lock_map(m_map_cs);
671 
672  // Data:
673  out << m_nextAreaLabel << m_nextPoseID << m_nextHypID;
674 
675  // The HMT-MAP:
676  out << m_map;
677 
678  // The LMHs:
679  out << m_LMHs;
680 
681  // Save options??? Better allow changing them...
682 
683  // Release all critical sections:
684  // for (it=m_LMHs.begin();it!=m_LMHs.end();it++)
685  // it->second.m_lock.lock();
686  }
687 }
bool createDirectory(const std::string &dirName)
Creates a directory.
Definition: filesystem.cpp:158
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Implements a 2D local SLAM method based on a RBPF over an occupancy grid map.
Definition: CHMTSLAM.h:548
THypothesisID m_ID
The unique ID of the hypothesis (Used for accessing mrpt::slam::CHierarchicalMHMap).
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
#define LOADABLEOPTS_DUMP_VAR_DEG(variableName)
Macro for dumping a variable to a stream, transforming the argument from radians to degrees...
#define COMMON_TOPOLOG_HYP
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
This class allows loading and storing values and vectors of different types from ".ini" files easily.
Definition: CConfigFile.h:35
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Scalar * iterator
Definition: eigen_plugins.h:26
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
Definition: filesystem.cpp:127
double m_log_w
Log-weight of this hypothesis.
STL namespace.
#define MRPT_LOAD_CONFIG_VAR_CAST_NO_DEFAULT( variableName, variableType, variableTypeCast, configFileObject, sectionNameStr)
const Scalar * const_iterator
Definition: eigen_plugins.h:27
uint64_t TPoseID
An integer number uniquely identifying each robot pose stored in HMT-SLAM.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
Definition: CHMTSLAM.h:65
This class allows loading and storing values and vectors of different types from a configuration text...
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps. ...
#define MRPT_END
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define POSEID_INVALID
#define MRPT_LOG_WARN(_STRING)
__int64 int64_t
Definition: rptypes.h:49
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
mrpt::utils::safe_ptr< CHMTSLAM > m_parent
For quick access to our parent object.
This namespace contains representation of robot actions and observations.
std::shared_ptr< CMultiMetricMap > Ptr
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:19
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
#define MRPT_LOG_DEBUG(_STRING)
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
The virtual base class for Topological Loop-closure Detectors; used in HMT-SLAM.
This class is used in HMT-SLAM to represent each of the Local Metric Hypotheses (LMHs).
#define DEG2RAD
#define NODE_ANNOTATION_METRIC_MAPS
GLsizei const GLchar ** string
Definition: glext.h:4101
std::shared_ptr< CSerializable > Ptr
Definition: CSerializable.h:47
void tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) noexcept
Tokenizes a string according to a set of delimiting characters.
#define MRPT_START
#define RAD2DEG
std::shared_ptr< CActionCollection > Ptr
GLuint in
Definition: glext.h:7274
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
void clearRobotPoses()
Rebuild the auxiliary metric maps in "m_robotPosesGraph" from the observations "m_SFs" and their esti...
GLuint const GLchar * name
Definition: glext.h:4054
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
Definition: COpenGLScene.h:60
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
#define ASSERT_(f)
#define NODE_ANNOTATION_REF_POSEID
bool deleteFilesInDirectory(const std::string &s, bool deleteDirectoryAsWell=false)
Delete all the files in a given directory (nothing done if directory does not exists, or path is a file).
Definition: filesystem.cpp:214
std::shared_ptr< CHMHMapNode > Ptr
Definition: CHMHMapNode.h:42
#define MRPT_LOAD_CONFIG_VAR_DEGREES( variableName, configFileObject, sectionNameStr)
Loads a double variable, stored as radians but entered in the INI-file as degrees.
GLuint res
Definition: glext.h:7268
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
This class stores any customizable set of metric maps.
TNodeIDSet m_neighbors
The list of all areas sourronding the current one (this includes the current area itself)...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
Definition: CStream.cpp:597
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:47
TPoseID m_currentRobotPose
The current robot pose (its global unique ID) for this hypothesis.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019