MRPT logo

mrpt::poses::CPosePDFSOG Class Reference

Declares a class that represents a Probability Density function (PDF) of a 2D pose $ p(\mathbf{x}) = [x ~ y ~ \phi ]^t $. More...

#include <mrpt/poses/CPosePDFSOG.h>

Inheritance diagram for mrpt::poses::CPosePDFSOG:

mrpt::poses::CPosePDF mrpt::utils::CSerializable

List of all members.

Classes

struct  TGaussianMode
 The struct for each mode:. More...

Public Member Functions

 CPosePDFSOG (size_t nModes=1)
 Default constructor.
size_t size () const
 Return the number of Gaussians in the SOG.
void mergeModes (double max_KLd=0.5, bool verbose=false)
 Merge very close modes so the overall number of modes is reduced while preserving the total distribution.
CPose2D getEstimatedPose () const
 Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF).
CMatrixD getEstimatedCovariance () const
 Returns an estimate of the pose covariance matrix (3x3 cov.matrix for x,y,phi variables).
void normalizeWeights ()
 Normalize the weights in m_modes such as the maximum log-weight is 0.
void copyFrom (const CPosePDF &o)
 Copy operator, translating if necesary (for example, between particles and gaussian representations).
void saveToTextFile (const std::string &file) const
 Save the density to a text file, with the following format: There is one row per Gaussian "mode", and each row contains 10 elements:
  • w (The weight)
  • x_mean (gaussian mean value)
  • y_mean (gaussian mean value)
  • phi_mean (gaussian mean value)
  • C11 (Covariance elements)
  • C22 (Covariance elements)
  • C33 (Covariance elements)
  • C12 (Covariance elements)
  • C13 (Covariance elements)
  • C23 (Covariance elements).

void changeCoordinatesReference (const CPose2D &newReferenceBase)
 This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which "to project" the current pdf.
void rotateAllCovariances (const double &ang)
 Rotate all the covariance matrixes by replacing them by $ \mathbf{R}~\mathbf{COV}~\mathbf{R}^t $, where $ \mathbf{R} = \left[ \begin{array}{ccc} \cos\alpha & -\sin\alpha & 0 \\ \sin\alpha & \cos\alpha & 0 \\ 0 & 0 & 1 \end{array}\right] $.
void drawSingleSample (CPose2D &outPart) const
 Draws a single sample from the distribution.
void drawManySamples (size_t N, std::vector< vector_double > &outSamples) const
 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.
void inverse (CPosePDF &o) const
 Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
void operator+= (CPose2D Ap)
 Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matrix are updated).
double evaluatePDF (const CPose2D &x, bool sumOverAllPhis=false) const
 Evaluates the PDF at a given point.
double evaluateNormalizedPDF (const CPose2D &x) const
 Evaluates the ratio PDF(x) / max_PDF(x*), that is, the normalized PDF in the range [0,1].
void evaluatePDFInArea (const double &x_min, const double &x_max, const double &y_min, const double &y_max, const double &resolutionXY, const double &phi, CMatrixD &outMatrix, bool sumOverAllPhis=false)
 Evaluates the PDF within a rectangular grid (and a fixed orientation) and saves the result in a matrix (each row contains values for a fixed y-coordinate value).
void bayesianFusion (CPosePDF &p1, CPosePDF &p2, const double &minMahalanobisDistToDrop=0)
 Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently p1 must be a mrpt::poses::CPosePDFSOG object and p2 a mrpt::poses::CPosePDFGaussian object).
void getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &outObj) const
 Returns a 3D object representation of all the ellipses in the SoG.

Public Attributes

std::deque< TGaussianModem_modes
 Access directly to this array for modify the modes as desired.

Protected Member Functions

void assureSymmetry ()
 Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor lead to non-symmetric matrixes!).


Detailed Description

Declares a class that represents a Probability Density function (PDF) of a 2D pose $ p(\mathbf{x}) = [x ~ y ~ \phi ]^t $.

This class implements that PDF as the following multi-modal Gaussian distribution:

$ p(\mathbf{x}) = \sum\limits_{i=1}^N \omega^i \mathcal{N}( \mathbf{x} ; \bar{\mathbf{x}}^i, \mathbf{\Sigma}^i ) $

Where the number of modes N is the size of CPosePDFSOG::m_modes

See mrpt::poses::CPosePDF for more details.

See also:
CPose2D, CPosePDF, CPosePDFParticles

Definition at line 57 of file CPosePDFSOG.h.


Constructor & Destructor Documentation

mrpt::poses::CPosePDFSOG::CPosePDFSOG ( size_t  nModes = 1  ) 

Default constructor.

