Main MRPT website > C++ reference for MRPT 1.9.9
CMetricMapBuilderRBPF.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-2018, 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 CMetricMapBuilderRBPF_H
10 #define CMetricMapBuilderRBPF_H
11 
15 
20 
21 namespace mrpt
22 {
23 namespace slam
24 {
25 /** This class implements a Rao-Blackwelized Particle Filter (RBPF) approach to
26  * map building (SLAM).
27  * Internally, the list of particles, each containing a hypothesis for the
28  * robot path plus its associated
29  * metric map, is stored in an object of class CMultiMetricMapPDF.
30  *
31  * This class processes robot actions and observations sequentially (through
32  * the method CMetricMapBuilderRBPF::processActionObservation)
33  * and exploits the generic design of metric map classes in MRPT to deal with
34  * any number and combination of maps simultaneously: the likelihood
35  * of observations is the product of the likelihood in the different maps,
36  * etc.
37  *
38  * A number of particle filter methods are implemented as well, by selecting
39  * the appropriate values in TConstructionOptions::PF_options.
40  * Not all the PF algorithms are implemented for all kinds of maps.
41  *
42  * For an example of usage, check the application "rbpf-slam", in
43  * "apps/RBPF-SLAM". See also the <a
44  * href="http://www.mrpt.org/Application:RBPF-SLAM" >wiki page</a>.
45  *
46  * \note Since MRPT 0.7.2, the new variables
47  * "localizeLinDistance,localizeAngDistance" are introduced to provide a way to
48  * update the robot pose at a different rate than the map is updated.
49  * \note Since MRPT 0.7.1 the semantics of the parameters
50  * "insertionLinDistance" and "insertionAngDistance" changes: the entire RBFP is
51  * now NOT updated unless odometry increments surpass the threshold (previously,
52  * only the map was NOT updated). This is done to gain efficiency.
53  * \note Since MRPT 0.6.2 this class implements full 6D SLAM. Previous versions
54  * worked in 2D + heading only.
55  *
56  * \sa CMetricMap \ingroup metric_slam_grp
57  */
59 {
60  public:
61  /** The map PDF: It includes a path and associated map for each particle. */
63 
64  protected:
65  /** The configuration of the particle filter */
67 
68  /** Distances (linear and angular) for inserting a new observation into the
69  * map. */
71 
72  /** Distances (linear and angular) for updating the robot pose estimate (and
73  * particles weighs, if applicable). */
75 
76  /** Traveled distance since last localization update */
78  /** Traveled distance since last map update */
80 
81  public:
82  /** Options for building a CMetricMapBuilderRBPF object, passed to the
83  * constructor.
84  */
86  {
87  public:
88  /** Constructor */
90  void loadFromConfigFile(
92  const std::string& section) override; // See base docs
93  void dumpToTextStream(
94  std::ostream& out) const override; // See base docs
95 
98 
101 
103 
107  };
108 
109  /** Constructor. */
110  CMetricMapBuilderRBPF(const TConstructionOptions& initializationOptions);
111 
112  /** This second constructor is created for the situation where a class
113 member needs to be
114 of type CMetricMapBuilderRBPF */
116 
117  /** Copy Operator. */
119 
120  /** Destructor. */
121  virtual ~CMetricMapBuilderRBPF();
122 
123  /** Initialize the method, starting with a known location PDF "x0"(if
124  * supplied, set to nullptr to left unmodified) and a given fixed, past map.
125  */
126  void initialize(
127  const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(),
128  const mrpt::poses::CPosePDF* x0 = nullptr);
129 
130  /** Clear all elements of the maps.
131  */
132  void clear();
133 
134  /** Returns a copy of the current best pose estimation as a pose PDF.
135  */
137 
138  /** Returns the current most-likely path estimation (the path associated to
139  * the most likely particle).
140  */
142  std::deque<mrpt::math::TPose3D>& outPath) const;
143 
144  /** Appends a new action and observations to update this map: See the
145  *description of the class at the top of this page to see a more complete
146  *description.
147  * \param action The incremental 2D pose change in the robot pose. This
148  *value is deterministic.
149  * \param observations The set of observations that robot senses at the new
150  *pose.
151  * Statistics will be saved to statsLastIteration
152  */
155  mrpt::obs::CSensoryFrame& observations);
156 
157  /** Fills "out_map" with the set of "poses"-"sensory-frames", thus the so
158  * far built map.
159  */
160  void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const;
161 
162  /** Returns the map built so far. NOTE that for efficiency a pointer to the
163  * internal object is passed, DO NOT delete nor modify the object in any
164  * way, if desired, make a copy of ir with "clone()".
165  */
167 
168  /** Returns just how many sensory-frames are stored in the currently build
169  * map.
170  */
171  unsigned int getCurrentlyBuiltMapSize();
172 
173  /** A useful method for debugging: the current map (and/or poses) estimation
174  * is dumped to an image file.
175  * \param file The output file name
176  * \param formatEMF_BMP Output format = true:EMF, false:BMP
177  */
179  const std::string& file, bool formatEMF_BMP = true);
180 
181  /** A useful method for debugging: draws the current map and path hypotheses
182  * to a CCanvas */
184 
185  /** A logging utility: saves the current path estimation for each particle
186  * in a text file (a row per particle, each 3-column-entry is a set
187  * [x,y,phi], respectively).
188  */
190 
191  double getCurrentJointEntropy();
192 
193  /** This structure will hold stats after each execution of
194  * processActionObservation
195  */
196  struct TStats
197  {
199  /** Whether the SF has been inserted in the metric maps. */
201  };
202 
203  /** This structure will hold stats after each execution of
204  * processActionObservation */
206 
207 }; // End of class def.
208 
209 } // end NS
210 } // end NS
211 #endif
mrpt::slam::CMetricMapBuilderRBPF::TStats::TStats
TStats()
Definition: CMetricMapBuilderRBPF.h:198
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::localizeAngDistance
float localizeAngDistance
Definition: CMetricMapBuilderRBPF.h:100
mrpt::poses::CPose3DPDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
Definition: CPose3DPDFGaussian.h:40
mrpt::slam::CMetricMapBuilderRBPF::odoIncrementSinceLastMapUpdate
mrpt::poses::CPose3D odoIncrementSinceLastMapUpdate
Traveled distance since last map update.
Definition: CMetricMapBuilderRBPF.h:79
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMetricMap
const mrpt::maps::CMultiMetricMap * getCurrentlyBuiltMetricMap() const
Returns the map built so far.
Definition: CMetricMapBuilderRBPF.cpp:366
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: CMetricMapBuilderRBPF.cpp:575
mrpt::slam::CMetricMapBuilderRBPF::m_PF_options
bayes::CParticleFilter::TParticleFilterOptions m_PF_options
The configuration of the particle filter.
Definition: CMetricMapBuilderRBPF.h:66
mrpt::slam::CMetricMapBuilderRBPF::getCurrentMostLikelyPath
void getCurrentMostLikelyPath(std::deque< mrpt::math::TPose3D > &outPath) const
Returns the current most-likely path estimation (the path associated to the most likely particle).
Definition: CMetricMapBuilderRBPF.cpp:338
mrpt::slam::CMetricMapBuilderRBPF::TStats::observationsInserted
bool observationsInserted
Whether the SF has been inserted in the metric maps.
Definition: CMetricMapBuilderRBPF.h:200
src
GLuint src
Definition: glext.h:7278
CMultiMetricMap.h
mrpt::slam::CMetricMapBuilderRBPF::processActionObservation
void processActionObservation(mrpt::obs::CActionCollection &action, mrpt::obs::CSensoryFrame &observations)
Appends a new action and observations to update this map: See the description of the class at the top...
Definition: CMetricMapBuilderRBPF.cpp:105
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::insertionLinDistance
float insertionLinDistance
Definition: CMetricMapBuilderRBPF.h:96
mrpt::slam::CMetricMapBuilderRBPF
This class implements a Rao-Blackwelized Particle Filter (RBPF) approach to map building (SLAM).
Definition: CMetricMapBuilderRBPF.h:58
CMultiMetricMapPDF.h
mrpt::obs::CActionCollection
Declares a class for storing a collection of robot actions.
Definition: CActionCollection.h:28
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
CParticleFilter.h
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::verbosity_level
mrpt::system::VerbosityLevel verbosity_level
Definition: CMetricMapBuilderRBPF.h:106
mrpt::slam::CMetricMapBuilderRBPF::saveCurrentPathEstimationToTextFile
void saveCurrentPathEstimationToTextFile(const std::string &fil)
A logging utility: saves the current path estimation for each particle in a text file (a row per part...
Definition: CMetricMapBuilderRBPF.cpp:513
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::TConstructionOptions
TConstructionOptions()
Constructor.
Definition: CMetricMapBuilderRBPF.cpp:522
mrpt::slam::CMetricMapBuilderRBPF::CMetricMapBuilderRBPF
CMetricMapBuilderRBPF()
This second constructor is created for the situation where a class member needs to be of type CMetric...
Definition: CMetricMapBuilderRBPF.cpp:50
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::maps::TSetOfMetricMapInitializers
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
Definition: TMetricMapInitializer.h:91
mrpt::slam::CMetricMapBuilderRBPF::m_statsLastIteration
TStats m_statsLastIteration
This structure will hold stats after each execution of processActionObservation.
Definition: CMetricMapBuilderRBPF.h:205
mrpt::slam::CMetricMapBuilderRBPF::saveCurrentEstimationToImage
void saveCurrentEstimationToImage(const std::string &file, bool formatEMF_BMP=true)
A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
Definition: CMetricMapBuilderRBPF.cpp:480
mrpt::obs::CSensoryFrame
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:54
mrpt::img::CCanvas
This virtual class defines the interface of any object accepting drawing primitives on it.
Definition: CCanvas.h:42
mrpt::system::VerbosityLevel
VerbosityLevel
Enumeration of available verbosity levels.
Definition: system/COutputLogger.h:28
mrpt::slam::CMetricMapBuilderRBPF::odoIncrementSinceLastLocalization
mrpt::poses::CPose3DPDFGaussian odoIncrementSinceLastLocalization
Traveled distance since last localization update.
Definition: CMetricMapBuilderRBPF.h:77
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMapSize
unsigned int getCurrentlyBuiltMapSize()
Returns just how many sensory-frames are stored in the currently build map.
Definition: CMetricMapBuilderRBPF.cpp:374
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::PF_options
bayes::CParticleFilter::TParticleFilterOptions PF_options
Definition: CMetricMapBuilderRBPF.h:102
mrpt::maps::CMultiMetricMap
This class stores any customizable set of metric maps.
Definition: CMultiMetricMap.h:141
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::maps::CMultiMetricMapPDF
Declares a class that represents a Rao-Blackwellized set of particles for solving the SLAM problem (T...
Definition: CMultiMetricMapPDF.h:58
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CMetricMapBuilderRBPF.cpp:537
mrpt::slam::CMetricMapBuilderRBPF::getCurrentJointEntropy
double getCurrentJointEntropy()
Definition: CMetricMapBuilderRBPF.cpp:505
mrpt::slam::CMetricMapBuilderRBPF::initialize
void initialize(const mrpt::maps::CSimpleMap &initialMap=mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF *x0=nullptr)
Initialize the method, starting with a known location PDF "x0"(if supplied, set to nullptr to left un...
Definition: CMetricMapBuilderRBPF.cpp:288
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::mapsInitializers
mrpt::maps::TSetOfMetricMapInitializers mapsInitializers
Definition: CMetricMapBuilderRBPF.h:104
CParticleFilterCapable.h
mrpt::slam::CMetricMapBuilderRBPF::localizeLinDistance
float localizeLinDistance
Distances (linear and angular) for updating the robot pose estimate (and particles weighs,...
Definition: CMetricMapBuilderRBPF.h:74
mrpt::slam::CMetricMapBuilderRBPF::getCurrentPoseEstimation
mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const
Returns a copy of the current best pose estimation as a pose PDF.
Definition: CMetricMapBuilderRBPF.cpp:319
mrpt::slam::CMetricMapBuilderRBPF::insertionLinDistance
float insertionLinDistance
Distances (linear and angular) for inserting a new observation into the map.
Definition: CMetricMapBuilderRBPF.h:70
mrpt::poses::CPosePDF
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:41
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMap
void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap &out_map) const
Fills "out_map" with the set of "poses"-"sensory-frames", thus the so far built map.
Definition: CMetricMapBuilderRBPF.cpp:359
mrpt::slam::CMetricMapBuilderRBPF::drawCurrentEstimationToImage
void drawCurrentEstimationToImage(mrpt::img::CCanvas *img)
A useful method for debugging: draws the current map and path hypotheses to a CCanvas
Definition: CMetricMapBuilderRBPF.cpp:379
safe_pointers.h
CLoadableOptions.h
img
GLint GLvoid * img
Definition: glext.h:3763
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::predictionOptions
mrpt::maps::CMultiMetricMapPDF::TPredictionParams predictionOptions
Definition: CMetricMapBuilderRBPF.h:105
mrpt::maps::CSimpleMap
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Definition: CSimpleMap.h:35
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::localizeLinDistance
float localizeLinDistance
Definition: CMetricMapBuilderRBPF.h:99
mrpt::slam::CMetricMapBuilderRBPF::localizeAngDistance
float localizeAngDistance
Definition: CMetricMapBuilderRBPF.h:74
mrpt::slam::CMetricMapBuilderRBPF::TStats
This structure will hold stats after each execution of processActionObservation.
Definition: CMetricMapBuilderRBPF.h:196
mrpt::maps::CMultiMetricMapPDF::TPredictionParams
The struct for passing extra simulation parameters to the prediction/update stage when running a part...
Definition: CMultiMetricMapPDF.h:112
mrpt::poses::CPose3DPDF::Ptr
std::shared_ptr< CPose3DPDF > Ptr
Definition: CPose3DPDF.h:45
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::slam::CMetricMapBuilderRBPF::clear
void clear()
Clear all elements of the maps.
Definition: CMetricMapBuilderRBPF.cpp:85
CMetricMapBuilder.h
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions
Options for building a CMetricMapBuilderRBPF object, passed to the constructor.
Definition: CMetricMapBuilderRBPF.h:85
mrpt::slam::CMetricMapBuilder
This virtual class is the base for SLAM implementations.
Definition: CMetricMapBuilder.h:35
mrpt::slam::CMetricMapBuilderRBPF::~CMetricMapBuilderRBPF
virtual ~CMetricMapBuilderRBPF()
Destructor.
Definition: CMetricMapBuilderRBPF.cpp:81
mrpt::slam::CMetricMapBuilderRBPF::insertionAngDistance
float insertionAngDistance
Definition: CMetricMapBuilderRBPF.h:70
mrpt::slam::CMetricMapBuilderRBPF::mapPDF
mrpt::maps::CMultiMetricMapPDF mapPDF
The map PDF: It includes a path and associated map for each particle.
Definition: CMetricMapBuilderRBPF.h:62
mrpt::bayes::CParticleFilter::TParticleFilterOptions
The configuration of a particle filter.
Definition: CParticleFilter.h:102
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::insertionAngDistance
float insertionAngDistance
Definition: CMetricMapBuilderRBPF.h:97
mrpt::slam::CMetricMapBuilderRBPF::operator=
CMetricMapBuilderRBPF & operator=(const CMetricMapBuilderRBPF &src)
Copy Operator.
Definition: CMetricMapBuilderRBPF.cpp:59



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST