Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Static Public Member Functions | Protected Member Functions

mrpt::poses::CPosePDFGaussianInf Class Reference


Detailed Description

A Probability Density function (PDF) of a 2D pose $ p(\mathbf{x}) = [x ~ y ~ \phi ]^t $ as a Gaussian with a mean and the inverse of the covariance.

This class implements a PDF as a mono-modal Gaussian distribution in its information form, that is, keeping the inverse of the covariance matrix instead of the covariance matrix itself.

This class is the dual of CPosePDFGaussian.

See also:
CPose2D, CPosePDF, CPosePDFParticles

Definition at line 54 of file CPosePDFGaussianInf.h.

#include <mrpt/poses/CPosePDFGaussianInf.h>

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

List of all members.

Public Member Functions

 CPosePDFGaussianInf ()
 Default constructor (mean=all zeros, inverse covariance=all zeros -> so be careful!)
 CPosePDFGaussianInf (const CPose2D &init_Mean)
 Constructor with a mean value (inverse covariance=all zeros -> so be careful!)
 CPosePDFGaussianInf (const CPose2D &init_Mean, const CMatrixDouble33 &init_CovInv)
 Constructor.
 CPosePDFGaussianInf (const CPosePDF &o)
 Copy constructor, including transformations between other PDFs.
 CPosePDFGaussianInf (const CPose3DPDF &o)
 Copy constructor, including transformations between other PDFs.
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 copyFrom (const CPosePDF &o)
 Copy operator, translating if necesary (for example, between particles and gaussian representations)
void copyFrom (const CPose3DPDF &o)
 Copy operator, translating if necesary (for example, between particles and gaussian representations)
void saveToTextFile (const std::string &file) const
 Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance matrix in next 3 lines.
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 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 rotateCov (const double ang)
 Rotate the covariance matrix by replacing it 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 inverseComposition (const CPosePDFGaussianInf &x, const CPosePDFGaussianInf &ref)
 Set $ this = x1 \ominus x0 $ , computing the mean using the "-" operator and the covariances through the corresponding Jacobians (For 'x0' and 'x1' being independent variables!).
void inverseComposition (const CPosePDFGaussianInf &x1, const CPosePDFGaussianInf &x0, const CMatrixDouble33 &COV_01)
 Set $ this = x1 \ominus x0 $ , computing the mean using the "-" operator and the covariances through the corresponding Jacobians (Given the 3x3 cross-covariance matrix of variables x0 and x1).
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 bayesianFusion (const CPosePDF &p1, const CPosePDF &p2, const double &minMahalanobisDistToDrop=0)
 Bayesian fusion of two points gauss.
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) const
 Evaluates the PDF at a given point.
double evaluateNormalizedPDF (const CPose2D &x) const
 Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1].
double mahalanobisDistanceTo (const CPosePDFGaussianInf &theOther)
 Computes the Mahalanobis distance between the centers of two Gaussians.
void operator+= (const CPosePDFGaussianInf &Ap)
 Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matrix are updated) (see formulas in jacobiansPoseComposition ).
void operator-= (const CPosePDFGaussianInf &ref)
 Makes: thisPDF = thisPDF - Ap, where "-" is pose inverse composition (both the mean, and the covariance matrix are updated)

Static Public Member Functions

static void jacobiansPoseComposition (const CPosePDFGaussianInf &x, const CPosePDFGaussianInf &u, CMatrixDouble33 &df_dx, CMatrixDouble33 &df_du)
 This static method computes the pose composition Jacobians, with these formulas:

Public Attributes

Data fields
CPose2D mean
 The mean value.
CMatrixDouble33 cov_inv
 The inverse of the 3x3 covariance matrix (the "information" matrix)

Protected Member Functions

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

RTTI stuff

typedef CPosePDFGaussianInfPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CPosePDFGaussianInf
static mrpt::utils::TRuntimeClassId classCPosePDFGaussianInf
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 CPosePDFGaussianInfPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 57 of file CPosePDFGaussianInf.h.


Constructor & Destructor Documentation

mrpt::poses::CPosePDFGaussianInf::CPosePDFGaussianInf ( )

Default constructor (mean=all zeros, inverse covariance=all zeros -> so be careful!)

mrpt::poses::CPosePDFGaussianInf::CPosePDFGaussianInf ( const CPose2D init_Mean) [explicit]

Constructor with a mean value (inverse covariance=all zeros -> so be careful!)

mrpt::poses::CPosePDFGaussianInf::CPosePDFGaussianInf ( const CPose2D init_Mean,
const CMatrixDouble33 init_CovInv 
)

Constructor.

mrpt::poses::CPosePDFGaussianInf::CPosePDFGaussianInf ( const CPosePDF o) [inline, explicit]

Copy constructor, including transformations between other PDFs.