Parameters:
nModes The initial size of CPosePDFSOG::m_modes


Member Function Documentation

void mrpt::poses::CPosePDFSOG::assureSymmetry (  )  [protected]

Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor lead to non-symmetric matrixes!).

void mrpt::poses::CPosePDFSOG::bayesianFusion ( CPosePDF p1,
CPosePDF p2,
const double &  minMahalanobisDistToDrop = 0 
) [virtual]

Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently p1 must be a mrpt::poses::CPosePDFSOG object and p2 a mrpt::poses::CPosePDFGaussian object).

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::changeCoordinatesReference ( const CPose2D newReferenceBase  )  [virtual]

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::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::copyFrom ( const CPosePDF o  )  [virtual]

Copy operator, translating if necesary (for example, between particles and gaussian representations).

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::drawManySamples ( size_t  N,
std::vector< vector_double > &  outSamples 
) const [virtual]

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.

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::drawSingleSample ( CPose2D outPart  )  const [virtual]

Draws a single sample from the distribution.

Implements mrpt::poses::CPosePDF.

double mrpt::poses::CPosePDFSOG::evaluateNormalizedPDF ( const CPose2D x  )  const

Evaluates the ratio PDF(x) / max_PDF(x*), that is, the normalized PDF in the range [0,1].

double mrpt::poses::CPosePDFSOG::evaluatePDF ( const CPose2D x,
bool  sumOverAllPhis = false 
) const

Evaluates the PDF at a given point.

void mrpt::poses::CPosePDFSOG::evaluatePDFInArea ( const double &  x_min,
const double &  x_max,
const double &  y_min,
const double &  y_max,
const double &  resolutionXY,
const double &  phi,
CMatrixD outMatrix,
bool  sumOverAllPhis = false 
)

Evaluates the PDF within a rectangular grid (and a fixed orientation) and saves the result in a matrix (each row contains values for a fixed y-coordinate value).

void mrpt::poses::CPosePDFSOG::getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &  outObj  )  const

Returns a 3D object representation of all the ellipses in the SoG.

CMatrixD mrpt::poses::CPosePDFSOG::getEstimatedCovariance (  )  const [virtual]

Returns an estimate of the pose covariance matrix (3x3 cov.matrix for x,y,phi variables).

Implements mrpt::poses::CPosePDF.

CPose2D mrpt::poses::CPosePDFSOG::getEstimatedPose (  )  const [virtual]

Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF).

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::inverse ( CPosePDF o  )  const [virtual]

Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFSOG::mergeModes ( double  max_KLd = 0.5,
bool  verbose = false 
)

Merge very close modes so the overall number of modes is reduced while preserving the total distribution.

This method uses the approach described in the paper:

  • "Kullback-Leibler Approach to Gaussian Mixture Reduction" AR Runnalls. IEEE Transactions on Aerospace and Electronic Systems, 2007.

Parameters:
max_KLd The maximum KL-divergence to consider the merge of two nodes (and then stops the process).

void mrpt::poses::CPosePDFSOG::normalizeWeights (  ) 

Normalize the weights in m_modes such as the maximum log-weight is 0.

void mrpt::poses::CPosePDFSOG::operator+= ( CPose2D  Ap  ) 

Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matrix are updated).

void mrpt::poses::CPosePDFSOG::rotateAllCovariances ( const double &  ang  ) 

Rotate all the covariance matrixes by replacing them by $ \mathbf{R}~\mathbf{COV}~\mathbf{R}^t $, where $ \mathbf{R} = \left[ \begin{array}{ccc} \cos\alpha & -\sin\alpha & 0 \\ \sin\alpha & \cos\alpha & 0 \\ 0 & 0 & 1 \end{array}\right] $.

void mrpt::poses::CPosePDFSOG::saveToTextFile ( const std::string &  file  )  const [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:

  • w (The weight)
  • x_mean (gaussian mean value)
  • y_mean (gaussian mean value)
  • phi_mean (gaussian mean value)
  • C11 (Covariance elements)
  • C22 (Covariance elements)
  • C33 (Covariance elements)
  • C12 (Covariance elements)
  • C13 (Covariance elements)
  • C23 (Covariance elements).

Implements mrpt::poses::CPosePDF.

size_t mrpt::poses::CPosePDFSOG::size (  )  const [inline]

Return the number of Gaussians in the SOG.

Definition at line 97 of file CPosePDFSOG.h.


Member Data Documentation

Access directly to this array for modify the modes as desired.

Note that no weight can be zero!!

Definition at line 94 of file CPosePDFSOG.h.




Page generated by Doxygen 1.5.7.1 for MRPT 0.6.5 SVN: at Mon Feb 23 13:24:51 EST 2009