Main MRPT website > C++ reference for MRPT 1.4.0
CPosePDFGrid.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 CPosePDFGrid_H
10#define CPosePDFGrid_H
11
12#include <mrpt/poses/CPosePDF.h>
14#include <mrpt/utils/bits.h> // DEG2RAD()
15
16namespace mrpt
17{
18namespace poses
19{
20 // This must be added to any CSerializable derived class:
22
23 /** Declares a class that represents a Probability Distribution
24 * function (PDF) of a 2D pose (x,y,phi).
25 * This class implements that PDF using a 3D grid.
26 *
27 * \sa CPose2D, CPosePDF, CPose2DGridTemplate
28 * \ingroup poses_pdf_grp
29 */
31 {
32 // This must be added to any CSerializable derived class:
34
35 protected:
36
37
38 public:
39 /** Constructor: Initializes a, uniform distribution over the whole given range.
40 */
42 double xMin = -1.0f,
43 double xMax = 1.0f,
44 double yMin = -1.0f,
45 double yMax = 1.0f,
46 double resolutionXY = 0.5f,
47 double resolutionPhi = mrpt::utils::DEG2RAD(180),
48 double phiMin = -M_PIf,
49 double phiMax = M_PIf
50 );
51
52 virtual ~CPosePDFGrid(); //!< Destructor
53
54 void copyFrom(const CPosePDF &o) MRPT_OVERRIDE; //!< Copy operator, translating if necesary (for example, between particles and gaussian representations)
55
56 void normalize(); //!< Normalizes the PDF, such as all cells sum the unity.
57 void uniformDistribution(); //!< Assigns the same value to all the cells in the grid, so the sum 1.
58 void getMean(CPose2D &mean_pose) const MRPT_OVERRIDE; //!< Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF). \sa getCovariance
59 void getCovarianceAndMean(mrpt::math::CMatrixDouble33 &cov,CPose2D &mean_point) const MRPT_OVERRIDE; //!< Returns an estimate of the pose covariance matrix (3x3 cov matrix) and the mean, both at once. \sa getMean
60 void saveToTextFile(const std::string &dataFile) const MRPT_OVERRIDE; //!< Save the contents of the 3D grid in one file, as a vertical concatenation of rectangular matrix for the different "PHI" discrete levels, and the size in X,Y,and PHI in another file named "<filename>_dims.txt"
61
62 /** this = p (+) this. This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which
63 * "to project" the current pdf. Result PDF substituted the currently stored one in the object. */
64 void changeCoordinatesReference( const CPose3D &newReferenceBase ) MRPT_OVERRIDE;
65 void bayesianFusion(const CPosePDF &p1,const CPosePDF &p2, const double &minMahalanobisDistToDrop = 0 ) MRPT_OVERRIDE; //!< Bayesian fusion of 2 densities (In the grid representation this becomes a pointwise multiplication)
66 void inverse(CPosePDF &o) const MRPT_OVERRIDE; //!< Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF
67 void drawSingleSample( CPose2D &outPart ) const MRPT_OVERRIDE; //!< Draws a single sample from the distribution (WARNING: weights are assumed to be normalized!)
68 void drawManySamples( size_t N, std::vector<mrpt::math::CVectorDouble> & outSamples ) const MRPT_OVERRIDE; //!< Draws a number of samples from the distribution, and saves as a list of 1x3 vectors, where each row contains a (x,y,phi) datum.
69
70 }; // End of class def.
72 } // End of namespace
73} // End of namespace
74#endif
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A numeric matrix of compile-time fixed size.
This is a template class for storing a 3D (2D+heading) grid containing any kind of data.
A class used to store a 2D pose.
Definition: CPose2D.h:37
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
Declares a class that represents a Probability Distribution function (PDF) of a 2D pose (x,...
Definition: CPosePDFGrid.h:31
virtual ~CPosePDFGrid()
Destructor.
void bayesianFusion(const CPosePDF &p1, const CPosePDF &p2, const double &minMahalanobisDistToDrop=0) MRPT_OVERRIDE
Bayesian fusion of 2 densities (In the grid representation this becomes a pointwise multiplication)
void normalize()
Normalizes the PDF, such as all cells sum the unity.
void changeCoordinatesReference(const CPose3D &newReferenceBase) MRPT_OVERRIDE
this = p (+) this.
void getCovarianceAndMean(mrpt::math::CMatrixDouble33 &cov, CPose2D &mean_point) const MRPT_OVERRIDE
Returns an estimate of the pose covariance matrix (3x3 cov matrix) and the mean, both at once.
void getMean(CPose2D &mean_pose) const MRPT_OVERRIDE
Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF).
CPosePDFGrid(double xMin=-1.0f, double xMax=1.0f, double yMin=-1.0f, double yMax=1.0f, double resolutionXY=0.5f, double resolutionPhi=mrpt::utils::DEG2RAD(180), double phiMin=-M_PIf, double phiMax=M_PIf)
Constructor: Initializes a, uniform distribution over the whole given range.
void saveToTextFile(const std::string &dataFile) const MRPT_OVERRIDE
Save the contents of the 3D grid in one file, as a vertical concatenation of rectangular matrix for t...
void copyFrom(const CPosePDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations)
void uniformDistribution()
Assigns the same value to all the cells in the grid, so the sum 1.
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:40
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
#define M_PIf
Definition: mrpt_macros.h:366
double DEG2RAD(const double x)
Degrees to radians.
Definition: bits.h:69
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Sun Nov 27 02:47:40 UTC 2022