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

mrpt::poses::CPoseRandomSampler Class Reference


Detailed Description

An efficient generator of random samples drawn from a given 2D (CPosePDF) or 3D (CPose3DPDF) pose probability density function (pdf).

This class keeps an internal state which speeds up the sequential generation of samples. It can manage any kind of pose PDF.

Use with CPoseRandomSampler::setPosePDF, then CPoseRandomSampler::drawSample to draw values.

Notice that you can pass a 2D or 3D pose PDF, then ask for a 2D or 3D sample. This class always returns the kind of sample you ask it for, but will skip missing terms or fill out with zeroes as required. Specifically, when sampling 3D poses from a 2D pose pdf, this class will be smart enought to draw only the 3 required dimensions, avoiding a waste of time with the other 3 missing components.

See also:
CPosePDF, CPose3DPDF

Definition at line 54 of file CPoseRandomSampler.h.

#include <mrpt/poses/CPoseRandomSampler.h>

List of all members.

Public Member Functions

 CPoseRandomSampler ()
 Default constructor.
 ~CPoseRandomSampler ()
 Destructor.
void setPosePDF (const CPosePDF *pdf)
 This method must be called to select the PDF from which to draw samples.
void setPosePDF (const CPosePDFPtr &pdf)
 This method must be called to select the PDF from which to draw samples.
void setPosePDF (const CPosePDF &pdf)
 This method must be called to select the PDF from which to draw samples.
void setPosePDF (const CPose3DPDF *pdf)
 This method must be called to select the PDF from which to draw samples.
void setPosePDF (const CPose3DPDFPtr &pdf)
 This method must be called to select the PDF from which to draw samples.
void setPosePDF (const CPose3DPDF &pdf)
 This method must be called to select the PDF from which to draw samples.
CPose2DdrawSample (CPose2D &p) const
 Generate a new sample from the selected PDF.
CPose3DdrawSample (CPose3D &p) const
 Generate a new sample from the selected PDF.
bool isPrepared () const
 Return true if samples can be generated, which only requires a previous call to setPosePDF.
CPose2DgetSamplingMean2D (CPose2D &out_mean) const
 If the object has been loaded with setPosePDF this method returns the 2D pose mean samples will be drawn around.
CPose3DgetSamplingMean3D (CPose3D &out_mean) const
 If the object has been loaded with setPosePDF this method returns the 3D pose mean samples will be drawn around.
void getOriginalPDFCov2D (CMatrixDouble33 &cov3x3) const
 Retrieves the 3x3 covariance of the original PDF in $ [ x ~ y ~ \phi ] $.
void getOriginalPDFCov2D (CMatrixDouble &cov3x3) const
 Retrieves the 3x3 covariance of the original PDF in $ [ x ~ y ~ \phi ] $.
void getOriginalPDFCov3D (CMatrixDouble66 &cov6x6) const
 Retrieves the 6x6 covariance of the original PDF in $ [ x ~ y ~ z ~ yaw ~ pitch ~ roll ] $.
void getOriginalPDFCov3D (CMatrixDouble &cov6x6) const
 Retrieves the 6x6 covariance of the original PDF in $ [ x ~ y ~ z ~ yaw ~ pitch ~ roll ] $.

Protected Member Functions

void clear ()
 Clear internal pdf.
void do_sample_2D (CPose2D &p) const
 Used internally: sample from m_pdf2D.
void do_sample_3D (CPose3D &p) const
 Used internally: sample from m_pdf3D.

Protected Attributes

CPosePDFm_pdf2D
 A local copy of the PDF.
CPose3DPDFm_pdf3D
 A local copy of the PDF.
CMatrixDouble33 m_fastdraw_gauss_Z3
CMatrixDouble66 m_fastdraw_gauss_Z6
CPose2D m_fastdraw_gauss_M_2D
CPose3D m_fastdraw_gauss_M_3D

Constructor & Destructor Documentation

mrpt::poses::CPoseRandomSampler::CPoseRandomSampler ( )

Default constructor.

mrpt::poses::CPoseRandomSampler::~CPoseRandomSampler ( )

Destructor.


Member Function Documentation

void mrpt::poses::CPoseRandomSampler::clear ( ) [protected]

Clear internal pdf.

