Main MRPT website > C++ reference
MRPT logo

mrpt::bayes::CParticleFilterData< T > Class Template Reference

This template class declares the array of particles and its internal data, managing some memory-related issues and providing an easy implementation of virtual methods required for implementing a CParticleFilterCapable. More...

#include <mrpt/bayes/CParticleFilterData.h>

Collaboration diagram for mrpt::bayes::CParticleFilterData< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef T CParticleDataContent
 This is the type inside the corresponding CParticleData class.
typedef CProbabilityParticle< T > 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

 CParticleFilterData ()
 Default constructor.
void clearParticles ()
 Free the memory of all the particles and reset the array "m_particles" to length zero.
virtual ~CParticleFilterData ()
 Virtual destructor.
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.

Public Attributes

CParticleList m_particles
 The array of particles.

Detailed Description

template<class T>
class mrpt::bayes::CParticleFilterData< T >

This template class declares the array of particles and its internal data, managing some memory-related issues and providing an easy implementation of virtual methods required for implementing a CParticleFilterCapable.

By adding IMPLEMENT_PARTICLE_FILTER_CAPABLE(T) to the body of the declaration of classes inheriting from both CParticleFilterData and CParticleFilterCapable, the following pure virtual methods are automatically implemented (the param T must be equal to the argument of the template CParticleFilterData).

Since CProbabilityParticle implements all the required operators, the member "m_particles" can be safely copied with "=" or copy constructor operators and new objects will be created internally instead of copying the internal pointers, which would lead to memory corruption.

See also:
CParticleFilter, CParticleFilterCapable, IMPLEMENT_PARTICLE_FILTER_CAPABLE

Definition at line 56 of file CParticleFilterData.h.


Member Typedef Documentation

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

Definition at line 60 of file CParticleFilterData.h.

template<class T>
typedef T mrpt::bayes::CParticleFilterData< T >::CParticleDataContent

This is the type inside the corresponding CParticleData class.

Definition at line 59 of file CParticleFilterData.h.

template<class T>
typedef std::deque<CParticleData> mrpt::bayes::CParticleFilterData< T >::CParticleList

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

Definition at line 61 of file CParticleFilterData.h.


Constructor & Destructor Documentation

template<class T>
mrpt::bayes::CParticleFilterData< T >::CParticleFilterData (  )  [inline]

Default constructor.

Definition at line 66 of file CParticleFilterData.h.

template<class T>
virtual mrpt::bayes::CParticleFilterData< T >::~CParticleFilterData (  )  [inline, virtual]

Virtual destructor.

Definition at line 82 of file CParticleFilterData.h.


Member Function Documentation

template<class T>
void mrpt::bayes::CParticleFilterData< T >::clearParticles (  )  [inline]

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

Definition at line 71 of file CParticleFilterData.h.

Referenced by mrpt::bayes::CParticleFilterData< CRBPFParticleData >::readParticlesFromStream(), and mrpt::bayes::CParticleFilterData< CRBPFParticleData >::~CParticleFilterData().

template<class T>
const CParticleData* mrpt::bayes::CParticleFilterData< T >::getMostLikelyParticle (  )  const [inline]

Returns the particle with the highest weight.

Reimplemented in mrpt::poses::CPose3DPDFParticles, and mrpt::poses::CPosePDFParticles.

Definition at line 139 of file CParticleFilterData.h.

template<class T>
void mrpt::bayes::CParticleFilterData< T >::getWeights ( vector_double out_logWeights  )  const [inline]

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

Definition at line 126 of file CParticleFilterData.h.

template<class T>
void mrpt::bayes::CParticleFilterData< T >::readParticlesFromStream ( utils::CStream in  )  [inline]

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

See also:
writeParticlesToStream

Definition at line 106 of file CParticleFilterData.h.

template<class T>
void mrpt::bayes::CParticleFilterData< T >::writeParticlesToStream ( utils::CStream out  )  const [inline]

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

See also:
readParticlesFromStream

Definition at line 92 of file CParticleFilterData.h.


Member Data Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010