Main MRPT website > C++ reference for MRPT 1.4.0
CMetricMapBuilder.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-2016, 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 CMetricMapBuilder_H
10#define CMetricMapBuilder_H
11
15#include <mrpt/synch.h>
21
23
24namespace mrpt
25{
26namespace slam
27{
28 /** @defgroup metric_slam_grp Metric SLAM algorithms
29 * \ingroup mrpt_slam_grp */
30
31 /** This virtual class is the base for SLAM implementations. See derived classes for more information.
32 *
33 * \sa CMetricMap \ingroup metric_slam_grp
34 */
36 {
37 protected:
38 /** Critical zones
39 */
41
42 /** Enter critical section for map updating:
43 */
44 inline void enterCriticalSection() { critZoneChangingMap.enter(); }
45
46 /** Leave critical section for map updating:
47 */
48 inline void leaveCriticalSection() { critZoneChangingMap.leave(); }
49
50 public:
51 CMetricMapBuilder(); //!< Constructor
52 virtual ~CMetricMapBuilder( ); //!< Destructor.
53
54 // ---------------------------------------------------------------------
55 /** @name Pure virtual methods to implement in any particular SLAM algorithm
56 @{ */
57
58 /** Initialize the method, starting with a known location PDF "x0"(if supplied, set to NULL to left unmodified) and a given fixed, past map. */
59 virtual void initialize(
61 mrpt::poses::CPosePDF *x0 = NULL
62 ) = 0;
63
64 /** Returns a copy of the current best pose estimation as a pose PDF. */
66
67 /** Process a new action and observations pair to update this map: See the description of the class at the top of this page to see a more complete description.
68 * \param action The estimation of the incremental pose change in the robot pose.
69 * \param observations The set of observations that robot senses at the new pose.
70 */
72
73 /** Fills "out_map" with the set of "poses"-"sensory-frames", thus the so far built map. */
74 virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap &out_map) const = 0;
75
76 /** Returns just how many sensory-frames are stored in the currently build map. */
77 virtual unsigned int getCurrentlyBuiltMapSize() = 0;
78
79 /** Returns the map built so far. NOTE that for efficiency a pointer to the internal object is passed, DO NOT delete nor modify the object in any way, if desired, make a copy of ir with "duplicate()". */
81
82 /** A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
83 * \param file The output file name
84 * \param formatEMF_BMP Output format = true:EMF, false:BMP
85 */
86 virtual void saveCurrentEstimationToImage(const std::string &file, bool formatEMF_BMP = true) = 0;
87
88 /** @} */
89 // ---------------------------------------------------------------------
90
91 /** Clear all elements of the maps, and reset localization to (0,0,0deg). */
92 void clear();
93
94 /** Enables or disables the map updating (default state is enabled) */
95 void enableMapUpdating( bool enable )
96 {
97 options.enableMapUpdating = enable;
98 }
99
100 /** Load map (mrpt::maps::CSimpleMap) from a ".simplemap" file */
101 void loadCurrentMapFromFile(const std::string &fileName);
102
103 /** Save map (mrpt::maps::CSimpleMap) to a ".simplemap" file. */
104 void saveCurrentMapToFile(const std::string &fileName, bool compressGZ=true) const;
105
106 /** Options for the algorithm */
108 {
109 TOptions() : verbose(true),
110 enableMapUpdating(true),
111 debugForceInsertion(false),
112 alwaysInsertByClass()
113 {
114 }
115
116 bool verbose; //!< If true shows debug information in the console, default is true.
117 bool enableMapUpdating; //!< Enable map updating, default is true.
118 bool debugForceInsertion; //!< Always insert into map. Default is false: detect if necesary.
119
120 /** A list of observation classes (derived from mrpt::obs::CObservation) which will be always inserted in the map, disregarding the minimum insertion distances).
121 * Default: Empty. How to insert classes:
122 * \code
123 * alwaysInserByClass.insert(CLASS_ID(CObservationImage));
124 * \endcode
125 * \sa mrpt::utils::CListOfClasses
126 */
128
129 };
130
132
133 public:
135
136 }; // End of class def.
137
138 } // End of namespace
139} // End of namespace
140
141#endif
This class stores any customizable set of metric maps.
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Declares a class for storing a collection of robot actions.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition CPosePDF.h:40
This virtual class is the base for SLAM implementations.
void leaveCriticalSection()
Leave critical section for map updating:
void loadCurrentMapFromFile(const std::string &fileName)
Load map (mrpt::maps::CSimpleMap) from a ".simplemap" file.
virtual mrpt::poses::CPose3DPDFPtr getCurrentPoseEstimation() const =0
Returns a copy of the current best pose estimation as a pose PDF.
synch::CCriticalSection critZoneChangingMap
Critical zones.
virtual void processActionObservation(mrpt::obs::CActionCollection &action, mrpt::obs::CSensoryFrame &observations)=0
Process a new action and observations pair to update this map: See the description of the class at th...
void clear()
Clear all elements of the maps, and reset localization to (0,0,0deg).
virtual mrpt::maps::CMultiMetricMap * getCurrentlyBuiltMetricMap()=0
Returns the map built so far.
virtual void initialize(const mrpt::maps::CSimpleMap &initialMap=mrpt::maps::CSimpleMap(), mrpt::poses::CPosePDF *x0=NULL)=0
Initialize the method, starting with a known location PDF "x0"(if supplied, set to NULL to left unmod...
virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap &out_map) const =0
Fills "out_map" with the set of "poses"-"sensory-frames", thus the so far built map.
void saveCurrentMapToFile(const std::string &fileName, bool compressGZ=true) const
Save map (mrpt::maps::CSimpleMap) to a ".simplemap" file.
void enableMapUpdating(bool enable)
Enables or disables the map updating (default state is enabled)
virtual void saveCurrentEstimationToImage(const std::string &file, bool formatEMF_BMP=true)=0
A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
void enterCriticalSection()
Enter critical section for map updating:
virtual ~CMetricMapBuilder()
Destructor.
virtual unsigned int getCurrentlyBuiltMapSize()=0
Returns just how many sensory-frames are stored in the currently build map.
This class provides simple critical sections functionality.
void leave() const
Leave.
void enter() const
Enter.
This base class provides a common printf-like method to send debug information to std::cout,...
A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the...
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Definition memory.h:112
struct BASE_IMPEXP CPose3DPDFPtr
Definition CPose3DPDF.h:23
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool verbose
If true shows debug information in the console, default is true.
mrpt::utils::CListOfClasses alwaysInsertByClass
A list of observation classes (derived from mrpt::obs::CObservation) which will be always inserted in...
bool enableMapUpdating
Enable map updating, default is true.
bool debugForceInsertion
Always insert into map. Default is false: detect if necesary.



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Wed Dec 6 15:06:50 UTC 2023