Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
mrpt::poses::CPointPDFSOG Class Reference

Detailed Description

Declares a class that represents a Probability Density function (PDF) of a 3D point $ p(\mathbf{x}) = [x ~ y ~ z ]^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 CPointPDFSOG::m_modes

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

See also:
CPointPDF, CPosePDF,

#include <mrpt/poses/CPointPDFSOG.h>

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

List of all members.

Classes

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

Public Types

typedef std::deque< TGaussianModeCListGaussianModes
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 TDATA 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 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.
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
 Returns an estimate of the point, (the mean, or mathematical expectation of the PDF).
void getCovarianceAndMean (CMatrixDouble33 &cov, CPoint3D &mean_point) const
 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)
 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:
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 drawSingleSample (CPoint3D &outSample) const
 Draw a sample from the pdf.
void bayesianFusion (const CPointPDF &p1, const CPointPDF &p2, const double &minMahalanobisDistToDrop=0)
 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, 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.
template<class OPENGL_SETOFOBJECTSPTR , class OPENGL_SETOFOBJECTS >
OPENGL_SETOFOBJECTSPTR getAs3DObject () const
 Returns a 3D representation of this PDF.
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).
CObjectclone () const
 Cloning interface for smart pointers.
virtual void getMean (TDATA &mean_point) const =0
 Returns the mean, or mathematical expectation of the probability density distribution (PDF).
virtual void getCovarianceAndMean (CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov, TDATA &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 (CMatrixDouble &cov, TDATA &mean_point) const
 Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once.
TDATA getMeanVal () const
 Returns the mean, or mathematical expectation of the probability density distribution (PDF).
void getCovariance (CMatrixDouble &cov) const
 Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
void getCovariance (CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov) const
 Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
CMatrixFixedNumeric< double,
STATE_LEN, STATE_LEN > 
getCovariance () const
 Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)
virtual void drawSingleSample (TDATA &outPart) const =0
 Draws a single sample from the distribution.
virtual 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 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
mrpt::utils::TRuntimeClassId 
classCObject
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
static const
mrpt::utils::TRuntimeClassId 
classCSerializable

Protected Member Functions

void assureSymmetry ()
 Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor lead to non-symmetric matrixes!)
virtual void writeToStream (mrpt::utils::CStream &out, int *getVersion) const =0
 Introduces a pure virtual method responsible for writing to a CStream.
virtual void readFromStream (mrpt::utils::CStream &in, int version)=0
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Protected Attributes

CListGaussianModes m_modes
 The list of SOG modes.

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCPointPDF
class mrpt::utils::CStream

RTTI stuff

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
 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 CPointPDFSOGPtr Create ()

Member Typedef Documentation

Definition at line 75 of file CPointPDFSOG.h.

Definition at line 76 of file CPointPDFSOG.h.

Definition at line 77 of file CPointPDFSOG.h.

A typedef for the associated smart pointer

Definition at line 57 of file CPointPDFSOG.h.

The type of the state the PDF represents.

Definition at line 54 of file CProbabilityDensityFunction.h.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
is_3D_val 

Definition at line 78 of file CPointPDF.h.

anonymous enum [inherited]
Enumerator:
is_PDF_val 

Definition at line 80 of file CPointPDF.h.


Constructor & Destructor Documentation

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

Default constructor.

Parameters:
nModesThe initial size of CPointPDFSOG::m_modes

Member Function Documentation

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

Reimplemented from mrpt::poses::CPointPDF.

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

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

void mrpt::poses::CPointPDFSOG::bayesianFusion ( const CPointPDF p1,
const CPointPDF p2,
const double &  minMahalanobisDistToDrop = 0 
) [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!)

Parameters:
p1The first distribution to fuse
p2The second distribution to fuse
minMahalanobisDistToDropIf 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.

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

Definition at line 122 of file CPointPDFSOG.h.

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

Definition at line 124 of file CPointPDFSOG.h.

void mrpt::poses::CPointPDFSOG::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< CPoint3D, 3 >.

void mrpt::poses::CPointPDFSOG::clear ( )

Clear all the gaussian modes.

CObject* mrpt::utils::CObject::clone ( ) const [inline, inherited]

Cloning interface for smart pointers.

Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.

Definition at line 154 of file CObject.h.

void mrpt::poses::CPointPDFSOG::copyFrom ( const CPointPDF o) [virtual]

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

Implements mrpt::poses::CPointPDF.

static CPointPDFSOGPtr mrpt::poses::CPointPDFSOG::Create ( ) [static]
static mrpt::utils::CObject* mrpt::poses::CPointPDFSOG::CreateObject ( ) [static]
virtual void mrpt::utils::CProbabilityDensityFunction::drawManySamples ( size_t  N,
std::vector< vector_double > &  outSamples 
) const [inline, virtual, inherited]

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 126 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction::drawSingleSample ( TDATA &  outPart) const [pure virtual, inherited]

Draws a single sample from the distribution.

void mrpt::poses::CPointPDFSOG::drawSingleSample ( CPoint3D outSample) const

Draw a sample from the pdf.

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

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

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const [inline, inherited]

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 151 of file CObject.h.

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

Return whether there is any Gaussian mode.

Definition at line 131 of file CPointPDFSOG.h.

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

Definition at line 123 of file CPointPDFSOG.h.

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

