Main MRPT website > C++ reference
MRPT logo
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions
mrpt::poses::CPointPDFParticles Class Referenceabstract

Detailed Description

A probability distribution of a 2D/3D point, represented as a set of random samples (particles).

See Also
CPointPDF

Definition at line 71 of file CPointPDFParticles.h.

#include <mrpt/poses/CPointPDFParticles.h>

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

Public Types

enum  { is_3D_val = 1 }
 
enum  { is_PDF_val = 1 }
 
typedef CPoint3D type_value
 The type of the state the PDF represents.
 
typedef TSimple3DPoint CParticleDataContent
 This is the type inside the corresponding CParticleData class.
 
typedef CProbabilityParticle
< TSimple3DPoint
CParticleData
 Use this to refer to each element in the m_particles array.
 
typedef std::deque< CParticleDataCParticleList
 Use this type to refer to the list of particles m_particles.
 

Public Member Functions

 CPointPDFParticles (size_t numParticles=1)
 Default constructor.
 
virtual ~CPointPDFParticles ()
 Destructor.
 
void clear ()
 Clear all the particles (free memory)
 
void setSize (size_t numberParticles, const CPoint3D &defaultValue=CPoint3D(0, 0, 0))
 Erase all the previous particles and change the number of particles, with a given initial value.
 
size_t size () const
 Returns the number of particles.
 
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 copyFrom (const CPointPDF &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, where each line is: X Y Z LOG_W.
 
void changeCoordinatesReference (const CPose3D &newReferenceBase)
 this = p (+) this.
 
double computeKurtosis ()
 Compute the kurtosis of the distribution.
 
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!)
 
template<class OPENGL_SETOFOBJECTSPTR >
void getAs3DObject (OPENGL_SETOFOBJECTSPTR &out_obj) const
 Returns a 3D representation of this PDF (it doesn't clear the current contents of out_obj, but append new OpenGL objects to that list)
 
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).
 
CObject * clone () const
 Cloning interface for smart pointers.
 
virtual void getMean (CPoint3D &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, CPoint3D &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, CPoint3D &mean_point) const
 Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once.
 
CPoint3D 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 getInformationMatrix (CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &inf) const
 Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix) Unless reimplemented in derived classes, this method first reads the covariance, then invert it.
 
