Declares a class that represents a Probability Density function (PDF) of a 3D point
This class implements that PDF as the following multi-modal Gaussian distribution:
Where the number of modes N is the size of CPointPDFSOG::m_modes
See mrpt::poses::CPointPDF for more details.
Definition at line 35 of file CPointPDFSOG.h.
#include <mrpt/poses/CPointPDFSOG.h>
Classes | |
struct | TGaussianMode |
The struct for each mode: More... | |
Public Types | |
typedef std::deque< TGaussianMode > | CListGaussianModes |
typedef std::deque< TGaussianMode >::const_iterator | const_iterator |
typedef std::deque< TGaussianMode >::iterator | iterator |
enum | { is_3D_val = 1 } |
enum | { is_PDF_val = 1 } |
typedef CPoint3D | type_value |
The type of the state the PDF represents. | |
Public Member Functions | |
CPointPDFSOG (size_t nModes=1) | |
Default constructor. | |
void | clear () |
Clear all the gaussian modes. | |
const TGaussianMode & | operator[] (size_t i) const |
Access to individual beacons. | |
TGaussianMode & | operator[] (size_t i) |
Access to individual beacons. | |
const TGaussianMode & | get (size_t i) const |
Access to individual beacons. | |
TGaussianMode & | get (size_t i) |
Access to individual beacons. | |
void | push_back (const TGaussianMode &m) |
Inserts a copy of the given mode into the SOG. | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
iterator | erase (iterator i) |
void | resize (const size_t N) |
Resize the number of SOG modes. | |
size_t | size () const |
Return the number of Gaussian modes. | |
bool | empty () const |
Return whether there is any Gaussian mode. | |
void | getMean (CPoint3D &mean_point) const MRPT_OVERRIDE |
Returns an estimate of the point, (the mean, or mathematical expectation of the PDF) | |
void | getCovarianceAndMean (mrpt::math::CMatrixDouble33 &cov, CPoint3D &mean_point) const MRPT_OVERRIDE |
Returns an estimate of the point covariance matrix (3x3 cov matrix) and the mean, both at once. | |
void | normalizeWeights () |
Normalize the weights in m_modes such as the maximum log-weight is 0. | |
void | getMostLikelyMode (CPointPDFGaussian &outVal) const |
Return the Gaussian mode with the highest likelihood (or an empty Gaussian if there are no modes in this SOG) | |
double | ESS () const |
Computes the "Effective sample size" (typical measure for Particle Filters), applied to the weights of the individual Gaussian modes, as a measure of the equality of the modes (in the range [0,total # of modes]). | |
void | copyFrom (const CPointPDF &o) MRPT_OVERRIDE |
Copy operator, translating if necesary (for example, between particles and gaussian representations) | |
void | saveToTextFile (const std::string &file) const MRPT_OVERRIDE |
Save the density to a text file, with the following format: There is one row per Gaussian "mode", and each row contains 10 elements: | |
void | changeCoordinatesReference (const CPose3D &newReferenceBase) MRPT_OVERRIDE |
this = p (+) this. | |
void | drawSingleSample (CPoint3D &outSample) const MRPT_OVERRIDE |
Draw a sample from the pdf. | |
void | bayesianFusion (const CPointPDF &p1, const CPointPDF &p2, const double &minMahalanobisDistToDrop=0) MRPT_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 | evaluatePDFInArea (float x_min, float x_max, float y_min, float y_max, float resolutionXY, float z, mrpt::math::CMatrixD &outMatrix, bool sumOverAllZs=false) |
Evaluates the PDF within a rectangular grid and saves the result in a matrix (each row contains values for a fixed y-coordinate value). | |
double | evaluatePDF (const CPoint3D &x, bool sumOverAllZs) const |
Evaluates the PDF at a given point. | |
template<class OPENGL_SETOFOBJECTSPTR > | |
void | getAs3DObject (OPENGL_SETOFOBJECTSPTR &out_obj) const |
Returns a 3D representation of this PDF (it doesn't clear the current contents of out_obj, but append new OpenGL objects to that list) | |
template<class OPENGL_SETOFOBJECTSPTR , class OPENGL_SETOFOBJECTS > | |
OPENGL_SETOFOBJECTSPTR | getAs3DObject () const |
Returns a 3D representation of this PDF. | |
virtual void | getMean (CPoint3D &mean_point) const=0 |
Returns the mean, or mathematical expectation of the probability density distribution (PDF). | |
virtual void | getCovarianceAndMean (mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov, CPoint3D &mean_point) const=0 |
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once. | |
void | getCovarianceDynAndMean (mrpt::math::CMatrixDouble &cov, CPoint3D &mean_point) const |
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once. | |
CPoint3D | getMeanVal () const |
Returns the mean, or mathematical expectation of the probability density distribution (PDF). | |
void | getCovariance (mrpt::math::CMatrixDouble &cov) const |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix) | |
void | getCovariance (mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov) const |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix) | |
mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > | getCovariance () const |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix) | |
virtual void | getInformationMatrix (mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &inf) const |
Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix) Unless reimplemented in derived classes, this method first reads the covariance, then invert it. | |
virtual void | drawSingleSample (CPoint3D &outPart) const=0 |
Draws a single sample from the distribution. | |
virtual void | drawManySamples (size_t N, std::vector< mrpt::math::CVectorDouble > &outSamples) const |
Draws a number of samples from the distribution, and saves as a list of 1xSTATE_LEN vectors, where each row contains a (x,y,z,yaw,pitch,roll) datum. | |
double | getCovarianceEntropy () const |
Compute the entropy of the estimated covariance matrix. | |
Static Public Member Functions | |
static bool | is_3D () |
static bool | is_PDF () |
Static Public Attributes | |
static const size_t | state_length |
The length of the variable, for example, 3 for a 3D point, 6 for a 3D pose (x y z yaw pitch roll). | |
RTTI stuff <br> | |
static const mrpt::utils::TRuntimeClassId | classCPointPDF |
Protected Member Functions | |
void | assureSymmetry () |
Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor lead to non-symmetric matrixes!) | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE |
void | readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE |
Protected Attributes | |
CListGaussianModes | m_modes |
The list of SOG modes. | |
RTTI stuff <br> | |
typedef CPointPDFSOGPtr | SmartPtr |
static mrpt::utils::CLASSINIT | _init_CPointPDFSOG |
static mrpt::utils::TRuntimeClassId | classCPointPDFSOG |
static const mrpt::utils::TRuntimeClassId * | classinfo |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const MRPT_OVERRIDE |
virtual mrpt::utils::CObject * | duplicate () const MRPT_OVERRIDE |
static mrpt::utils::CObject * | CreateObject () |
static CPointPDFSOGPtr | Create () |
typedef std::deque<TGaussianMode> mrpt::poses::CPointPDFSOG::CListGaussianModes |
Definition at line 56 of file CPointPDFSOG.h.
typedef std::deque<TGaussianMode>::const_iterator mrpt::poses::CPointPDFSOG::const_iterator |
Definition at line 57 of file CPointPDFSOG.h.
typedef std::deque<TGaussianMode>::iterator mrpt::poses::CPointPDFSOG::iterator |
Definition at line 58 of file CPointPDFSOG.h.
A typedef for the associated smart pointer
Definition at line 38 of file CPointPDFSOG.h.
|
inherited |
The type of the state the PDF represents.
Definition at line 32 of file CProbabilityDensityFunction.h.
|
inherited |
Enumerator | |
---|---|
is_3D_val |
Definition at line 55 of file CPointPDF.h.
|
inherited |
Enumerator | |
---|---|
is_PDF_val |
Definition at line 57 of file CPointPDF.h.
mrpt::poses::CPointPDFSOG::CPointPDFSOG | ( | size_t | nModes = 1 | ) |
Default constructor.
nModes | The initial size of CPointPDFSOG::m_modes |
|
staticprotected |
|
protected |
Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor lead to non-symmetric matrixes!)
|
virtual |
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!)
p1 | The first distribution to fuse |
p2 | The second distribution to fuse |
minMahalanobisDistToDrop | If set to different of 0, the result of very separate Gaussian modes (that will result in negligible components) in SOGs will be dropped to reduce the number of modes in the output. |
Implements mrpt::poses::CPointPDF.
|
inline |
Definition at line 103 of file CPointPDFSOG.h.
|
inline |
Definition at line 105 of file CPointPDFSOG.h.
|
virtual |
this = p (+) this.
This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which "to project" the current pdf. Result PDF substituted the currently stored one in the object.
Implements mrpt::utils::CProbabilityDensityFunction< CPoint3D, 3 >.
void mrpt::poses::CPointPDFSOG::clear | ( | ) |
Clear all the gaussian modes.
|
virtual |
Copy operator, translating if necesary (for example, between particles and gaussian representations)
Implements mrpt::poses::CPointPDF.
|
static |
|
static |
|
inlinevirtualinherited |
Draws a number of samples from the distribution, and saves as a list of 1xSTATE_LEN vectors, where each row contains a (x,y,z,yaw,pitch,roll) datum.
This base method just call N times to drawSingleSample, but derived classes should implemented optimized method for each particular PDF.
Definition at line 117 of file CProbabilityDensityFunction.h.
|
pure virtualinherited |
Draws a single sample from the distribution.
void mrpt::poses::CPointPDFSOG::drawSingleSample | ( | CPoint3D & | outSample | ) | const |
Draw a sample from the pdf.
|
virtual |
|
inline |
Return whether there is any Gaussian mode.
Definition at line 112 of file CPointPDFSOG.h.
|
inline |
Definition at line 104 of file CPointPDFSOG.h.
|
inline |
Definition at line 106 of file CPointPDFSOG.h.
Definition at line 108 of file CPointPDFSOG.h.
double mrpt::poses::CPointPDFSOG::ESS | ( | ) | const |
Computes the "Effective sample size" (typical measure for Particle Filters), applied to the weights of the individual Gaussian modes, as a measure of the equality of the modes (in the range [0,total # of modes]).
double mrpt::poses::CPointPDFSOG::evaluatePDF | ( | const CPoint3D & | x, |
bool | sumOverAllZs | ||
) | const |
Evaluates the PDF at a given point.
void mrpt::poses::CPointPDFSOG::evaluatePDFInArea | ( | float | x_min, |
float | x_max, | ||
float | y_min, | ||
float | y_max, | ||
float | resolutionXY, | ||
float | z, | ||
mrpt::math::CMatrixD & | outMatrix, | ||
bool | sumOverAllZs = false |
||
) |
Evaluates the PDF within a rectangular grid and saves the result in a matrix (each row contains values for a fixed y-coordinate value).
|
inline |
|
inline |
|
inlineinherited |
Returns a 3D representation of this PDF.
Definition at line 73 of file CPointPDF.h.
|
inlineinherited |
Returns a 3D representation of this PDF (it doesn't clear the current contents of out_obj, but append new OpenGL objects to that list)
Definition at line 64 of file CPointPDF.h.
|
inlineinherited |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
Definition at line 85 of file CProbabilityDensityFunction.h.
|
inlineinherited |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
Definition at line 67 of file CProbabilityDensityFunction.h.
|
inlineinherited |
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
Definition at line 76 of file CProbabilityDensityFunction.h.
void mrpt::poses::CPointPDFSOG::getCovarianceAndMean | ( | mrpt::math::CMatrixDouble33 & | cov, |
CPoint3D & | mean_point | ||
) | const |
Returns an estimate of the point covariance matrix (3x3 cov matrix) and the mean, both at once.
|
pure virtualinherited |
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once.
|
inlineinherited |
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once.
Definition at line 47 of file CProbabilityDensityFunction.h.
|
inlineinherited |
Compute the entropy of the estimated covariance matrix.
Definition at line 136 of file CProbabilityDensityFunction.h.
|
inlinevirtualinherited |
Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix) Unless reimplemented in derived classes, this method first reads the covariance, then invert it.
Definition at line 98 of file CProbabilityDensityFunction.h.
void mrpt::poses::CPointPDFSOG::getMean | ( | CPoint3D & | mean_point | ) | const |
Returns an estimate of the point, (the mean, or mathematical expectation of the PDF)
|
pure virtualinherited |
Returns the mean, or mathematical expectation of the probability density distribution (PDF).
|
inlineinherited |
Returns the mean, or mathematical expectation of the probability density distribution (PDF).
Definition at line 57 of file CProbabilityDensityFunction.h.
void mrpt::poses::CPointPDFSOG::getMostLikelyMode | ( | CPointPDFGaussian & | outVal | ) | const |
Return the Gaussian mode with the highest likelihood (or an empty Gaussian if there are no modes in this SOG)
|
virtual |
Reimplemented from mrpt::poses::CPointPDF.
|
inlinestaticinherited |
Definition at line 56 of file CPointPDF.h.
|
inlinestaticinherited |
Definition at line 58 of file CPointPDF.h.
void mrpt::poses::CPointPDFSOG::normalizeWeights | ( | ) |
Normalize the weights in m_modes such as the maximum log-weight is 0.
|
inline |
|
inline |
|
inline |
Inserts a copy of the given mode into the SOG.
Definition at line 99 of file CPointPDFSOG.h.
|
protected |
void mrpt::poses::CPointPDFSOG::resize | ( | const size_t | N | ) |
Resize the number of SOG modes.
|
virtual |
Save the density to a text file, with the following format: There is one row per Gaussian "mode", and each row contains 10 elements:
Implements mrpt::utils::CProbabilityDensityFunction< CPoint3D, 3 >.
|
inline |
Return the number of Gaussian modes.
Definition at line 111 of file CPointPDFSOG.h.
|
protected |
|
staticprotected |
Definition at line 38 of file CPointPDFSOG.h.
|
staticinherited |
Definition at line 40 of file CPointPDF.h.
|
static |
Definition at line 38 of file CPointPDFSOG.h.
|
static |
Definition at line 38 of file CPointPDFSOG.h.
|
protected |
The list of SOG modes.
Definition at line 66 of file CPointPDFSOG.h.
|
staticinherited |
The length of the variable, for example, 3 for a 3D point, 6 for a 3D pose (x y z yaw pitch roll).
Definition at line 31 of file CProbabilityDensityFunction.h.
Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Fri Jan 20 00:13:14 UTC 2023 |