Main MRPT website > C++ reference
MRPT logo
List of all members | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes
mrpt::slam::CActionCollection Class Reference

Detailed Description

Declares a class for storing a collection of robot actions.

It is used in mrpt::slam::CRawlog, for logs storage and particle filter based simulations.

See also
CAction, CRawlog

Definition at line 30 of file CActionCollection.h.

#include <mrpt/slam/CActionCollection.h>

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

Public Types

typedef std::deque< CActionPtr >::iterator iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 
typedef std::deque< CActionPtr >::const_iterator const_iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 

Public Member Functions

 CActionCollection ()
 Constructor. More...
 
 CActionCollection (CAction &a)
 Constructor from a single action. More...
 
 CActionCollection (const CActionCollection &o)
 Copy Constructor. More...
 
CActionCollectionoperator= (const CActionCollection &o)
 Copy operator. More...
 
virtual ~CActionCollection ()
 Destructor. More...
 
const_iterator begin () const
 Returns a iterator to the first action: this is an example of usage: More...
 
iterator begin ()
 Returns a iterator to the first action: this is an example of usage: More...
 
const_iterator end () const
 Returns a iterator pointing to the end of the list: this is an example of usage: More...
 
iterator end ()
 Returns a iterator pointing to the end of the list: this is an example of usage: More...
 
iterator erase (const iterator &it)
 Removes the given action in the list, and return an iterator to the next element (or this->end() if it was the last one). More...
 
void clear ()
 Erase all actions from the list. More...
 
CActionPtr get (size_t index)
 Access the i'th action.DO NOT MODIFY the returned object, make a copy of ir with "CSerializable::duplicate" if desired. More...
 
template<typename T >
T::SmartPtr getActionByClass (const size_t &ith=0) const
 Access to the i'th action of a given class, or a NULL smart pointer if there is no action of that class in the list. More...
 
void insert (CAction &action)
 Add a new object to the list. More...
 
size_t size ()
 Returns the actions count in the collection. More...
 
CActionRobotMovement2DPtr getBestMovementEstimation () const
 Returns the best pose increment estimator in the collection, based on the determinant of its pose change covariance matrix. More...
 
CActionRobotMovement2DPtr getMovementEstimationByType (CActionRobotMovement2D::TEstimationMethod method)
 Returns the pose increment estimator in the collection having the specified type. More...
 
bool getFirstMovementEstimationMean (CPose3D &out_pose_increment) const
 Look for the first 2D or 3D "odometry" found in this collection of actions, and return the "mean" increment of the robot according to it. More...
 
bool getFirstMovementEstimation (CPose3DPDFGaussian &out_pose_increment) const
 Look for the first 2D or 3D "odometry" found in this collection of actions, and return the "mean" increment of the robot and its covariance according to it. More...
 
void eraseByIndex (const size_t &index)
 Remove an action from the list by its index. More...
 
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). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 

Static Public Attributes

static const mrpt::utils::TRuntimeClassId classCObject
 
RTTI stuff
static const mrpt::utils::TRuntimeClassId classCSerializable
 

Protected Member Functions

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

Protected Attributes

std::deque< CActionPtrm_actions
 The actions: More...
 

RTTI stuff

typedef CActionCollectionPtr SmartPtr
 
static mrpt::utils::CLASSINIT _init_CActionCollection
 
static mrpt::utils::TRuntimeClassId classCActionCollection
 
static const mrpt::utils::TRuntimeClassIdclassinfo
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CActionCollectionPtr Create ()
 

Member Typedef Documentation

◆ const_iterator

You can use CActionCollection::begin to get a iterator to the first element.

Definition at line 67 of file CActionCollection.h.

◆ iterator

You can use CActionCollection::begin to get a iterator to the first element.

Definition at line 63 of file CActionCollection.h.

◆ SmartPtr

A typedef for the associated smart pointer

Definition at line 33 of file CActionCollection.h.

Constructor & Destructor Documentation

◆ CActionCollection() [1/3]

mrpt::slam::CActionCollection::CActionCollection ( )

Constructor.

◆ CActionCollection() [2/3]

mrpt::slam::CActionCollection::CActionCollection ( CAction a)

Constructor from a single action.

◆ CActionCollection() [3/3]

mrpt::slam::CActionCollection::CActionCollection ( const CActionCollection o)

Copy Constructor.

◆ ~CActionCollection()

virtual mrpt::slam::CActionCollection::~CActionCollection ( )
virtual

Destructor.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CActionCollection::_GetBaseClass ( )
staticprotected

◆ begin() [1/2]

const_iterator mrpt::slam::CActionCollection::begin ( ) const
inline

Returns a iterator to the first action: this is an example of usage:

...
for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it)
{
(*it)->... // (*it) is a "CActionPtr"
}

Definition at line 80 of file CActionCollection.h.

◆ begin() [2/2]

iterator mrpt::slam::CActionCollection::begin ( )
inline

Returns a iterator to the first action: this is an example of usage:

...
for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it)
{
(*it)->... // (*it) is a "CActionPtr"
}

Definition at line 93 of file CActionCollection.h.

◆ clear()

void mrpt::slam::CActionCollection::clear ( )

Erase all actions from the list.

◆ clone()

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

Cloning interface for smart pointers.

Definition at line 135 of file CObject.h.

◆ Create()

static CActionCollectionPtr mrpt::slam::CActionCollection::Create ( )
static

◆ CreateObject()