virtual void drawSingleSample (CPoint3D &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.
 
void clearParticles ()
 Free the memory of all the particles and reset the array "m_particles" to length zero.
 
void writeParticlesToStream (utils::CStream &out) const
 Dumps the sequence of particles and their weights to a stream (requires T implementing CSerializable).
 
void readParticlesFromStream (utils::CStream &in)
 Reads the sequence of particles and their weights from a stream (requires T implementing CSerializable).
 
void getWeights (vector_double &out_logWeights) const
 Returns a vector with the sequence of the logaritmic weights of all the samples.
 
const CParticleDatagetMostLikelyParticle () const
 Returns the particle with the highest weight.
 

Static Public Member Functions

static bool is_3D ()
 
static bool is_PDF ()
 

Public Attributes

CParticleList m_particles
 The array of particles.
 

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 
classCPointPDF
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCSerializable
 

Protected Member Functions

 IMPLEMENT_PARTICLE_FILTER_CAPABLE (TSimple3DPoint)
 
CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream.
 
void readFromStream (mrpt::utils::CStream &in, int version)
 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.
 

RTTI stuff

typedef CPointPDFParticlesPtr SmartPtr
 
static mrpt::utils::CLASSINIT _init_CPointPDFParticles
 
static mrpt::utils::TRuntimeClassId classCPointPDFParticles
 
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 CPointPDFParticlesPtr Create ()
 

Member Typedef Documentation

Use this to refer to each element in the m_particles array.

Definition at line 61 of file CParticleFilterData.h.

This is the type inside the corresponding CParticleData class.

Definition at line 60 of file CParticleFilterData.h.

Use this type to refer to the list of particles m_particles.

Definition at line 62 of file CParticleFilterData.h.

A typedef for the associated smart pointer

Definition at line 74 of file CPointPDFParticles.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::CPointPDFParticles::CPointPDFParticles ( size_t  numParticles = 1)

Default constructor.

virtual mrpt::poses::CPointPDFParticles::~CPointPDFParticles ( )
virtual

Destructor.

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::poses::CPointPDFParticles::_GetBaseClass ( )
staticprotected
void mrpt::poses::CPointPDFParticles::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.

void mrpt::poses::CPointPDFParticles::changeCoordinatesReference ( const CPose3D newReferenceBase)
virtual

this = p (+) this.

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. Both the mean value and the covariance matrix are updated correctly.

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

void mrpt::poses::CPointPDFParticles::clear ( void  )
inline

Clear all the particles (free memory)

Definition at line 90 of file CPointPDFParticles.h.

References setSize().

void mrpt::bayes::CParticleFilterData< TSimple3DPoint >::clearParticles ( )
inlineinherited

Free the memory of all the particles and reset the array "m_particles" to length zero.

Definition at line 72 of file CParticleFilterData.h.

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 154 of file CObject.h.

double mrpt::poses::CPointPDFParticles::computeKurtosis ( )

Compute the kurtosis of the distribution.

void mrpt::poses::CPointPDFParticles::copyFrom ( const CPointPDF o)
virtual

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

Implements mrpt::poses::CPointPDF.

static CPointPDFParticlesPtr mrpt::poses::CPointPDFParticles::Create ( )
static
static mrpt::utils::CObject* mrpt::poses::CPointPDFParticles::CreateObject ( )
static
virtual void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::drawManySamples ( size_t  N,
std::vector< vector_double > &  outSamples 
) const
inlinevirtualinherited

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

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

Draw a sample from the pdf.

virtual void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::drawSingleSample ( CPoint3D outPart) const
pure virtualinherited

Draws a single sample from the distribution.

virtual mrpt::utils::CObject* mrpt::poses::CPointPDFParticles::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
inlineinherited

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.

template<class OPENGL_SETOFOBJECTSPTR >
void mrpt::poses::CPointPDF::getAs3DObject ( OPENGL_SETOFOBJECTSPTR &  out_obj) const
inlineinherited

Returns a 3D representation of this PDF (it doesn't clear the current contents of out_obj, but append new OpenGL objects to that list)

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
inlineinherited

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< CPoint3D , STATE_LEN >::getCovariance ( CMatrixDouble cov) const
inlineinherited

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

See Also
getMean, getCovarianceAndMean, getInformationMatrix

Definition at line 89 of file CProbabilityDensityFunction.h.

void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getCovariance ( CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &  cov) const
inlineinherited

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

See Also
getMean, getCovarianceAndMean, getInformationMatrix

Definition at line 98 of file CProbabilityDensityFunction.h.

CMatrixFixedNumeric<double,STATE_LEN,STATE_LEN> mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getCovariance ( ) const
inlineinherited

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

See Also
getMean, getInformationMatrix

Definition at line 107 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getCovarianceAndMean ( CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &  cov,
CPoint3D mean_point 
) const
pure virtualinherited

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

See Also
getMean, getInformationMatrix
void mrpt::poses::CPointPDFParticles::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< CPoint3D , STATE_LEN >::getCovarianceDynAndMean ( CMatrixDouble cov,
CPoint3D mean_point 
) const
inlineinherited

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

See Also
getMean, getInformationMatrix

Definition at line 69 of file CProbabilityDensityFunction.h.

double mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getCovarianceEntropy ( ) const
inlineinherited

Compute the entropy of the estimated covariance matrix.

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

Definition at line 158 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getInformationMatrix ( CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &  inf) const
inlinevirtualinherited

Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix) Unless reimplemented in derived classes, this method first reads the covariance, then invert it.

See Also
getMean, getCovarianceAndMean

Definition at line 120 of file CProbabilityDensityFunction.h.

virtual void mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getMean ( CPoint3D mean_point) const
pure virtualinherited

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

See Also
getCovarianceAndMean, getInformationMatrix
void mrpt::poses::CPointPDFParticles::getMean ( CPoint3D mean_point) const

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

See Also
getCovariance
CPoint3D mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::getMeanVal ( ) const
inlineinherited

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

See Also
getCovariance, getInformationMatrix

Definition at line 79 of file CProbabilityDensityFunction.h.

const CParticleData* mrpt::bayes::CParticleFilterData< TSimple3DPoint >::getMostLikelyParticle ( ) const
inlineinherited

Returns the particle with the highest weight.

Definition at line 140 of file CParticleFilterData.h.

virtual const mrpt::utils::TRuntimeClassId* mrpt::poses::CPointPDFParticles::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::poses::CPointPDF.

void mrpt::bayes::CParticleFilterData< TSimple3DPoint >::getWeights ( vector_double out_logWeights) const
inlineinherited

Returns a vector with the sequence of the logaritmic weights of all the samples.

Definition at line 127 of file CParticleFilterData.h.

mrpt::poses::CPointPDFParticles::IMPLEMENT_PARTICLE_FILTER_CAPABLE ( TSimple3DPoint  )
protected
static bool mrpt::poses::CPointPDF::is_3D ( )
inlinestaticinherited

Definition at line 79 of file CPointPDF.h.

static bool mrpt::poses::CPointPDF::is_PDF ( )
inlinestaticinherited

Definition at line 81 of file CPointPDF.h.

void mrpt::poses::CPointPDFParticles::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

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

Implements mrpt::utils::CSerializable.

void mrpt::bayes::CParticleFilterData< TSimple3DPoint >::readParticlesFromStream ( utils::CStream in)
inlineinherited

Reads the sequence of particles and their weights from a stream (requires T implementing CSerializable).

See Also
writeParticlesToStream

Definition at line 107 of file CParticleFilterData.h.

void mrpt::poses::CPointPDFParticles::saveToTextFile ( const std::string &  file) const
virtual

Save PDF's particles to a text file, where each line is: X Y Z LOG_W.

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

void mrpt::poses::CPointPDFParticles::setSize ( size_t  numberParticles,
const CPoint3D defaultValue = CPoint3D(0, 0, 0) 
)

Erase all the previous particles and change the number of particles, with a given initial value.

size_t mrpt::poses::CPointPDFParticles::size ( ) const
inline

Returns the number of particles.

Definition at line 98 of file CPointPDFParticles.h.

void mrpt::bayes::CParticleFilterData< TSimple3DPoint >::writeParticlesToStream ( utils::CStream out) const
inlineinherited

Dumps the sequence of particles and their weights to a stream (requires T implementing CSerializable).

See Also
readParticlesFromStream

Definition at line 93 of file CParticleFilterData.h.

void mrpt::poses::CPointPDFParticles::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protectedvirtual

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

Implements mrpt::utils::CSerializable.

Member Data Documentation

mrpt::utils::CLASSINIT mrpt::poses::CPointPDFParticles::_init_CPointPDFParticles
staticprotected

Definition at line 74 of file CPointPDFParticles.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 139 of file CObject.h.

const mrpt::utils::TRuntimeClassId mrpt::poses::CPointPDF::classCPointPDF
staticinherited

Definition at line 63 of file CPointPDF.h.

mrpt::utils::TRuntimeClassId mrpt::poses::CPointPDFParticles::classCPointPDFParticles
static

Definition at line 74 of file CPointPDFParticles.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 56 of file CSerializable.h.

const mrpt::utils::TRuntimeClassId* mrpt::poses::CPointPDFParticles::classinfo
static

Definition at line 74 of file CPointPDFParticles.h.

The array of particles.

Definition at line 64 of file CParticleFilterData.h.

const size_t mrpt::utils::CProbabilityDensityFunction< CPoint3D , STATE_LEN >::state_length
staticinherited

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.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013