Definition at line 84 of file CPosePDFGaussianInf.h.

mrpt::poses::CPosePDFGaussianInf::CPosePDFGaussianInf ( const CPose3DPDF o) [inline, explicit]

Copy constructor, including transformations between other PDFs.

Definition at line 87 of file CPosePDFGaussianInf.h.


Member Function Documentation

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

Reimplemented from mrpt::poses::CPosePDF.

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

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

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

Bayesian fusion of two points gauss.

distributions, then save the result in this object. The process is as follows:

  • (x1,S1): Mean and variance of the p1 distribution.
  • (x2,S2): Mean and variance of the p2 distribution.
  • (x,S): Mean and variance of the resulting distribution.

S = (S1-1 + S2-1)-1; x = S * ( S1-1*x1 + S2-1*x2 );

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFGaussianInf::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::CPosePDFGaussianInf::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.

Result PDF substituted the currently stored one in the object.

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

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

Implements mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFGaussianInf::copyFrom ( const CPose3DPDF o)

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

static CPosePDFGaussianInfPtr mrpt::poses::CPosePDFGaussianInf::Create ( ) [static]
static mrpt::utils::CObject* mrpt::poses::CPosePDFGaussianInf::CreateObject ( ) [static]
void mrpt::poses::CPosePDFGaussianInf::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::CPosePDFGaussianInf::drawSingleSample ( CPose2D outPart) const [virtual]

Draws a single sample from the distribution.

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

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

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

Implements mrpt::utils::CObject.

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

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

double mrpt::poses::CPosePDFGaussianInf::evaluatePDF ( const CPose2D x) const

Evaluates the PDF at a given point.

void mrpt::poses::CPosePDFGaussianInf::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::CPosePDFGaussianInf::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 >.

virtual const mrpt::utils::TRuntimeClassId* mrpt::poses::CPosePDFGaussianInf::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFGaussianInf::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::CPosePDFGaussianInf::inverseComposition ( const CPosePDFGaussianInf x,
const CPosePDFGaussianInf ref 
)

Set $ this = x1 \ominus x0 $ , computing the mean using the "-" operator and the covariances through the corresponding Jacobians (For 'x0' and 'x1' being independent variables!).

Referenced by mrpt::poses::operator-().

void mrpt::poses::CPosePDFGaussianInf::inverseComposition ( const CPosePDFGaussianInf x1,
const CPosePDFGaussianInf x0,
const CMatrixDouble33 COV_01 
)

Set $ this = x1 \ominus x0 $ , computing the mean using the "-" operator and the covariances through the corresponding Jacobians (Given the 3x3 cross-covariance matrix of variables x0 and x1).

static void mrpt::poses::CPosePDFGaussianInf::jacobiansPoseComposition ( const CPosePDFGaussianInf x,
const CPosePDFGaussianInf u,
CMatrixDouble33 df_dx,
CMatrixDouble33 df_du 
) [static]

This static method computes the pose composition Jacobians, with these formulas:

                                df_dx =
                                [ 1, 0, -sin(phi_x)*x_u-cos(phi_x)*y_u ]
                                [ 0, 1,  cos(phi_x)*x_u-sin(phi_x)*y_u ]
                                [ 0, 0,                              1 ]

                                df_du =
                                [ cos(phi_x) , -sin(phi_x) ,  0  ]
                                [ sin(phi_x) ,  cos(phi_x) ,  0  ]
                                [         0  ,          0  ,  1  ]
double mrpt::poses::CPosePDFGaussianInf::mahalanobisDistanceTo ( const CPosePDFGaussianInf theOther)

Computes the Mahalanobis distance between the centers of two Gaussians.

void mrpt::poses::CPosePDFGaussianInf::operator+= ( const CPose2D Ap)

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

void mrpt::poses::CPosePDFGaussianInf::operator+= ( const CPosePDFGaussianInf Ap)

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

void mrpt::poses::CPosePDFGaussianInf::operator-= ( const CPosePDFGaussianInf ref) [inline]

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

Definition at line 182 of file CPosePDFGaussianInf.h.

void mrpt::poses::CPosePDFGaussianInf::rotateCov ( const double  ang)

Rotate the covariance matrix by replacing it 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::CPosePDFGaussianInf::saveToTextFile ( const std::string &  file) const [virtual]

Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance matrix in next 3 lines.

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


Member Data Documentation

Definition at line 57 of file CPosePDFGaussianInf.h.

Definition at line 57 of file CPosePDFGaussianInf.h.

Definition at line 57 of file CPosePDFGaussianInf.h.

The inverse of the 3x3 covariance matrix (the "information" matrix)

Definition at line 69 of file CPosePDFGaussianInf.h.

The mean value.

Definition at line 68 of file CPosePDFGaussianInf.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011