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

mrpt::poses::CPosePDFGaussian 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 using a mono-modal Gaussian distribution. See mrpt::poses::CPosePDF for more details.

See also:
CPose2D, CPosePDF, CPosePDFParticles

Definition at line 51 of file CPosePDFGaussian.h.

#include <mrpt/poses/CPosePDFGaussian.h>

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

List of all members.

Public Member Functions

 CPosePDFGaussian ()
 Default constructor.
 CPosePDFGaussian (const CPose2D &init_Mean)
 Constructor.
 CPosePDFGaussian (const CPose2D &init_Mean, const CMatrixDouble33 &init_Cov)
 Constructor.
 CPosePDFGaussian (const CPosePDF &o)
 Copy constructor, including transformations between other PDFs.
 CPosePDFGaussian (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 CPosePDFGaussian &x, const CPosePDFGaussian &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 CPosePDFGaussian &x1, const CPosePDFGaussian &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 CPosePDFGaussian &theOther)
 Computes the Mahalanobis distance between the centers of two Gaussians.
void assureMinCovariance (const double &minStdXY, const double &minStdPhi)
 Substitutes the diagonal elements if (square) they are below some given minimum values (Use this before bayesianFusion, for example, to avoid inversion of singular matrixes, etc...)
void operator+= (const CPosePDFGaussian &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 CPosePDFGaussian &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 CPosePDFGaussian &x, const CPosePDFGaussian &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
 The 3x3 covariance 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 CPosePDFGaussianPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CPosePDFGaussian
static mrpt::utils::TRuntimeClassId classCPosePDFGaussian
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 CPosePDFGaussianPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 54 of file CPosePDFGaussian.h.


Constructor & Destructor Documentation

mrpt::poses::CPosePDFGaussian::CPosePDFGaussian ( )

Default constructor.

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

Constructor.

mrpt::poses::CPosePDFGaussian::CPosePDFGaussian ( const CPose2D init_Mean,
const CMatrixDouble33 init_Cov 
)

Constructor.

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

Copy constructor, including transformations between other PDFs.

Definition at line 83 of file CPosePDFGaussian.h.

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

Copy constructor, including transformations between other PDFs.

Definition at line 86 of file CPosePDFGaussian.h.


Member Function Documentation

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

Reimplemented from mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFGaussian::assureMinCovariance ( const double &  minStdXY,
const double &  minStdPhi 
)

Substitutes the diagonal elements if (square) they are below some given minimum values (Use this before bayesianFusion, for example, to avoid inversion of singular matrixes, etc...)

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

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

void mrpt::poses::CPosePDFGaussian::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::CPosePDFGaussian::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::CPosePDFGaussian::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::CPosePDFGaussian::copyFrom ( const CPosePDF o) [virtual]

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

Implements mrpt::poses::CPosePDF.

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

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

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

Draws a single sample from the distribution.

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

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

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

Implements mrpt::utils::CObject.

double mrpt::poses::CPosePDFGaussian::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::CPosePDFGaussian::evaluatePDF ( const CPose2D x) const

Evaluates the PDF at a given point.

void mrpt::poses::CPosePDFGaussian::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::CPosePDFGaussian::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::CPosePDFGaussian::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::poses::CPosePDF.

void mrpt::poses::CPosePDFGaussian::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::CPosePDFGaussian::inverseComposition ( const CPosePDFGaussian x,
const CPosePDFGaussian 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::CPosePDFGaussian::inverseComposition ( const CPosePDFGaussian x1,
const CPosePDFGaussian 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::CPosePDFGaussian::jacobiansPoseComposition ( const CPosePDFGaussian x,
const CPosePDFGaussian 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  ]

Referenced by mrpt::math::jacobians::jacobs_2D_pose_comp().

double mrpt::poses::CPosePDFGaussian::mahalanobisDistanceTo ( const CPosePDFGaussian theOther)

Computes the Mahalanobis distance between the centers of two Gaussians.

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

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

void mrpt::poses::CPosePDFGaussian::operator+= ( const CPosePDFGaussian 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::CPosePDFGaussian::operator-= ( const CPosePDFGaussian ref) [inline]

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

Definition at line 185 of file CPosePDFGaussian.h.

void mrpt::poses::CPosePDFGaussian::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::CPosePDFGaussian::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 54 of file CPosePDFGaussian.h.

Definition at line 54 of file CPosePDFGaussian.h.

Definition at line 54 of file CPosePDFGaussian.h.

The 3x3 covariance matrix.

Definition at line 66 of file CPosePDFGaussian.h.

The mean value.

Definition at line 65 of file CPosePDFGaussian.h.




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