Main MRPT website > C++ reference for MRPT 1.9.9
CPointPDFParticles.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 CPointPDFParticles_H
10 #define CPointPDFParticles_H
11 
12 #include <mrpt/poses/CPointPDF.h>
13 #include <mrpt/math/CMatrix.h>
17 
18 namespace mrpt
19 {
20 namespace poses
21 {
22 /** A probability distribution of a 2D/3D point, represented as a set of random
23  * samples (particles).
24  * \sa CPointPDF
25  * \ingroup poses_pdf_grp
26  */
28  : public CPointPDF,
29  public mrpt::bayes::CParticleFilterData<mrpt::math::TPoint3Df>,
31  CPointPDFParticles, mrpt::bayes::CParticleFilterData<
32  mrpt::math::TPoint3Df>::CParticleList>
33 {
35 
36  public:
37  /** Default constructor */
38  CPointPDFParticles(size_t numParticles = 1);
39 
40  /** Clear all the particles (free memory) */
41  void clear();
42 
43  /** Erase all the previous particles and change the number of particles,
44  * with a given initial value */
45  void setSize(
46  size_t numberParticles,
47  const mrpt::math::TPoint3Df& defaultValue = mrpt::math::TPoint3Df{0, 0,
48  0});
49 
50  /** Returns the number of particles */
51  size_t size() const { return m_particles.size(); }
52  /** Returns an estimate of the point, (the mean, or mathematical expectation
53  * of the PDF) \sa getCovariance */
54  void getMean(CPoint3D& mean_point) const override;
55 
56  /** Returns an estimate of the point covariance matrix (3x3 cov matrix) and
57  * the mean, both at once. \sa getMean */
59  mrpt::math::CMatrixDouble33& cov, CPoint3D& mean_point) const override;
60 
61  /** Copy operator, translating if necesary (for example, between particles
62  * and gaussian representations) */
63  void copyFrom(const CPointPDF& o) override;
64 
65  /** Save PDF's particles to a text file, where each line is: X Y Z LOG_W */
66  bool saveToTextFile(const std::string& file) const override;
67 
68  /** this = p (+) this. This can be used to convert a PDF from local
69  * coordinates to global, providing the point (newReferenceBase) from which
70  * "to project" the current pdf. Result PDF substituted the currently
71  * stored one in the object. Both the mean value and the covariance matrix
72  * are updated correctly. */
73  void changeCoordinatesReference(const CPose3D& newReferenceBase) override;
74 
75  /** Compute the kurtosis of the distribution */
76  double computeKurtosis();
77 
78  /** Draw a sample from the pdf */
79  void drawSingleSample(CPoint3D& outSample) const override;
80 
81  /** Bayesian fusion of two point distributions (product of two
82  * distributions->new distribution), then save the result in this object
83  * (WARNING: See implementing classes to see classes that can and cannot be
84  * mixtured!)
85  * \param p1 The first distribution to fuse
86  * \param p2 The second distribution to fuse
87  * \param minMahalanobisDistToDrop If set to different of 0, the result of
88  * very separate Gaussian modes (that will result in negligible components)
89  * in SOGs will be dropped to reduce the number of modes in the output.
90  */
91  void bayesianFusion(
92  const CPointPDF& p1, const CPointPDF& p2,
93  const double minMahalanobisDistToDrop = 0) override;
94 
95 }; // End of class def.
96 } // End of namespace
97 } // End of namespace
98 
99 #endif
mrpt::math::TPoint3Df
Lightweight 3D point (float version).
Definition: lightweight_geom_data.h:315
mrpt::poses::CPointPDFParticles::computeKurtosis
double computeKurtosis()
Compute the kurtosis of the distribution.
Definition: CPointPDFParticles.cpp:216
mrpt::poses::CPointPDFParticles::setSize
void setSize(size_t numberParticles, const mrpt::math::TPoint3Df &defaultValue=mrpt::math::TPoint3Df{0, 0, 0})
Erase all the previous particles and change the number of particles, with a given initial value
Definition: CPointPDFParticles.cpp:36
mrpt::poses::CPointPDFParticles::getMean
void getMean(CPoint3D &mean_point) const override
Returns an estimate of the point, (the mean, or mathematical expectation of the PDF)
Definition: CPointPDFParticles.cpp:53
mrpt::poses::CPointPDFParticles::size
size_t size() const
Returns the number of particles.
Definition: CPointPDFParticles.h:51
mrpt::poses::CPointPDFParticles
A probability distribution of a 2D/3D point, represented as a set of random samples (particles).
Definition: CPointPDFParticles.h:27
CParticleFilterData.h
CMatrix.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::poses::CPointPDFParticles::saveToTextFile
bool saveToTextFile(const std::string &file) const override
Save PDF's particles to a text file, where each line is: X Y Z LOG_W.
Definition: CPointPDFParticles.cpp:175
mrpt::math::cov
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample,...
Definition: ops_matrices.h:148
lightweight_geom_data.h
mrpt::poses::CPointPDFParticles::copyFrom
void copyFrom(const CPointPDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations)
Definition: CPointPDFParticles.cpp:164
mrpt::poses::CPointPDFParticles::getCovarianceAndMean
void getCovarianceAndMean(mrpt::math::CMatrixDouble33 &cov, CPoint3D &mean_point) const override
Returns an estimate of the point covariance matrix (3x3 cov matrix) and the mean, both at once.
Definition: CPointPDFParticles.cpp:85
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::poses::CPointPDFParticles::clear
void clear()
Clear all the particles (free memory)
Definition: CPointPDFParticles.cpp:32
mrpt::bayes::CParticleFilterData
This template class declares the array of particles and its internal data, managing some memory-relat...
Definition: CParticleFilterData.h:206
CParticleFilterCapable.h
mrpt::math::CMatrixFixedNumeric< double, 3, 3 >
mrpt::poses::CPointPDFParticles::bayesianFusion
void bayesianFusion(const CPointPDF &p1, const CPointPDF &p2, const double minMahalanobisDistToDrop=0) override
Bayesian fusion of two point distributions (product of two distributions->new distribution),...
Definition: CPointPDFParticles.cpp:280
mrpt::bayes::CParticleFilterData< mrpt::math::TPoint3Df >::m_particles
CParticleList m_particles
The array of particles.
Definition: CParticleFilterData.h:218
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::poses::CPointPDFParticles::changeCoordinatesReference
void changeCoordinatesReference(const CPose3D &newReferenceBase) override
this = p (+) this.
Definition: CPointPDFParticles.cpp:196
mrpt::poses::CPointPDFParticles::drawSingleSample
void drawSingleSample(CPoint3D &outSample) const override
Draw a sample from the pdf.
Definition: CPointPDFParticles.cpp:271
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::bayes::CParticleFilterDataImpl
A curiously recurring template pattern (CRTP) approach to providing the basic functionality of any CP...
Definition: CParticleFilterData.h:33
CPointPDF.h
mrpt::poses::CPointPDF
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x,...
Definition: CPointPDF.h:39
mrpt::poses::CPoint3D
A class used to store a 3D point.
Definition: CPoint3D.h:33
mrpt::poses::CPointPDFParticles::CPointPDFParticles
CPointPDFParticles(size_t numParticles=1)
Default constructor.
Definition: CPointPDFParticles.cpp:26



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