Main MRPT website > C++ reference for MRPT 1.9.9
CHMTSLAM.h
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 #ifndef CHMTSLAM_H
10 #define CHMTSLAM_H
11 
14 
20 #include <mrpt/slam/CICP.h>
21 #include <mrpt/maps/CPointsMap.h>
22 #include <mrpt/slam/TKLDParams.h>
25 
26 #include <thread>
27 #include <queue>
28 
29 namespace mrpt
30 {
31 /** Classes related to the implementation of Hybrid Metric Topological (HMT)
32  * SLAM. \ingroup mrpt_hmtslam_grp */
33 namespace hmtslam
34 {
35 class CLSLAMAlgorithmBase;
36 class CLSLAM_RBPF_2DLASER;
37 
38 /** An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
39  *
40  * The main entry points for a user are pushAction() and pushObservations().
41  *Several parameters can be modified
42  * through m_options.
43  *
44  * The mathematical models of this approach have been reported in:
45  * - Blanco J.L., Fernandez-Madrigal J.A., and Gonzalez J., "Towards a
46  *Unified Bayesian Approach to Hybrid Metric-Topological SLAM", in IEEE
47  *Transactions on Robotics (TRO), Vol. 24, No. 2, April 2008.
48  * - ...
49  *
50  * More information in the wiki page: http://www.mrpt.org/HMT-SLAM . A complete
51  *working application can be found in "MRPT/apps/hmt-slam".
52  *
53  * The complete state of the SLAM framework is serializable, so it can be saved
54  *and restore to/from a binary dump. This class implements
55  *mrpt::utils::CSerializable, so
56  * it can be saved with "stream << slam_object;" and restored with "stream >>
57  *slam_object;". Alternatively, the methods CHMTSLAM::saveState and
58  *CHMTSLAM::loadState
59  * can be invoked, which in turn call internally to the CSerializable
60  *interface.
61  *
62  * \sa CHierarchicalMHMap
63  * \ingroup mrpt_hmtslam_grp
64  */
65 class CHMTSLAM : public mrpt::utils::COutputLogger,
67 {
68  friend class CLocalMetricHypothesis;
69  friend class CLSLAM_RBPF_2DLASER;
71  friend class CTopLCDetector_FabMap;
72 
74 
75  protected:
76  /** @name Inter-thread communication queues:
77  @{ */
78  /** Message definition:
79  - From: LSLAM
80  - To: AA
81  - Meaning: Reconsider the graph partition for the given LMH. Compute SSO
82  for the new node(s) "newPoseIDs".
83  */
84  /*struct TMessageAA
85  {
86  CLocalMetricHypothesis *LMH;
87  TPoseIDList newPoseIDs;
88  };*/
89 
90  /** Message definition:
91  - From: AA
92  - To: LSLAM
93  - Meaning: The partitioning of robot poses.
94  */
96  {
97  using Ptr = std::shared_ptr<TMessageLSLAMfromAA>;
98  /** The hypothesis ID (LMH) for these results. */
100  std::vector<TPoseIDList> partitions;
101 
102  /** for debugging only */
103  void dumpToConsole() const;
104  };
105 
106  /** Message definition:
107  - From: LSLAM
108  - To: TBI
109  - Meaning: One or more areas are to be considered by the TBI engines.
110  */
112  {
113  using Ptr = std::shared_ptr<TMessageLSLAMtoTBI>;
114  /** The LMH */
116  /** The areas to consider. */
118  };
119 
120  /** Message definition:
121  - From: TBI
122  - To: LSLAM
123  - Meaning:
124  */
126  {
127  using Ptr = std::shared_ptr<TMessageLSLAMfromTBI>;
128  /** The hypothesis ID (LMH) for these results. */
130 
131  /** The area for who the loop-closure has been computed. */
133 
134  struct TBI_info
135  {
137  /** Log likelihood for this loop-closure. */
138  double log_lik;
139 
140  /** Depending on the loop-closure engine, an guess of the relative
141  * pose of "area_new" relative to "cur_area" is given here.
142  * If the SOG contains 0 modes, then the engine does not provide
143  * this information.
144  */
146  };
147 
148  /** The meat is here: only feasible loop closures from "cur_area" are
149  * included here, with associated data.
150  */
151  std::map<CHMHMapNode::TNodeID, TBI_info> loopClosureData;
152 
153  // MRPT_MAKE_ALIGNED_OPERATOR_NEW
154  };
155 
156  /** LSLAM thread input queue, messages of type CHMTSLAM::TMessageLSLAMfromAA
157  */
159 
160  /** @} */
161 
162  /** The Area Abstraction (AA) method, invoked from LSLAM.
163  * \param LMH (IN) The LMH which to this query applies.
164  * \param newPoseIDs (IN) The new poseIDs to be added to the graph
165  * partitioner.
166  * \return A structure with all return data. Memory to be freed by user.
167  * \note The critical section for LMH must be locked BEFORE calling this
168  * method (it does NOT lock any critical section).
169  */
171  CLocalMetricHypothesis* LMH, const TPoseIDList& newPoseIDs);
172 
173  /** The entry point for Topological Bayesian Inference (TBI) engines,
174  * invoked from LSLAM.
175  * \param LMH (IN) The LMH which to this query applies.
176  * \param areaID (IN) The area ID to consider for potential loop-closures.
177  * \note The critical section for LMH must be locked BEFORE calling this
178  * method (it does NOT lock any critical section).
179  */
181  CLocalMetricHypothesis* LMH, const CHMHMapNode::TNodeID& areaID);
182 
183  /** @name Related to the input queue:
184  @{ */
185  public:
186  /** Empty the input queue. */
187  void clearInputQueue();
188 
189  /** Returns true if the input queue is empty (Note that the queue must not
190  * be empty to the user to enqueue more actions/observaitions)
191  * \sa pushAction,pushObservations, inputQueueSize
192  */
193  bool isInputQueueEmpty();
194 
195  /** Returns the number of objects waiting for processing in the input queue.
196  * \sa pushAction,pushObservations, isInputQueueEmpty
197  */
198  size_t inputQueueSize();
199 
200  /** Here the user can enter an action into the system (will go to the SLAM
201  * process).
202  * This class will delete the passed object when required, so DO NOT
203  * DELETE the passed object after calling this.
204  * \sa pushObservations,pushObservation
205  */
207 
208  /** Here the user can enter observations into the system (will go to the
209  * SLAM process).
210  * This class will delete the passed object when required, so DO NOT
211  * DELETE the passed object after calling this.
212  * \sa pushAction,pushObservation
213  */
215 
216  /** Here the user can enter an observation into the system (will go to the
217  * SLAM process).
218  * This class will delete the passed object when required, so DO NOT
219  * DELETE the passed object after calling this.
220  * \sa pushAction,pushObservation
221  */
223 
225  {
227  };
228 
229  protected:
230  /** Used from the LSLAM thread to retrieve the next object from the queue.
231  * \return The object, or nullptr if empty.
232  */
234 
235  /** The queue of pending actions/observations supplied by the user waiting
236  * for being processed. */
237  std::queue<mrpt::utils::CSerializable::Ptr> m_inputQueue;
238 
239  /** Critical section for accessing m_inputQueue */
240  mutable std::mutex m_inputQueue_cs;
241 
242  /** Critical section for accessing m_map */
243  mutable std::mutex m_map_cs;
244 
245  /** Critical section for accessing m_LMHs */
246  mutable std::mutex m_LMHs_cs;
247 
248  /** @} */
249 
250  /** @name Threads stuff
251  @{ */
252 
253  /** The function for the "Local SLAM" thread. */
254  void thread_LSLAM();
255 
256  /** The function for the "TBI" thread. */
257  void thread_TBI();
258 
259  /** The function for the "3D viewer" thread. */
260  void thread_3D_viewer();
261  /** Threads handles */
263  /** @} */
264 
265  /** @name HMT-SLAM sub-processes.
266  @{ */
267  /** Auxiliary method within thread_LSLAM */
269 
270  /** No critical section locks are assumed at the entrance of this method.
271  */
273 
274  /** No critical section locks are assumed at the entrance of this method.
275  */
277 
278  /** Topological Loop Closure: Performs all the required operations
279  to close a loop between two areas which have been determined
280  to be the same.
281  */
282  void perform_TLC(
283  CLocalMetricHypothesis& LMH, const CHMHMapNode::TNodeID areaInLMH,
284  const CHMHMapNode::TNodeID areaLoopClosure,
285  const mrpt::poses::CPose3DPDFGaussian& pose1wrt2);
286 
287  /** @} */
288 
289  /** @name The different SLAM algorithms that can be invoked from the LSLAM
290  thread.
291  @{ */
292 
293  /** An instance of a local SLAM method, to be applied to each LMH -
294  * initialized by "initializeEmptyMap" or "loadState".
295  */
297 
298  /** @} */
299 
300  /** @name The different Loop-Closure modules that are to be executed in the
301  TBI thread.
302  @{ */
303  protected:
304  typedef CTopLCDetectorBase* (*TLopLCDetectorFactory)(CHMTSLAM*);
305 
306  std::map<std::string, TLopLCDetectorFactory> m_registeredLCDetectors;
307 
308  /** The list of LC modules in operation - initialized by
309  * "initializeEmptyMap" or "loadState". */
310  std::deque<CTopLCDetectorBase*> m_topLCdets;
311 
312  /** The critical section for accessing m_topLCdets */
313  std::mutex m_topLCdets_cs;
314 
315  public:
316  /** Must be invoked before calling initializeEmptyMap, so LC objects can be
317  * created. */
319  const std::string& name,
320  CTopLCDetectorBase* (*ptrCreateObject)(CHMTSLAM*));
321 
322  /** The class factory for topological loop closure detectors.
323  * Possible values are enumerated in TOptions::TLC_detectors
324  *
325  * \exception std::exception On unknown name.
326  */
328 
329  /** @} */
330  protected:
331  /** Termination flag for signaling all threads to terminate */
333 
334  /** Threads termination flags:
335  */
338 
339  /** Generates a new and unique area textual label (currently this generates
340  * "0","1",...) */
342 
343  /** Generates a new and unique pose ID */
344  static TPoseID generatePoseID();
345 
346  /** Generates a new and unique hypothesis ID */
348 
352 
353  public:
354  /** Default constructor
355  * \param debug_out_stream If debug output messages should be redirected
356  * to any other stream apart from std::cout
357  */
358  CHMTSLAM();
359 
360  CHMTSLAM(const CHMTSLAM&) : mrpt::utils::COutputLogger()
361  {
362  THROW_EXCEPTION("This object cannot be copied.");
363  }
364  const CHMTSLAM& operator=(const CHMTSLAM&)
365  {
366  THROW_EXCEPTION("This object cannot be copied.");
367  }
368 
369  /** Destructor
370  */
371  virtual ~CHMTSLAM();
372 
373  /** Return true if an exception has been caught in any thread leading to the
374  * end of the mapping application: no more actions/observations will be
375  * processed from now on.
376  */
377  bool abortedDueToErrors();
378 
379  /** @name High-level map management
380  @{ */
381 
382  /** Loads the options from a config file. */
383  void loadOptions(const std::string& configFile);
384  /** Loads the options from a config source */
385  void loadOptions(const mrpt::utils::CConfigFileBase& cfgSource);
386 
387  /** Initializes the whole HMT-SLAM framework, reseting to an empty map (It
388  * also clears the logs directory) - this must be called AFTER loading the
389  * options with CHMTSLAM::loadOptions. */
390  void initializeEmptyMap();
391 
392  /** Save the state of the whole HMT-SLAM framework to some binary stream
393  * (e.g. a file).
394  * \return true if everything goes OK.
395  * \sa loadState
396  */
397  bool saveState(mrpt::utils::CStream& out) const;
398 
399  /** Load the state of the whole HMT-SLAM framework from some binary stream
400  * (e.g. a file).
401  * \return true if everything goes OK.
402  * \sa saveState
403  */
405  /** @} */
406 
407  /** @name The important data.
408  @{ */
409  /** The hiearchical, multi-hypothesis graph-based map. */
411  /** The list of LMHs at each instant. */
413  /** @} */
414 
415  /** Called from LSLAM thread when log files must be created.
416  */
417  void generateLogFiles(unsigned int nIteration);
418 
419  /** Gets a 3D representation of the current state of the whole mapping
420  * framework.
421  */
423 
424  protected:
425  /** A variety of options and configuration params (private, use
426  * loadOptions).
427  */
429  {
430  /** Initialization of default params
431  */
432  TOptions();
433 
434  void loadFromConfigFile(
436  const std::string& section) override; // See base docs
437  void dumpToTextStream(
438  mrpt::utils::CStream& out) const override; // See base docs
439 
440  /** [LOGGING] If it is not an empty string (""), a directory with that
441  * name will be created and log files save there. */
443  /** [LOGGING] One SLAM iteration out of "LOGGING_logFrequency", a log
444  * file will be generated. */
446 
447  /** [LSLAM] The method to use for local SLAM
448  */
450 
451  /** [LSLAM] Minimum distance (and heading) difference between
452  * observations inserted in the map.
453  */
455 
456  /** [LSLAM] Minimum uncertainty (1 sigma, meters) in x and y for
457  * odometry increments (Default=0) */
459 
460  /** [LSLAM] Minimum uncertainty (1 sigma, rads) in phi for odometry
461  * increments (Default=0) */
463 
464  /** [VIEW3D] The height of the areas' spheres.
465  */
467 
468  /** [VIEW3D] The radius of the areas' spheres.
469  */
471 
472  /** A 3-length vector with the std. deviation of the transition model in
473  * (x,y,phi) used only when there is no odometry (if there is odo, its
474  * uncertainty values will be used instead); x y: In meters, phi:
475  * radians (but in degrees when loading from a configuration ini-file!)
476  */
478 
479  /** [AA] The options for the partitioning algorithm
480  */
482 
483  /** The default set of maps to be created in each particle */
485  /** These params are used from every LMH object. */
488 
489  /** 0 means randomize, use any other value to have repetitive
490  * experiments. */
492 
493  /** A list of topological loop-closure detectors to use: can be one or
494  * more from this list:
495  * 'gridmaps': Occupancy Grid matching.
496  * 'fabmap': Mark Cummins' image matching framework.
497  */
499 
500  /** Options passed to this TLC constructor */
502  /** Options passed to this TLC constructor */
504 
505  } m_options;
506 
507 }; // End of class CHMTSLAM.
508 
509 /** Virtual base for local SLAM methods, used in mrpt::slam::CHMTSLAM.
510  */
512 {
514 
515  protected:
517 
518  public:
519  /** Constructor
520  */
521  CLSLAMAlgorithmBase(CHMTSLAM* parent) : m_parent(parent) {}
522  /** Destructor
523  */
524  virtual ~CLSLAMAlgorithmBase() {}
525  /** Main entry point from HMT-SLAM: process some actions & observations.
526  * The passed action/observation will be deleted, so a copy must be made
527  * if necessary.
528  * This method must be in charge of updating the robot pose estimates and
529  * also to update the
530  * map when required.
531  *
532  * \param LMH The local metric hypothesis which must be updated by this
533  * SLAM algorithm.
534  * \param act The action to process (or nullptr).
535  * \param sf The observations to process (or nullptr).
536  */
537  virtual void processOneLMH(
540  const mrpt::obs::CSensoryFrame::Ptr& sf) = 0;
541 
542 }; // end of class CLSLAMAlgorithmBase
543 
544 /** Implements a 2D local SLAM method based on a RBPF over an occupancy grid
545  * map.
546  * This class is used internally in mrpt::slam::CHMTSLAM
547  */
549 {
551 
552  public:
553  /** Constructor
554  */
555  CLSLAM_RBPF_2DLASER(CHMTSLAM* parent);
556 
557  /** Destructor
558  */
559  virtual ~CLSLAM_RBPF_2DLASER();
560 
561  /** Main entry point from HMT-SLAM: process some actions & observations.
562  * The passed action/observation will be deleted, so a copy must be made
563  * if necessary.
564  * This method must be in charge of updating the robot pose estimates and
565  * also to update the
566  * map when required.
567  *
568  * \param LMH The local metric hypothesis which must be updated by this
569  * SLAM algorithm.
570  * \param act The action to process (or nullptr).
571  * \param sf The observations to process (or nullptr).
572  */
573  void processOneLMH(
577 
578  template <class PF_ALGORITHM>
581  const mrpt::obs::CSensoryFrame* observation,
583 
584  protected:
585  /** For use within PF callback methods */
587 
588  /** Auxiliary structure
589  */
590  struct TPathBin
591  {
592  TPathBin() : x(), y(), phi() {}
594 
595  /** For debugging purposes!
596  */
597  void dumpToStdOut() const;
598  };
599 
600  /** Fills out a "TPathBin" variable, given a path hypotesis and (if not set
601  * to nullptr) a new pose appended at the end, using the KLD params in
602  * "options".
603  */
605  TPathBin& outBin, TMapPoseID2Pose3D* path = nullptr,
606  mrpt::poses::CPose2D* newPose = nullptr);
607 
608  /** Checks if a given "TPathBin" element is already into a set of them, and
609  * return its index (first one is 0), or -1 if not found.
610  */
611  int findTPathBinIntoSet(TPathBin& desiredBin, std::deque<TPathBin>& theSet);
612 
613 }; // end class CLSLAM_RBPF_2DLASER
614 
615 } // End of namespace
616 } // End of namespace
617 
618 #endif
float MIN_ODOMETRY_STD_PHI
[LSLAM] Minimum uncertainty (1 sigma, rads) in phi for odometry increments (Default=0) ...
Definition: CHMTSLAM.h:462
int random_seed
0 means randomize, use any other value to have repetitive experiments.
Definition: CHMTSLAM.h:491
float MIN_ODOMETRY_STD_XY
[LSLAM] Minimum uncertainty (1 sigma, meters) in x and y for odometry increments (Default=0) ...
Definition: CHMTSLAM.h:458
CLSLAMAlgorithmBase * m_LSLAM_method
An instance of a local SLAM method, to be applied to each LMH - initialized by "initializeEmptyMap" o...
Definition: CHMTSLAM.h:296
void perform_TLC(CLocalMetricHypothesis &LMH, const CHMHMapNode::TNodeID areaInLMH, const CHMHMapNode::TNodeID areaLoopClosure, const mrpt::poses::CPose3DPDFGaussian &pose1wrt2)
Topological Loop Closure: Performs all the required operations to close a loop between two areas whic...
void pushObservation(const mrpt::obs::CObservation::Ptr &obs)
Here the user can enter an observation into the system (will go to the SLAM process).
Implements a 2D local SLAM method based on a RBPF over an occupancy grid map.
Definition: CHMTSLAM.h:548
void thread_LSLAM()
The function for the "Local SLAM" thread.
std::map< CHMHMapNode::TNodeID, TBI_info > loopClosureData
The meat is here: only feasible loop closures from "cur_area" are included here, with associated data...
Definition: CHMTSLAM.h:151
int LOG_FREQUENCY
[LOGGING] One SLAM iteration out of "LOGGING_logFrequency", a log file will be generated.
Definition: CHMTSLAM.h:445
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
CTopLCDetector_FabMap::TOptions TLC_fabmap_options
Options passed to this TLC constructor.
Definition: CHMTSLAM.h:503
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
void prediction_and_update(CLocalMetricHypothesis *LMH, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
static TPoseID generatePoseID()
Generates a new and unique pose ID.
static TMessageLSLAMfromTBI::Ptr TBI_main_method(CLocalMetricHypothesis *LMH, const CHMHMapNode::TNodeID &areaID)
The entry point for Topological Bayesian Inference (TBI) engines, invoked from LSLAM.
std::thread m_hThread_TBI
Definition: CHMTSLAM.h:262
#define THROW_EXCEPTION(msg)
Declares a class that represents a Probability Density function (PDF) of a 3D(6D) pose ...
Definition: CPose3DPDFSOG.h:35
static TMessageLSLAMfromAA::Ptr areaAbstraction(CLocalMetricHypothesis *LMH, const TPoseIDList &newPoseIDs)
The Area Abstraction (AA) method, invoked from LSLAM.
Definition: CHMTSLAM_AA.cpp:33
static TPoseID m_nextPoseID
Definition: CHMTSLAM.h:350
void generateLogFiles(unsigned int nIteration)
Called from LSLAM thread when log files must be created.
bool m_terminationFlag_3D_viewer
Definition: CHMTSLAM.h:336
std::map< std::string, TLopLCDetectorFactory > m_registeredLCDetectors
Definition: CHMTSLAM.h:306
vector_string TLC_detectors
A list of topological loop-closure detectors to use: can be one or more from this list: &#39;gridmaps&#39;: O...
Definition: CHMTSLAM.h:498
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
Definition: eigen_frwds.h:42
Option set for KLD algorithm.
Definition: TKLDParams.h:20
THypothesisID hypothesisID
The hypothesis ID (LMH) for these results.
Definition: CHMTSLAM.h:99
std::mutex m_map_cs
Critical section for accessing m_map.
Definition: CHMTSLAM.h:243
CTopLCDetector_GridMatching::TOptions TLC_grid_options
Options passed to this TLC constructor.
Definition: CHMTSLAM.h:501
uint64_t TPoseID
An integer number uniquely identifying each robot pose stored in HMT-SLAM.
aligned_containers< THypothesisID, CLocalMetricHypothesis >::map_t m_LMHs
The list of LMHs at each instant.
Definition: CHMTSLAM.h:412
static THypothesisID m_nextHypID
Definition: CHMTSLAM.h:351
bool m_terminateThreads
Termination flag for signaling all threads to terminate.
Definition: CHMTSLAM.h:332
int findTPathBinIntoSet(TPathBin &desiredBin, std::deque< TPathBin > &theSet)
Checks if a given "TPathBin" element is already into a set of them, and return its index (first one i...
mrpt::poses::CPose3DPDFSOG delta_new_cur
Depending on the loop-closure engine, an guess of the relative pose of "area_new" relative to "cur_ar...
Definition: CHMTSLAM.h:145
utils::CMessageQueue m_LSLAM_queue
LSLAM thread input queue, messages of type CHMTSLAM::TMessageLSLAMfromAA.
Definition: CHMTSLAM.h:158
Virtual base for local SLAM methods, used in mrpt::slam::CHMTSLAM.
Definition: CHMTSLAM.h:511
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
static int64_t m_nextAreaLabel
Definition: CHMTSLAM.h:349
An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
Definition: CHMTSLAM.h:65
Declares a class for storing a collection of robot actions.
mrpt::utils::safe_ptr< CHMTSLAM > m_parent
Definition: CHMTSLAM.h:516
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...
CLSLAMAlgorithmBase(CHMTSLAM *parent)
Constructor.
Definition: CHMTSLAM.h:521
CHMTSLAM(const CHMTSLAM &)
Definition: CHMTSLAM.h:360
mrpt::utils::CSerializable::Ptr getNextObjectFromInputQueue()
Used from the LSLAM thread to retrieve the next object from the queue.
CHMHMapNode::TNodeID cur_area
The area for who the loop-closure has been computed.
Definition: CHMTSLAM.h:132
std::vector< std::string > vector_string
A type for passing a vector of strings.
Definition: types_simple.h:33
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
mrpt::slam::TKLDParams KLD_params
Definition: CHMTSLAM.h:487
mrpt::aligned_containers< TPoseID, mrpt::poses::CPose3D >::map_t TMapPoseID2Pose3D
bool m_terminationFlag_LSLAM
Threads termination flags:
Definition: CHMTSLAM.h:336
std::string LOG_OUTPUT_DIR
[LOGGING] If it is not an empty string (""), a directory with that name will be created and log files...
Definition: CHMTSLAM.h:442
std::queue< mrpt::utils::CSerializable::Ptr > m_inputQueue
The queue of pending actions/observations supplied by the user waiting for being processed.
Definition: CHMTSLAM.h:237
std::mutex m_LMHs_cs
Critical section for accessing m_LMHs.
Definition: CHMTSLAM.h:246
__int64 int64_t
Definition: rptypes.h:49
std::mutex m_topLCdets_cs
The critical section for accessing m_topLCdets.
Definition: CHMTSLAM.h:313
mrpt::maps::TSetOfMetricMapInitializers defaultMapsInitializers
The default set of maps to be created in each particle.
Definition: CHMTSLAM.h:484
std::shared_ptr< TMessageLSLAMfromTBI > Ptr
Definition: CHMTSLAM.h:127
std::vector< TPoseIDList > partitions
Definition: CHMTSLAM.h:100
std::deque< CTopLCDetectorBase * > m_topLCdets
The list of LC modules in operation - initialized by "initializeEmptyMap" or "loadState".
Definition: CHMTSLAM.h:310
virtual ~CLSLAMAlgorithmBase()
Destructor.
Definition: CHMTSLAM.h:524
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:54
std::thread m_hThread_3D_viewer
Definition: CHMTSLAM.h:262
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
CHierarchicalMHMap m_map
The hiearchical, multi-hypothesis graph-based map.
Definition: CHMTSLAM.h:410
THypothesisID hypothesisID
The hypothesis ID (LMH) for these results.
Definition: CHMTSLAM.h:129
mrpt::hmtslam::CHMTSLAM::TOptions m_options
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
void thread_TBI()
The function for the "TBI" thread.
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).
A thread-safe template queue for object passing between threads; for a template argument of T...
GLsizei const GLchar ** string
Definition: glext.h:4101
void getAs3DScene(mrpt::opengl::COpenGLScene &outScene)
Gets a 3D representation of the current state of the whole mapping framework.
TLSlamMethod SLAM_METHOD
[LSLAM] The method to use for local SLAM
Definition: CHMTSLAM.h:449
virtual ~CHMTSLAM()
Destructor.
std::vector< TPoseID > TPoseIDList
std::shared_ptr< CSerializable > Ptr
Definition: CSerializable.h:47
bayes::CParticleFilter::TParticleFilterOptions pf_options
These params are used from every LMH object.
Definition: CHMTSLAM.h:486
size_t inputQueueSize()
Returns the number of objects waiting for processing in the input queue.
bool saveState(mrpt::utils::CStream &out) const
Save the state of the whole HMT-SLAM framework to some binary stream (e.g.
mrpt::math::CVectorFloat stds_Q_no_odo
A 3-length vector with the std.
Definition: CHMTSLAM.h:477
A variety of options and configuration params (private, use loadOptions).
Definition: CHMTSLAM.h:428
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
TOptions()
Initialization of default params.
void loadOptions(const std::string &configFile)
Loads the options from a config file.
double log_lik
Log likelihood for this loop-closure.
Definition: CHMTSLAM.h:138
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void loadTPathBinFromPath(TPathBin &outBin, TMapPoseID2Pose3D *path=nullptr, mrpt::poses::CPose2D *newPose=nullptr)
Fills out a "TPathBin" variable, given a path hypotesis and (if not set to nullptr) a new pose append...
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void processOneLMH(CLocalMetricHypothesis *LMH, const mrpt::obs::CActionCollection::Ptr &act, const mrpt::obs::CSensoryFrame::Ptr &sf)
Main entry point from HMT-SLAM: process some actions & observations.
std::shared_ptr< CActionCollection > Ptr
void LSLAM_process_message(const mrpt::utils::CMessage &msg)
Auxiliary method within thread_LSLAM.
Options for a TLC-detector of type FabMap, used from CHMTSLAM.
Options for a TLC-detector of type gridmap-matching, used from CHMTSLAM.
mrpt::slam::CIncrementalMapPartitioner::TOptions AA_options
[AA] The options for the partitioning algorithm
Definition: CHMTSLAM.h:481
float VIEW3D_AREA_SPHERES_HEIGHT
[VIEW3D] The height of the areas&#39; spheres.
Definition: CHMTSLAM.h:466
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:40
const CHMTSLAM & operator=(const CHMTSLAM &)
Definition: CHMTSLAM.h:364
void LSLAM_process_message_from_TBI(const TMessageLSLAMfromTBI &myMsg)
No critical section locks are assumed at the entrance of this method.
std::shared_ptr< TMessageLSLAMtoTBI > Ptr
Definition: CHMTSLAM.h:113
void clearInputQueue()
Empty the input queue.
void registerLoopClosureDetector(const std::string &name, CTopLCDetectorBase *(*ptrCreateObject)(CHMTSLAM *))
Must be invoked before calling initializeEmptyMap, so LC objects can be created.
The configuration of a particle filter.
float VIEW3D_AREA_SPHERES_RADIUS
[VIEW3D] The radius of the areas&#39; spheres.
Definition: CHMTSLAM.h:470
bool loadState(mrpt::utils::CStream &in)
Load the state of the whole HMT-SLAM framework from some binary stream (e.g.
void pushAction(const mrpt::obs::CActionCollection::Ptr &acts)
Here the user can enter an action into the system (will go to the SLAM process).
GLuint in
Definition: glext.h:7274
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model...
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
TNodeIDList areaIDs
The areas to consider.
Definition: CHMTSLAM.h:117
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
GLenum GLint GLint y
Definition: glext.h:3538
static std::string generateUniqueAreaLabel()
Generates a new and unique area textual label (currently this generates "0","1",...)
CLSLAM_RBPF_2DLASER(CHMTSLAM *parent)
Constructor.
std::map< TYPE1, TYPE2, std::less< TYPE1 >, Eigen::aligned_allocator< std::pair< const TYPE1, TYPE2 > > > map_t
std::vector< int32_t > vector_int
Definition: types_simple.h:24
void thread_3D_viewer()
The function for the "3D viewer" thread.
CLocalMetricHypothesis * LMH
The LMH.
Definition: CHMTSLAM.h:115
GLenum GLint x
Definition: glext.h:3538
bool m_insertNewRobotPose
For use within PF callback methods.
Definition: CHMTSLAM.h:586
std::thread m_hThread_LSLAM
Threads handles.
Definition: CHMTSLAM.h:262
float SLAM_MIN_DIST_BETWEEN_OBS
[LSLAM] Minimum distance (and heading) difference between observations inserted in the map...
Definition: CHMTSLAM.h:454
virtual void processOneLMH(CLocalMetricHypothesis *LMH, const mrpt::obs::CActionCollection::Ptr &act, const mrpt::obs::CSensoryFrame::Ptr &sf)=0
Main entry point from HMT-SLAM: process some actions & observations.
CTopLCDetectorBase * loopClosureDetector_factory(const std::string &name)
The class factory for topological loop closure detectors.
bool isInputQueueEmpty()
Returns true if the input queue is empty (Note that the queue must not be empty to the user to enqueu...
CHMTSLAM()
Default constructor.
std::shared_ptr< TMessageLSLAMfromAA > Ptr
Definition: CHMTSLAM.h:97
void pushObservations(const mrpt::obs::CSensoryFrame::Ptr &sf)
Here the user can enter observations into the system (will go to the SLAM process).
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
Definition: CMessage.h:31
static THypothesisID generateHypothesisID()
Generates a new and unique hypothesis ID.
void LSLAM_process_message_from_AA(const TMessageLSLAMfromAA &myMsg)
No critical section locks are assumed at the entrance of this method.
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:75
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:47
void dumpToConsole() const
for debugging only
std::mutex m_inputQueue_cs
Critical section for accessing m_inputQueue.
Definition: CHMTSLAM.h:240
void initializeEmptyMap()
Initializes the whole HMT-SLAM framework, reseting to an empty map (It also clears the logs directory...
bool abortedDueToErrors()
Return true if an exception has been caught in any thread leading to the end of the mapping applicati...



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