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

Detailed Description

The class for storing individual "beacon landmarks" under a variety of 3D position PDF distributions.

This class is used for storage within the class CBeaconMap. The class implements the same methods than the interface "CPointPDF", and invoking them actually becomes a mapping into the methods of the current PDF representation of the beacon, selectable by means of "m_typePDF"

See also:
CBeaconMap, CPointPDFSOG

#include <mrpt/slam/CBeacon.h>

Inheritance diagram for mrpt::slam::CBeacon:
Inheritance graph
[legend]

List of all members.

Public Types

enum  TTypePDF { pdfMonteCarlo = 0, pdfGauss, pdfSOG }
 See m_typePDF. More...
typedef int64_t TBeaconID
 The type for the IDs of landmarks.
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

 CBeacon ()
 Default constructor.
virtual ~CBeacon ()
 Virtual destructor.
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.
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 getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &outObj) const
 Saves a 3D representation of the beacon into a given OpenGL scene.
void getAsMatlabDrawCommands (utils::CStringList &out_Str) const
 Gets a set of MATLAB commands which draw the current state of the beacon:
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 generateObservationModelDistribution (const float &sensedRange, CPointPDFSOG &outPDF, const CBeaconMap *myBeaconMap, const CPoint3D &sensorPntOnRobot, const CPoint3D &centerPoint=CPoint3D(0, 0, 0), const float &maxDistanceFromCenter=0) const
 Compute the observation model p(z_t|x_t) for a given observation (range value), and return it as an approximate SOG.
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 void generateRingSOG (const float &sensedRange, CPointPDFSOG &outPDF, const CBeaconMap *myBeaconMap, const CPoint3D &sensorPnt, const CMatrixDouble33 *covarianceCompositionToAdd=NULL, bool clearPreviousContentsOutPDF=true, const CPoint3D &centerPoint=CPoint3D(0, 0, 0), const float &maxDistanceFromCenter=0)
 This static method returns a SOG with ring-shape (or as a 3D sphere) that can be used to initialize a beacon if observed the first time.
static bool is_3D ()
static bool is_PDF ()

Public Attributes

TTypePDF m_typePDF
 Which one of the different 3D point PDF is currently used in this object: montecarlo, gaussian, or a sum of gaussians.
CPointPDFParticles m_locationMC
 The individual PDF, if m_typePDF=pdfMonteCarlo (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).
CPointPDFGaussian m_locationGauss
 The individual PDF, if m_typePDF=pdfGauss (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).
CPointPDFSOG m_locationSOG
 The individual PDF, if m_typePDF=pdfSOG (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).
TBeaconID m_ID
 An ID for the landmark (see details next...) This ID was introduced in the version 3 of this class (21/NOV/2006), and its aim is to provide a way for easily establishing correspondences between landmarks detected in sequential image frames.

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

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.

RTTI stuff

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

RTTI stuff

typedef CBeaconPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CBeacon
static mrpt::utils::TRuntimeClassId classCBeacon
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 CBeaconPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 65 of file CBeacon.h.

The type for the IDs of landmarks.

Definition at line 70 of file CBeacon.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.

See m_typePDF.

Enumerator:
pdfMonteCarlo 
pdfGauss 
pdfSOG 

Definition at line 74 of file CBeacon.h.


Constructor & Destructor Documentation

mrpt::slam::CBeacon::CBeacon ( )

Default constructor.

virtual mrpt::slam::CBeacon::~CBeacon ( ) [virtual]

Virtual destructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CBeacon::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::poses::CPointPDF.

void mrpt::slam::CBeacon::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::slam::CBeacon::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 >.

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::slam::CBeacon::copyFrom ( const CPointPDF o) [virtual]

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

Implements mrpt::poses::CPointPDF.

static CBeaconPtr mrpt::slam::CBeacon::Create ( ) [static]
static mrpt::utils::CObject* mrpt::slam::CBeacon::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::slam::CBeacon::drawSingleSample ( CPoint3D outSample) const

Draw a sample from the pdf.

virtual mrpt::utils::CObject* mrpt::slam::CBeacon::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.

