MRPT  1.9.9
CPointPDFParticles.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
13 #include <mrpt/math/CMatrixF.h>
14 #include <mrpt/math/TPoint3D.h>
15 #include <mrpt/poses/CPointPDF.h>
16 
17 namespace mrpt::poses
18 {
19 /** A probability distribution of a 2D/3D point, represented as a set of random
20  * samples (particles).
21  * \sa CPointPDF
22  * \ingroup poses_pdf_grp
23  */
25  : public CPointPDF,
26  public mrpt::bayes::CParticleFilterData<mrpt::math::TPoint3Df>,
28  CPointPDFParticles, mrpt::bayes::CParticleFilterData<
29  mrpt::math::TPoint3Df>::CParticleList>
30 {
32 
33  public:
34  /** Default constructor */
35  CPointPDFParticles(size_t numParticles = 1);
36 
37  /** Clear all the particles (free memory) */
38  void clear();
39 
40  /** Erase all the previous particles and change the number of particles,
41  * with a given initial value */
42  void setSize(
43  size_t numberParticles,
44  const mrpt::math::TPoint3Df& defaultValue = mrpt::math::TPoint3Df{0, 0,
45  0});
46 
47  /** Returns the number of particles */
48  size_t size() const { return m_particles.size(); }
49 
50  void getMean(CPoint3D& mean_point) const override;
51 
52  std::tuple<cov_mat_t, type_value> getCovarianceAndMean() const override;
53 
54  /** Copy operator, translating if necesary (for example, between particles
55  * and gaussian representations) */
56  void copyFrom(const CPointPDF& o) override;
57 
58  /** Save PDF's particles to a text file, where each line is: X Y Z LOG_W */
59  bool saveToTextFile(const std::string& file) const override;
60 
61  /** this = p (+) this. This can be used to convert a PDF from local
62  * coordinates to global, providing the point (newReferenceBase) from which
63  * "to project" the current pdf. Result PDF substituted the currently
64  * stored one in the object. Both the mean value and the covariance matrix
65  * are updated correctly. */
66  void changeCoordinatesReference(const CPose3D& newReferenceBase) override;
67 
68  /** Compute the kurtosis of the distribution */
69  double computeKurtosis();
70 
71  /** Draw a sample from the pdf */
72  void drawSingleSample(CPoint3D& outSample) const override;
73 
74  /** Bayesian fusion of two point distributions (product of two
75  * distributions->new distribution), then save the result in this object
76  * (WARNING: See implementing classes to see classes that can and cannot be
77  * mixtured!)
78  * \param p1 The first distribution to fuse
79  * \param p2 The second distribution to fuse
80  * \param minMahalanobisDistToDrop If set to different of 0, the result of
81  * very separate Gaussian modes (that will result in negligible components)
82  * in SOGs will be dropped to reduce the number of modes in the output.
83  */
84  void bayesianFusion(
85  const CPointPDF& p1, const CPointPDF& p2,
86  const double minMahalanobisDistToDrop = 0) override;
87 
88 }; // End of class def.
89 } // namespace mrpt::poses
void drawSingleSample(CPoint3D &outSample) const override
Draw a sample from the pdf.
size_t size() const
Returns the number of particles.
bool saveToTextFile(const std::string &file) const override
Save PDF&#39;s particles to a text file, where each line is: X Y Z LOG_W.
Lightweight 3D point (float version).
Definition: TPoint3D.h:21
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), then save the result in this object (WARNING: See implementing classes to see classes that can and cannot be mixtured!)
void getMean(CPoint3D &mean_point) const override
GLsizei const GLchar ** string
Definition: glext.h:4116
A class used to store a 3D point.
Definition: CPoint3D.h:31
This template class declares the array of particles and its internal data, managing some memory-relat...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::tuple< cov_mat_t, type_value > getCovarianceAndMean() const override
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
void copyFrom(const CPointPDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
void changeCoordinatesReference(const CPose3D &newReferenceBase) override
this = p (+) this.
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...
CPointPDFParticles(size_t numParticles=1)
Default constructor.
void clear()
Clear all the particles (free memory)
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
Definition: CPointPDF.h:36
double computeKurtosis()
Compute the kurtosis of the distribution.
A probability distribution of a 2D/3D point, represented as a set of random samples (particles)...
A curiously recurring template pattern (CRTP) approach to providing the basic functionality of any CP...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: cb560b230 Wed Nov 13 08:06:48 2019 +0100 at miƩ nov 13 08:15:10 CET 2019