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

Detailed Description

Declares a class for storing a collection of robot actions.

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

See also
CAction, CRawlog

Definition at line 29 of file CActionCollection.h.

#include <mrpt/obs/CActionCollection.h>

Inheritance diagram for mrpt::obs::CActionCollection:
Inheritance graph

Public Types

typedef std::deque< mrpt::utils::poly_ptr_ptr< CAction::Ptr > >::iterator iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 
typedef std::deque< mrpt::utils::poly_ptr_ptr< CAction::Ptr > >::const_iterator const_iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
 CActionCollection ()
 ctor More...
 
 CActionCollection (CAction &a)
 Constructor from a single action. 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...
 
CAction::Ptr 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...
 
const CActionget (size_t index) const
 
template<typename T >
T::Ptr getActionByClass (const size_t &ith=0) const
 Access to the i'th action of a given class, or a nullptr 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...
 
CActionRobotMovement2D::Ptr getBestMovementEstimation () const
 Returns the best pose increment estimator in the collection, based on the determinant of its pose change covariance matrix. More...
 
CActionRobotMovement2D::Ptr getMovementEstimationByType (CActionRobotMovement2D::TEstimationMethod method)
 Returns the pose increment estimator in the collection having the specified type. More...
 
bool getFirstMovementEstimationMean (mrpt::poses::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 (mrpt::poses::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...
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
RTTI classes and functions
mrpt::utils::CObject::Ptr 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...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const override
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version) override
 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< mrpt::utils::poly_ptr_ptr< CAction::Ptr > > m_actions
 The robot "actionss". More...
 

RTTI stuff

using Ptr = std::shared_ptr< CActionCollection >
 
using ConstPtr = std::shared_ptr< const CActionCollection >
 
static mrpt::utils::CLASSINIT _init_CActionCollection
 
static const mrpt::utils::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CActionCollection"
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
static const mrpt::utils::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::utils::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ const_iterator

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

Definition at line 53 of file CActionCollection.h.

◆ ConstPtr

Definition at line 31 of file CActionCollection.h.

◆ iterator

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

Definition at line 47 of file CActionCollection.h.

◆ Ptr

A typedef for the associated smart pointer

Definition at line 31 of file CActionCollection.h.

Constructor & Destructor Documentation

◆ CActionCollection() [1/2]

CActionCollection::CActionCollection ( )

ctor

Definition at line 31 of file CActionCollection.cpp.

◆ CActionCollection() [2/2]

CActionCollection::CActionCollection ( CAction a)

Constructor from a single action.

Definition at line 35 of file CActionCollection.cpp.

References m_actions.

Member Function Documentation

◆ _GetBaseClass()

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

◆ begin() [1/2]

const_iterator mrpt::obs::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 "CAction::Ptr"
}

Definition at line 66 of file CActionCollection.h.

References m_actions.

Referenced by getActionByClass(), getBestMovementEstimation(), getMovementEstimationByType(), readFromStream(), and writeToStream().

Here is the caller graph for this function:

◆ begin() [2/2]

iterator mrpt::obs::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 "CAction::Ptr"
}

Definition at line 78 of file CActionCollection.h.

References m_actions.

◆ clear()

void CActionCollection::clear ( )

Erase all actions from the list.

Definition at line 85 of file CActionCollection.cpp.

References m_actions.

Referenced by readFromStream().

Here is the caller graph for this function:

◆ clone()

virtual mrpt::utils::CObject* mrpt::obs::CActionCollection::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::utils::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::obs::CActionCollection::Create ( Args &&...  args)
inlinestatic

Definition at line 31 of file CActionCollection.h.

◆ CreateObject()

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

◆ end() [1/2]

const_iterator mrpt::obs::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 "CAction::Ptr"
}

Definition at line 91 of file CActionCollection.h.

References m_actions.

Referenced by erase(), getActionByClass(), getBestMovementEstimation(), getMovementEstimationByType(), readFromStream(), and writeToStream().

Here is the caller graph for this function:

◆ end() [2/2]

iterator mrpt::obs::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 "CAction::Ptr"
}

Definition at line 104 of file CActionCollection.h.

References m_actions.

◆ erase()

CActionCollection::iterator 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).

Definition at line 196 of file CActionCollection.cpp.

References ASSERT_, end(), m_actions, MRPT_END, and MRPT_START.

Here is the call graph for this function:

◆ eraseByIndex()

void CActionCollection::eraseByIndex ( const size_t &  index)

Remove an action from the list by its index.

Exceptions
std::exceptionOn index out of bounds.

Definition at line 156 of file CActionCollection.cpp.

References m_actions, and THROW_EXCEPTION.

◆ get() [1/2]

CAction::Ptr 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.

Definition at line 89 of file CActionCollection.cpp.

References m_actions, and THROW_EXCEPTION.

◆ get() [2/2]

const CAction & CActionCollection::get ( size_t  index) const

Definition at line 96 of file CActionCollection.cpp.

References m_actions, and THROW_EXCEPTION.

◆ getActionByClass()

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

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

Example:

acts->getActionByClass<CActionRobotMovement2D>();

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

