MRPT  1.9.9
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 26 of file CActionCollection.h.

#include <mrpt/obs/CActionCollection.h>

Inheritance diagram for mrpt::obs::CActionCollection:

Public Types

using iterator = std::deque< mrpt::containers::deepcopy_poly_ptr< CAction::Ptr > >::iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 
using const_iterator = std::deque< mrpt::containers::deepcopy_poly_ptr< CAction::Ptr > >::const_iterator
 You can use CActionCollection::begin to get a iterator to the first element. More...
 

Public Member Functions

 CActionCollection ()=default
 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 for polymorphic hierarchies
mrpt::rtti::CObject::Ptr duplicateGetSmartPtr () const
 Makes a deep copy of the object and returns a smart pointer to it. More...
 

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 
CSerializable virtual methods
virtual void serializeTo (CSchemeArchiveBase &out) const
 Virtual method for writing (serializing) to an abstract schema based archive. More...
 
virtual void serializeFrom (CSchemeArchiveBase &in)
 Virtual method for reading (deserializing) from an abstract schema based archive. More...
 

Protected Attributes

std::deque< mrpt::containers::deepcopy_poly_ptr< CAction::Ptr > > m_actions
 The robot "actionss". More...
 

RTTI stuff

using Ptr = std::shared_ptr< CActionCollection >
 
using ConstPtr = std::shared_ptr< const CActionCollection >
 
using UniquePtr = std::unique_ptr< CActionCollection >
 
using ConstUniquePtr = std::unique_ptr< const CActionCollection >
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CActionCollection"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static std::shared_ptr< CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename Alloc , typename... Args>
static Ptr CreateAlloc (const Alloc &alloc, Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::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 50 of file CActionCollection.h.

◆ ConstPtr

◆ ConstUniquePtr

Definition at line 28 of file CActionCollection.h.

◆ iterator

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

Definition at line 44 of file CActionCollection.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 28 of file CActionCollection.h.

◆ UniquePtr

Definition at line 28 of file CActionCollection.h.

Constructor & Destructor Documentation

◆ CActionCollection() [1/2]

mrpt::obs::CActionCollection::CActionCollection ( )
default

ctor

◆ CActionCollection() [2/2]

CActionCollection::CActionCollection ( CAction a)

Constructor from a single action.

Definition at line 25 of file CActionCollection.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::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 63 of file CActionCollection.h.

References m_actions.

◆ 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 75 of file CActionCollection.h.

References m_actions.

◆ clear()

void CActionCollection::clear ( )

Erase all actions from the list.

Definition at line 60 of file CActionCollection.cpp.

◆ clone()

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

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

Implements mrpt::rtti::CObject.

◆ Create()

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

Definition at line 28 of file CActionCollection.h.

◆ CreateAlloc()

template<typename Alloc , typename... Args>
static Ptr mrpt::obs::CActionCollection::CreateAlloc ( const Alloc &  alloc,
Args &&...  args 
)
inlinestatic

Definition at line 28 of file CActionCollection.h.

◆ CreateObject()

static std::shared_ptr<CObject> mrpt::obs::CActionCollection::CreateObject ( )
static

◆ CreateUnique()

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

Definition at line 28 of file CActionCollection.h.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Makes a deep copy of the object and returns a smart pointer to it.

Definition at line 191 of file CObject.h.

References mrpt::rtti::CObject::clone().

Referenced by mrpt::obs::CRawlog::addActions(), and mrpt::obs::CRawlog::addObservations().

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

◆ 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 88 of file CActionCollection.h.

References m_actions.

◆ 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 101 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 170 of file CActionCollection.cpp.

References ASSERT_, MRPT_END, and MRPT_START.

◆ 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 131 of file CActionCollection.cpp.

References 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 64 of file CActionCollection.cpp.

References THROW_EXCEPTION.

◆ get() [2/2]

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

Definition at line 71 of file CActionCollection.cpp.

References 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 129 of file CActionCollection.h.

References MRPT_END, and MRPT_START.

Referenced by mrpt::slam::PF_implementation< mrpt::math::TPose3D, CMonteCarloLocalization3D, mrpt::bayes::particle_storage_mode::VALUE >::PF_SLAM_implementation_gatherActionsCheckBothActObs(), mrpt::slam::PF_implementation< mrpt::math::TPose3D, CMonteCarloLocalization3D, mrpt::bayes::particle_storage_mode::VALUE >::PF_SLAM_implementation_pfStandardProposal(), mrpt::maps::CMultiMetricMapPDF::prediction_and_update_pfOptimalProposal(), and mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().

Here is the caller graph for this function:

◆ getBestMovementEstimation()

◆ getClassName()

static constexpr auto mrpt::obs::CActionCollection::getClassName ( )
inlinestatic

Definition at line 28 of file CActionCollection.h.

◆ 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 205 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 182 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 142 of file CActionCollection.cpp.

References CLASS_ID.

◆ GetRuntimeClass()

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

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

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

◆ insert()

void CActionCollection::insert ( CAction action)

Add a new object to the list.

Definition at line 85 of file CActionCollection.cpp.

References mrpt::rtti::CObject::clone().

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

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

◆ serializeFrom() [1/2]

void CActionCollection::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

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 I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 37 of file CActionCollection.cpp.

References mrpt::containers::begin(), mrpt::containers::clear(), and MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

Here is the call graph for this function:

◆ serializeFrom() [2/2]

virtual void mrpt::serialization::CSerializable::serializeFrom ( CSchemeArchiveBase in)
inlineprotectedvirtualinherited

Virtual method for reading (deserializing) from an abstract schema based archive.

Definition at line 74 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ serializeGetVersion()

uint8_t CActionCollection::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 30 of file CActionCollection.cpp.

◆ serializeTo() [1/2]

void CActionCollection::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 31 of file CActionCollection.cpp.

References mrpt::serialization::CArchive::WriteAs().

Here is the call graph for this function:

◆ serializeTo() [2/2]

virtual void mrpt::serialization::CSerializable::serializeTo ( CSchemeArchiveBase out) const
inlineprotectedvirtualinherited

Virtual method for writing (serializing) to an abstract schema based archive.

Definition at line 64 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ size()

size_t CActionCollection::size ( )

Returns the actions count in the collection.

Definition at line 81 of file CActionCollection.cpp.

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::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 90 of file CSerializable.h.

Member Data Documentation

◆ className

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

Definition at line 28 of file CActionCollection.h.

◆ m_actions

std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr> > mrpt::obs::CActionCollection::m_actions
protected

The robot "actionss".

Definition at line 32 of file CActionCollection.h.

Referenced by begin(), and end().

◆ runtimeClassId

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

Definition at line 28 of file CActionCollection.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 1de0e027c Sat Sep 14 16:15:22 2019 +0200 at sáb sep 14 16:20:14 CEST 2019