static mrpt::utils::CObject* mrpt::slam::CActionCollection::CreateObject ( )
static

◆ duplicate()

virtual mrpt::utils::CObject* mrpt::slam::CActionCollection::duplicate ( ) const
virtual

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

Implements mrpt::utils::CObject.

◆ duplicateGetSmartPtr()

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 132 of file CObject.h.

◆ end() [1/2]

const_iterator mrpt::slam::CActionCollection::end ( ) const
inline

Returns a iterator pointing to the end of the list: this is an example of usage:

...
for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it)
{
(*it)->... // (*it) is a "CActionPtr"
}

Definition at line 106 of file CActionCollection.h.

◆ end() [2/2]

iterator mrpt::slam::CActionCollection::end ( )
inline

Returns a iterator pointing to the end of the list: this is an example of usage:

...
for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it)
{
(*it)->... // (*it) is a "CActionPtr"
}

Definition at line 119 of file CActionCollection.h.

◆ erase()

iterator mrpt::slam::CActionCollection::erase ( const iterator it)

Removes the given action in the list, and return an iterator to the next element (or this->end() if it was the last one).

◆ eraseByIndex()

void mrpt::slam::CActionCollection::eraseByIndex ( const size_t &  index)

Remove an action from the list by its index.

Exceptions
std::exceptionOn index out of bounds.

◆ get()

CActionPtr mrpt::slam::CActionCollection::get ( size_t  index)

Access the i'th action.DO NOT MODIFY the returned object, make a copy of ir with "CSerializable::duplicate" if desired.

First element is 0.

Exceptions
std::exceptionOn index out of bounds.

◆ getActionByClass()

template<typename T >
T::SmartPtr mrpt::slam::CActionCollection::getActionByClass ( const size_t &  ith = 0) const
inline

Access to the i'th action of a given class, or a NULL smart pointer if there is no action of that class in the list.

Example:

CActionRobotMovement2DPtr obs = acts->getActionByClass<CActionRobotMovement2D>();

By default (ith=0), the first one is returned.

Definition at line 144 of file CActionCollection.h.

References begin(), end(), MRPT_END, and MRPT_START.

Referenced by mrpt::slam::PF_implementation< CPose2D, CMonteCarloLocalization2D >::PF_SLAM_implementation_gatherActionsCheckBothActObs(), and mrpt::slam::PF_implementation< CPose2D, CMonteCarloLocalization2D >::PF_SLAM_implementation_pfStandardProposal().

◆ getBestMovementEstimation()

CActionRobotMovement2DPtr mrpt::slam::CActionCollection::getBestMovementEstimation ( ) const

Returns the best pose increment estimator in the collection, based on the determinant of its pose change covariance matrix.

Returns
The estimation, or NULL if none is available.

Referenced by mrpt::slam::PF_implementation< CPose2D, CMonteCarloLocalization2D >::PF_SLAM_implementation_gatherActionsCheckBothActObs(), and mrpt::slam::PF_implementation< CPose2D, CMonteCarloLocalization2D >::PF_SLAM_implementation_pfStandardProposal().

◆ getFirstMovementEstimation()

bool mrpt::slam::CActionCollection::getFirstMovementEstimation ( CPose3DPDFGaussian out_pose_increment) const

Look for the first 2D or 3D "odometry" found in this collection of actions, and return the "mean" increment of the robot and its covariance according to it.

Returns
true on success,false on no odometry found.

◆ getFirstMovementEstimationMean()

bool mrpt::slam::CActionCollection::getFirstMovementEstimationMean ( CPose3D out_pose_increment) const

Look for the first 2D or 3D "odometry" found in this collection of actions, and return the "mean" increment of the robot according to it.

Returns
true on success,false on no odometry found.

◆ getMovementEstimationByType()

CActionRobotMovement2DPtr mrpt::slam::CActionCollection::getMovementEstimationByType ( CActionRobotMovement2D::TEstimationMethod  method)

Returns the pose increment estimator in the collection having the specified type.

Returns
The estimation, or NULL if none is available.

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::slam::CActionCollection::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

◆ insert()

void mrpt::slam::CActionCollection::insert ( CAction action)

Add a new object to the list.

◆ operator=()

CActionCollection& mrpt::slam::CActionCollection::operator= ( const CActionCollection o)

Copy operator.

◆ readFromStream()

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

◆ size()

size_t mrpt::slam::CActionCollection::size ( )

Returns the actions count in the collection.

◆ writeToStream()

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

◆ _init_CActionCollection

mrpt::utils::CLASSINIT mrpt::slam::CActionCollection::_init_CActionCollection
staticprotected

Definition at line 33 of file CActionCollection.h.

◆ classCActionCollection

mrpt::utils::TRuntimeClassId mrpt::slam::CActionCollection::classCActionCollection
static

Definition at line 33 of file CActionCollection.h.

◆ classCObject

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

Definition at line 120 of file CObject.h.

◆ classCSerializable

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

Definition at line 35 of file CSerializable.h.

◆ classinfo

const mrpt::utils::TRuntimeClassId* mrpt::slam::CActionCollection::classinfo
static

Definition at line 33 of file CActionCollection.h.

◆ m_actions

std::deque<CActionPtr> mrpt::slam::CActionCollection::m_actions
protected

The actions:

Definition at line 38 of file CActionCollection.h.




Page generated by Doxygen 1.8.14 for MRPT 1.1.0 SVN: at lun oct 28 00:54:49 CET 2019 Hosted on:
SourceForge.net Logo