void mrpt::slam::CBeacon::generateObservationModelDistribution ( const float &  sensedRange,
CPointPDFSOG outPDF,
const CBeaconMap myBeaconMap,
const CPoint3D sensorPntOnRobot,
const CPoint3D centerPoint = CPoint3D(0, 0, 0),
const float &  maxDistanceFromCenter = 0 
) const

Compute the observation model p(z_t|x_t) for a given observation (range value), and return it as an approximate SOG.

Note that if the beacon is a SOG itself, the number of gaussian modes will be square. As a speed-up, if a "center point"+"maxDistanceFromCenter" is supplied (maxDistanceFromCenter!=0), those modes farther than this sphere will be discarded. Parameters such as the stdSigma of the sensor are gathered from "myBeaconMap" The result is one "ring" for each Gaussian mode that represent the beacon position in this object. The position of the sensor on the robot is used to shift the resulting densities such as they represent the position of the robot, not the sensor.

See also:
CBeaconMap::insertionOptions, generateRingSOG
static void mrpt::slam::CBeacon::generateRingSOG ( const float &  sensedRange,
CPointPDFSOG outPDF,
const CBeaconMap myBeaconMap,
const CPoint3D sensorPnt,
const CMatrixDouble33 covarianceCompositionToAdd = NULL,
bool  clearPreviousContentsOutPDF = true,
const CPoint3D centerPoint = CPoint3D(0, 0, 0),
const float &  maxDistanceFromCenter = 0 
) [static]

This static method returns a SOG with ring-shape (or as a 3D sphere) that can be used to initialize a beacon if observed the first time.

sensorPnt is the center of the ring/sphere, i.e. the absolute position of the range sensor. If clearPreviousContentsOutPDF=false, the SOG modes will be added to the current contents of outPDF If the 3x3 matrix covarianceCompositionToAdd is provided, it will be add to every Gaussian (to model the composition of uncertainty).

See also:
generateObservationModelDistribution
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::slam::CBeacon::getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr outObj) const

Saves a 3D representation of the beacon into a given OpenGL scene.

void mrpt::slam::CBeacon::getAsMatlabDrawCommands ( utils::CStringList out_Str) const

Gets a set of MATLAB commands which draw the current state of the beacon:

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::slam::CBeacon::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::slam::CBeacon::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.

virtual const mrpt::utils::TRuntimeClassId* mrpt::slam::CBeacon::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.

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::slam::CBeacon::saveToTextFile ( const std::string file) const [virtual]

Save PDF's particles to a text file.

See derived classes for more information about the format of generated files.

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

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 65 of file CBeacon.h.

Definition at line 65 of file CBeacon.h.

Definition at line 139 of file CObject.h.

Definition at line 63 of file CPointPDF.h.

Definition at line 56 of file CSerializable.h.

Definition at line 65 of file CBeacon.h.

An ID for the landmark (see details next...) This ID was introduced in the version 3 of this class (21/NOV/2006), and its aim is to provide a way for easily establishing correspondences between landmarks detected in sequential image frames.

Thus, the management of this field should be:

  • In 'servers' (classes/modules/... that detect landmarks from images): A different ID must be assigned to every landmark (e.g. a sequential counter), BUT only in the case of being sure of the correspondence of one landmark with another one in the past (e.g. tracking).
  • In 'clients': This field can be ignored, but if it is used, the advantage is solving the correspondence between landmarks detected in consequentive instants of time: Two landmarks with the same ID correspond to the same physical feature, BUT it should not be expected the inverse to be always true.

Note that this field is never fill out automatically, it must be set by the programmer if used.

Definition at line 102 of file CBeacon.h.

The individual PDF, if m_typePDF=pdfGauss (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).

Definition at line 87 of file CBeacon.h.

The individual PDF, if m_typePDF=pdfMonteCarlo (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).

Definition at line 83 of file CBeacon.h.

The individual PDF, if m_typePDF=pdfSOG (publicly accesible for ease of use, but the CPointPDF interface is also implemented in CBeacon).

Definition at line 91 of file CBeacon.h.

Which one of the different 3D point PDF is currently used in this object: montecarlo, gaussian, or a sum of gaussians.

See also:
m_location

Definition at line 79 of file CBeacon.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