void mrpt::poses::CPoseRandomSampler::do_sample_2D ( CPose2D p) const [protected]

Used internally: sample from m_pdf2D.

void mrpt::poses::CPoseRandomSampler::do_sample_3D ( CPose3D p) const [protected]

Used internally: sample from m_pdf3D.

CPose2D& mrpt::poses::CPoseRandomSampler::drawSample ( CPose2D p) const

Generate a new sample from the selected PDF.

Returns:
A reference to the same object passed as argument.
See also:
setPosePDF
CPose3D& mrpt::poses::CPoseRandomSampler::drawSample ( CPose3D p) const

Generate a new sample from the selected PDF.

Returns:
A reference to the same object passed as argument.
See also:
setPosePDF
void mrpt::poses::CPoseRandomSampler::getOriginalPDFCov2D ( CMatrixDouble cov3x3) const [inline]

Retrieves the 3x3 covariance of the original PDF in $ [ x ~ y ~ \phi ] $.

Definition at line 133 of file CPoseRandomSampler.h.

void mrpt::poses::CPoseRandomSampler::getOriginalPDFCov2D ( CMatrixDouble33 cov3x3) const

Retrieves the 3x3 covariance of the original PDF in $ [ x ~ y ~ \phi ] $.

void mrpt::poses::CPoseRandomSampler::getOriginalPDFCov3D ( CMatrixDouble66 cov6x6) const

Retrieves the 6x6 covariance of the original PDF in $ [ x ~ y ~ z ~ yaw ~ pitch ~ roll ] $.

void mrpt::poses::CPoseRandomSampler::getOriginalPDFCov3D ( CMatrixDouble cov6x6) const [inline]

Retrieves the 6x6 covariance of the original PDF in $ [ x ~ y ~ z ~ yaw ~ pitch ~ roll ] $.

Definition at line 143 of file CPoseRandomSampler.h.

CPose2D& mrpt::poses::CPoseRandomSampler::getSamplingMean2D ( CPose2D out_mean) const

If the object has been loaded with setPosePDF this method returns the 2D pose mean samples will be drawn around.

Returns:
A reference to the argument
CPose3D& mrpt::poses::CPoseRandomSampler::getSamplingMean3D ( CPose3D out_mean) const

If the object has been loaded with setPosePDF this method returns the 3D pose mean samples will be drawn around.

Returns:
A reference to the argument
bool mrpt::poses::CPoseRandomSampler::isPrepared ( ) const

Return true if samples can be generated, which only requires a previous call to setPosePDF.

void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPosePDFPtr pdf) [inline]

This method must be called to select the PDF from which to draw samples.

See also:
drawSample

Definition at line 86 of file CPoseRandomSampler.h.

References mrpt::poses::CPosePDFPtr::pointer(), and setPosePDF().

Referenced by setPosePDF().

void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPose3DPDF pdf)

This method must be called to select the PDF from which to draw samples.

See also:
drawSample
void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPose3DPDFPtr pdf) [inline]

This method must be called to select the PDF from which to draw samples.

See also:
drawSample

Definition at line 101 of file CPoseRandomSampler.h.

References mrpt::poses::CPose3DPDFPtr::pointer(), and setPosePDF().

Referenced by setPosePDF().

void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPosePDF pdf) [inline]

This method must be called to select the PDF from which to draw samples.

See also:
drawSample

Definition at line 91 of file CPoseRandomSampler.h.

References setPosePDF().

Referenced by setPosePDF().

void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPosePDF pdf)

This method must be called to select the PDF from which to draw samples.

See also:
drawSample
void mrpt::poses::CPoseRandomSampler::setPosePDF ( const CPose3DPDF pdf) [inline]

This method must be called to select the PDF from which to draw samples.

See also:
drawSample

Definition at line 106 of file CPoseRandomSampler.h.

References setPosePDF().

Referenced by setPosePDF().


Member Data Documentation

Definition at line 63 of file CPoseRandomSampler.h.

Definition at line 64 of file CPoseRandomSampler.h.

Definition at line 61 of file CPoseRandomSampler.h.

Definition at line 62 of file CPoseRandomSampler.h.

A local copy of the PDF.

Definition at line 58 of file CPoseRandomSampler.h.

A local copy of the PDF.

Definition at line 59 of file CPoseRandomSampler.h.




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