Definition at line 125 of file CPointPDFSOG.h.

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

Definition at line 127 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,
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).

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

Access to individual beacons.

Definition at line 107 of file CPointPDFSOG.h.

References ASSERT_.

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

Access to individual beacons.

Definition at line 112 of file CPointPDFSOG.h.

References ASSERT_.

template<class OPENGL_SETOFOBJECTSPTR >
void mrpt::poses::CPointPDF::getAs3DObject ( OPENGL_SETOFOBJECTSPTR &  out_obj) const [inline, inherited]

Returns a 3D representation of this PDF.

Note:
Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument.

Definition at line 87 of file CPointPDF.h.

References mrpt::opengl::posePDF2opengl().

template<class OPENGL_SETOFOBJECTSPTR , class OPENGL_SETOFOBJECTS >
OPENGL_SETOFOBJECTSPTR mrpt::poses::CPointPDF::getAs3DObject ( ) const [inline, inherited]

Returns a 3D representation of this PDF.

Note:
Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument.

Definition at line 96 of file CPointPDF.h.

References mrpt::opengl::posePDF2opengl().

void mrpt::utils::CProbabilityDensityFunction::getCovariance ( CMatrixDouble cov) const [inline, inherited]

Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)

See also:
getMean, getCovarianceAndMean

Definition at line 89 of file CProbabilityDensityFunction.h.

void mrpt::utils::CProbabilityDensityFunction::getCovariance ( CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &  cov) const [inline, inherited]

Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)

See also:
getMean, getCovarianceAndMean

Definition at line 98 of file CProbabilityDensityFunction.h.

CMatrixFixedNumeric<double,STATE_LEN,STATE_LEN> mrpt::utils::CProbabilityDensityFunction::getCovariance ( ) const [inline, inherited]

Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix)

See also:
getMean

Definition at line 107 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction::getCovarianceAndMean ( CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &  cov,
TDATA &  mean_point 
) const [pure virtual, inherited]

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

See also:
getMean
void mrpt::poses::CPointPDFSOG::getCovarianceAndMean ( CMatrixDouble33 cov,
CPoint3D mean_point 
) const

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

See also:
getMean
void mrpt::utils::CProbabilityDensityFunction::getCovarianceDynAndMean ( CMatrixDouble cov,
TDATA &  mean_point 
) const [inline, inherited]

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

See also:
getMean

Definition at line 69 of file CProbabilityDensityFunction.h.

double mrpt::utils::CProbabilityDensityFunction::getCovarianceEntropy ( ) const [inline, inherited]

Compute the entropy of the estimated covariance matrix.

See also:
http://en.wikipedia.org/wiki/Multivariate_normal_distribution#Entropy

Definition at line 145 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction::getMean ( TDATA &  mean_point) const [pure virtual, inherited]

Returns the mean, or mathematical expectation of the probability density distribution (PDF).

See also:
getCovarianceAndMean
void mrpt::poses::CPointPDFSOG::getMean ( CPoint3D mean_point) const

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

See also:
getCovariance
TDATA mrpt::utils::CProbabilityDensityFunction::getMeanVal ( ) const [inline, inherited]

Returns the mean, or mathematical expectation of the probability density distribution (PDF).

See also:
getCovariance

Definition at line 79 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 const mrpt::utils::TRuntimeClassId* mrpt::poses::CPointPDFSOG::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::poses::CPointPDF.

static bool mrpt::poses::CPointPDF::is_3D ( ) [inline, static, inherited]

Definition at line 79 of file CPointPDF.h.

static bool mrpt::poses::CPointPDF::is_PDF ( ) [inline, static, inherited]

Definition at line 81 of file CPointPDF.h.

void mrpt::poses::CPointPDFSOG::normalizeWeights ( )

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

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

Access to individual beacons.

Definition at line 96 of file CPointPDFSOG.h.

References ASSERT_.

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

Access to individual beacons.

Definition at line 101 of file CPointPDFSOG.h.

References ASSERT_.

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

Inserts a copy of the given mode into the SOG.

Definition at line 118 of file CPointPDFSOG.h.

virtual void mrpt::utils::CSerializable::readFromStream ( mrpt::utils::CStream in,
int  version 
) [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters:
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions:
std::exceptionOn any error, see CStream::ReadBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.

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

Resize the number of SOG modes.

void mrpt::poses::CPointPDFSOG::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)
  • x_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< CPoint3D, 3 >.

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

Return the number of Gaussian modes.

Definition at line 130 of file CPointPDFSOG.h.

virtual void mrpt::utils::CSerializable::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters:
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions:
std::exceptionOn any error, see CStream::WriteBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.


Friends And Related Function Documentation

friend class mrpt::utils::CStream [friend, inherited]

Reimplemented from mrpt::utils::CSerializable.

Definition at line 63 of file CPointPDF.h.


Member Data Documentation

Definition at line 57 of file CPointPDFSOG.h.

Definition at line 139 of file CObject.h.

Definition at line 63 of file CPointPDF.h.

Definition at line 57 of file CPointPDFSOG.h.

Definition at line 56 of file CSerializable.h.

Definition at line 57 of file CPointPDFSOG.h.

The list of SOG modes.

Definition at line 85 of file CPointPDFSOG.h.

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 53 of file CProbabilityDensityFunction.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011