Definition at line 132 of file CActionCollection.h.

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

Referenced by mrpt::slam::StandardProposal::PF_SLAM_implementation(), mrpt::slam::AuxiliaryPFStandardAndOptimal< USE_OPTIMAL_SAMPLING >::PF_SLAM_implementation_gatherActionsCheckBothActObs(), and mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBestMovementEstimation()

CActionRobotMovement2D::Ptr 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 nullptr if none is available.

Definition at line 118 of file CActionCollection.cpp.

References begin(), CLASS_ID, det(), mrpt::obs::CActionRobotMovement2D::emScan2DMatching, and end().

Referenced by mrpt::slam::StandardProposal::PF_SLAM_implementation(), mrpt::slam::AuxiliaryPFStandardAndOptimal< USE_OPTIMAL_SAMPLING >::PF_SLAM_implementation_gatherActionsCheckBothActObs(), and mrpt::slam::CMetricMapBuilderICP::processActionObservation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFirstMovementEstimation()

bool CActionCollection::getFirstMovementEstimation ( mrpt::poses::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.

Definition at line 231 of file CActionCollection.cpp.

References mrpt::poses::CPose3DPDFGaussian::copyFrom().

Here is the call graph for this function:

◆ getFirstMovementEstimationMean()

bool CActionCollection::getFirstMovementEstimationMean ( mrpt::poses::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.

Definition at line 208 of file CActionCollection.cpp.

◆ getMovementEstimationByType()

CActionRobotMovement2D::Ptr CActionCollection::getMovementEstimationByType ( CActionRobotMovement2D::TEstimationMethod  method)

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

Returns
The estimation, or nullptr if none is available.

Definition at line 167 of file CActionCollection.cpp.

References begin(), CLASS_ID, and end().

Here is the call graph for this function:

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::obs::CActionCollection::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::utils::TRuntimeClassId& mrpt::obs::CActionCollection::GetRuntimeClassIdStatic ( )
static

◆ insert()

void CActionCollection::insert ( CAction action)

Add a new object to the list.

Definition at line 110 of file CActionCollection.cpp.

References mrpt::utils::CObject::clone(), and m_actions.

Referenced by mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator delete() [1/3]

void mrpt::obs::CActionCollection::operator delete ( void ptr)
inlinenoexcept

Definition at line 31 of file CActionCollection.h.

◆ operator delete() [2/3]

void mrpt::obs::CActionCollection::operator delete ( void ptr,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 31 of file CActionCollection.h.

◆ operator delete() [3/3]

void mrpt::obs::CActionCollection::operator delete ( void memory,
void ptr 
)
inlinenoexcept

Definition at line 31 of file CActionCollection.h.

◆ operator delete[]()

void mrpt::obs::CActionCollection::operator delete[] ( void ptr)
inlinenoexcept

Definition at line 31 of file CActionCollection.h.

◆ operator new() [1/3]

void* mrpt::obs::CActionCollection::operator new ( size_t  size)
inline

Definition at line 31 of file CActionCollection.h.

◆ operator new() [2/3]

void* mrpt::obs::CActionCollection::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 31 of file CActionCollection.h.

◆ operator new() [3/3]

static void* mrpt::obs::CActionCollection::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 31 of file CActionCollection.h.

◆ operator new[]()

void* mrpt::obs::CActionCollection::operator new[] ( size_t  size)
inline

Definition at line 31 of file CActionCollection.h.

◆ readFromStream()

void CActionCollection::readFromStream ( mrpt::utils::CStream in,
int  version 
)
overrideprotectedvirtual

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.

Definition at line 61 of file CActionCollection.cpp.

References begin(), clear(), end(), m_actions, and MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

Here is the call graph for this function:

◆ size()

size_t CActionCollection::size ( )

Returns the actions count in the collection.

Definition at line 106 of file CActionCollection.cpp.

References m_actions.

◆ writeToMatlab()

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 89 of file CSerializable.h.

◆ writeToStream()

void CActionCollection::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
overrideprotectedvirtual

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 nullptr, 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.

Definition at line 43 of file CActionCollection.cpp.

References begin(), end(), and m_actions.

Here is the call graph for this function:

Member Data Documentation

◆ _init_CActionCollection

mrpt::utils::CLASSINIT mrpt::obs::CActionCollection::_init_CActionCollection
staticprotected

Definition at line 31 of file CActionCollection.h.

◆ className

constexpr const char* mrpt::obs::CActionCollection::className = "CActionCollection"
static

Definition at line 31 of file CActionCollection.h.

◆ m_actions

std::deque<mrpt::utils::poly_ptr_ptr<CAction::Ptr> > mrpt::obs::CActionCollection::m_actions
protected

The robot "actionss".

Definition at line 35 of file CActionCollection.h.

Referenced by begin(), CActionCollection(), clear(), end(), erase(), eraseByIndex(), get(), insert(), readFromStream(), size(), and writeToStream().

◆ runtimeClassId

const mrpt::utils::TRuntimeClassId mrpt::obs::CActionCollection::runtimeClassId
staticprotected

Definition at line 31 of file CActionCollection.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019