Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

mrpt::poses::CPosePDFSOG Class Reference


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 56 of file CPosePDFSOG.h.

#include <mrpt/poses/CPosePDFSOG.h>

Inheritance diagram for mrpt::poses::CPosePDFSOG:
Inheritance graph
[legend]

List of all members.

Classes

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

Public Types

typedef
mrpt::aligned_containers
< TGaussianMode >::vector_t 
CListGaussianModes
typedef
CListGaussianModes::const_iterator 
const_iterator
typedef
CListGaussianModes::iterator 
iterator

Public Member Functions

 CPosePDFSOG (size_t nModes=1)
 Default constructor.
size_t size () const
 Return the number of Gaussian modes.
bool empty () const
 Return whether there is any Gaussian mode.
void clear ()
 Clear the list of modes.
const TGaussianModeoperator[] (size_t i) const
 Access to individual beacons.
TGaussianModeoperator[] (size_t i)
 Access to individual beacons.
const TGaussianModeget (size_t i) const
 Access to individual beacons.
TGaussianModeget (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.
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.
void getMean (CPose2D &mean_pose) const
 Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF).
void getCovarianceAndMean (CMatrixDouble33 &cov, CPose2D &mean_point) const
 Returns an estimate of the pose covariance matrix (3x3 cov matrix) and the mean, both at once.
void getMostLikelyCovarianceAndMean (CMatrixDouble33 &cov, CPose2D &mean_point) const
 For the most likely Gaussian mode in the SOG, returns the pose covariance matrix (3x3 cov matrix) and the mean.
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 CPose3D &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+= (const 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 (const CPosePDF &p1, const 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).

Protected Member Functions

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

Protected Attributes

CListGaussianModes m_modes
 The list of SOG modes.

RTTI stuff



typedef CPosePDFSOGPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CPosePDFSOG
static mrpt::utils::TRuntimeClassId classCPosePDFSOG
static const
mrpt::utils::TRuntimeClassId
classinfo
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CPosePDFSOGPtr Create ()

Member Typedef Documentation

Definition at line 83 of file CPosePDFSOG.h.

Definition at line 84 of file CPosePDFSOG.h.

Definition at line 85 of file CPosePDFSOG.h.

A typedef for the associated smart pointer

Definition at line 59 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

static const mrpt::utils::TRuntimeClassId* mrpt::poses::CPosePDFSOG::_GetBaseClass (  )  [static, protected]

Reimplemented from mrpt::poses::CPosePDF.

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 ( const CPosePDF p1,
const 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.

const_iterator mrpt::poses::CPosePDFSOG::begin (  )  const [inline]

Definition at line 136 of file CPosePDFSOG.h.

iterator mrpt::poses::CPosePDFSOG::begin (  )  [inline]

Definition at line 134 of file CPosePDFSOG.h.

void mrpt::poses::CPosePDFSOG::changeCoordinatesReference ( const CPose3D 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::utils::CProbabilityDensityFunction< CPose2D, 3 >.

void mrpt::poses::CPosePDFSOG::clear (  ) 

Clear the list of modes.

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.

static CPosePDFSOGPtr mrpt::poses::CPosePDFSOG::Create (  )  [static]
static mrpt::utils::CObject* mrpt::poses::CPosePDFSOG::CreateObject (  )  [static]
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.

Reimplemented from mrpt::utils::CProbabilityDensityFunction< CPose2D, 3 >.

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

Draws a single sample from the distribution.

Implements mrpt::utils::CProbabilityDensityFunction< CPose2D, 3 >.

virtual mrpt::utils::CObject* mrpt::poses::CPosePDFSOG::duplicate (  )  const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

bool mrpt::poses::CPosePDFSOG::empty (  )  const [inline]

Return whether there is any Gaussian mode.

Definition at line 102 of file CPosePDFSOG.h.

iterator mrpt::poses::CPosePDFSOG::end (  )  [inline]

Definition at line 135 of file CPosePDFSOG.h.

const_iterator mrpt::poses::CPosePDFSOG::end (  )  const [inline]

Definition at line 137 of file CPosePDFSOG.h.

iterator mrpt::poses::CPosePDFSOG::erase ( iterator  i  )  [inline]

Definition at line 139 of file CPosePDFSOG.h.

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).

const TGaussianMode& mrpt::poses::CPosePDFSOG::get ( size_t  i  )  const [inline]

Access to individual beacons.

Definition at line 119 of file CPosePDFSOG.h.

References ASSERT_.

TGaussianMode& mrpt::poses::CPosePDFSOG::get ( size_t  i  )  [inline]

Access to individual beacons.

Definition at line 124 of file CPosePDFSOG.h.

References ASSERT_.

void mrpt::poses::CPosePDFSOG::getCovarianceAndMean ( CMatrixDouble33 cov,
CPose2D mean_point 
) const

Returns an estimate of the pose covariance matrix (3x3 cov matrix) and the mean, both at once.

See also:
getMean
void mrpt::poses::CPosePDFSOG::getMean ( CPose2D mean_pose  )  const [virtual]

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

See also:
getCovariance

Implements mrpt::utils::CProbabilityDensityFunction< CPose2D, 3 >.

void mrpt::poses::CPosePDFSOG::getMostLikelyCovarianceAndMean ( CMatrixDouble33 cov,
CPose2D mean_point 
) const

For the most likely Gaussian mode in the SOG, returns the pose covariance matrix (3x3 cov matrix) and the mean.

See also:
getMean
virtual const mrpt::utils::TRuntimeClassId* mrpt::poses::CPosePDFSOG::GetRuntimeClass (  )  const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from 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+= ( const CPose2D Ap  ) 

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

TGaussianMode& mrpt::poses::CPosePDFSOG::operator[] ( size_t  i  )  [inline]

Access to individual beacons.

Definition at line 113 of file CPosePDFSOG.h.

References ASSERT_.

const TGaussianMode& mrpt::poses::CPosePDFSOG::operator[] ( size_t  i  )  const [inline]

Access to individual beacons.

Definition at line 108 of file CPosePDFSOG.h.

References ASSERT_.

void mrpt::poses::CPosePDFSOG::push_back ( const TGaussianMode m  )  [inline]

Inserts a copy of the given mode into the SOG.

Definition at line 130 of file CPosePDFSOG.h.

void mrpt::poses::CPosePDFSOG::resize ( const size_t  N  ) 

Resize the number of SOG modes.

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::utils::CProbabilityDensityFunction< CPose2D, 3 >.

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

Return the number of Gaussian modes.

Definition at line 101 of file CPosePDFSOG.h.


Member Data Documentation

Definition at line 59 of file CPosePDFSOG.h.

Definition at line 59 of file CPosePDFSOG.h.

Definition at line 59 of file CPosePDFSOG.h.

The list of SOG modes.

Definition at line 93 of file CPosePDFSOG.h.




Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011