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

Detailed Description

Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximately at the same time as one "snapshot" of the environment.

It can contain "observations" of many different kinds.

New observations can be added using:

CObservationXXXPtr o = CObservationXXX::Create(); // Create a smart pointer containing an object of class "CObservationXXX"
o->(...)
sf.insert(o);

The following methods are equivalent for adding new observations to a "sensory frame":

To examine the objects within a sensory frame, the following methods exist:

Notice that contained observations objects are automatically deleted on this object's destruction or clear.

See also
CObservation

Definition at line 54 of file CSensoryFrame.h.

#include <mrpt/slam/CSensoryFrame.h>

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

Public Types

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

Public Member Functions

 CSensoryFrame ()
 Default constructor. More...
 
 CSensoryFrame (const CSensoryFrame &)
 Copy constructor. More...
 
CSensoryFrameoperator= (const CSensoryFrame &o)
 Copy. More...
 
virtual ~CSensoryFrame ()
 Destructor. More...
 
void clear ()
 Clear all current observations. More...
 
bool insertObservationsInto (mrpt::slam::CMetricMap *theMap, const CPose3D *robotPose=NULL) const
 Insert all the observations in this SF into a metric map or any kind (see mrpt::slam::CMetricMap). More...
 
bool insertObservationsInto (mrpt::slam::CMetricMapPtr &theMap, const CPose3D *robotPose=NULL) const
 Insert all the observations in this SF into a metric map or any kind (see mrpt::slam::CMetricMap). More...
 
void operator+= (const CSensoryFrame &sf)
 You can use "sf1+=sf2;" to add observations in sf2 to sf1. More...
 
void operator+= (const CObservationPtr &obs)
 You can use "sf+=obs;" to add the observation "obs" to the "sf1". More...
 
void moveFrom (CSensoryFrame &sf)
 Copies all the observation from another object, then erase them from the origin object (this method is fast since only pointers are copied); Previous objects in this objects are not deleted. More...
 
void push_back (const CObservationPtr &obs)
 Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the passed object, this class will do at destructor or when appropriate. More...
 
void insert (const CObservationPtr &obs)
 Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the passed object, this class will do at destructor or when appropriate. More...
 
template<typename T >
T::SmartPtr getObservationByClass (const size_t &ith=0) const
 Returns the i'th observation of a given class (or of a descendant class), or NULL if there is no such observation in the array. More...
 
const_iterator begin () const
 Returns a iterator to the first observation: this is an example of usage: More...
 
const_iterator end () const
 Returns a iterator to the end of the list of observations: this is an example of usage: More...
 
iterator begin ()
 Returns a iterator to the first observation: this is an example of usage: More...
 
iterator end ()
 Returns a iterator to the end of the list of observations: this is an example of usage: More...
 
size_t size () const
 Returns the number of observations in the list. More...
 
bool empty () const
 Returns true if there are no observations in the list. More...
 
void eraseByIndex (const size_t &idx)
 Removes the i'th observation in the list (0=first). More...
 
iterator erase (const iterator &it)
 Removes the given observation in the list, and return an iterator to the next element (or this->end() if it was the last one). More...
 
void eraseByLabel (const std::string &label)
 Removes all the observations that match a given sensorLabel. More...
 
CObservationPtr getObservationByIndex (const size_t &idx) const
 Returns the i'th observation in the list (0=first). More...
 
template<typename T >
getObservationByIndexAs (const size_t &idx) const
 Returns the i'th observation in the list (0=first), and as a different smart pointer type: More...
 
CObservationPtr getObservationBySensorLabel (const std::string &label, const size_t &idx=0) const
 Returns the i'th observation in the list with the given "sensorLabel" (0=first). More...
 
template<typename T >
getObservationBySensorLabelAs (const std::string &label, const size_t &idx=0) const
 Returns the i'th observation in the list with the given "sensorLabel" (0=first), and as a different smart pointer type: More...
 
void swap (CSensoryFrame &sf)
 Efficiently swaps the contents of two objects. 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< CObservationPtrm_observations
 The set of observations taken at the same time instant. More...
 

RTTI stuff

typedef CSensoryFramePtr SmartPtr
 
static mrpt::utils::CLASSINIT _init_CSensoryFrame
 
static mrpt::utils::TRuntimeClassId classCSensoryFrame
 
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 CSensoryFramePtr Create ()
 

Cached points map

mrpt::slam::CMetricMapPtr m_cachedMap
 A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap(). More...
 
template<class POINTSMAP >
const POINTSMAP * getAuxPointsMap () const
 Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(), or NULL otherwise. More...
 
template<class POINTSMAP >
const POINTSMAP * buildAuxPointsMap (const void *options=NULL) const
 Returns a cached points map representing this laser scan, building it upon the first call. More...
 
void internal_buildAuxPointsMap (const void *options=NULL) const
 Internal method, used from buildAuxPointsMap() More...
 

Member Typedef Documentation

◆ const_iterator

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

Definition at line 199 of file CSensoryFrame.h.

◆ iterator

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

Definition at line 195 of file CSensoryFrame.h.

◆ SmartPtr

A typedef for the associated smart pointer

Definition at line 57 of file CSensoryFrame.h.

Constructor & Destructor Documentation

◆ CSensoryFrame() [1/2]

mrpt::slam::CSensoryFrame::CSensoryFrame ( )

Default constructor.

◆ CSensoryFrame() [2/2]

mrpt::slam::CSensoryFrame::CSensoryFrame ( const CSensoryFrame )

Copy constructor.

◆ ~CSensoryFrame()

virtual mrpt::slam::CSensoryFrame::~CSensoryFrame ( )
virtual

Destructor.

Member Function Documentation

◆ _GetBaseClass()

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

◆ begin() [1/2]

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

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

...
for (CSensoryFrame::iterator it=sf.begin();it!=sf.end();++it)
{
(*it)->... // (*it) is a "CObservation*"
}

Definition at line 212 of file CSensoryFrame.h.

◆ begin() [2/2]

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

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

...
for (CSensoryFrame::iterator it=sf.begin();it!=sf.end();++it)
{
(*it)->... // (*it) is a "CObservation*"
}

Definition at line 238 of file CSensoryFrame.h.

◆ buildAuxPointsMap()

template<class POINTSMAP >
const POINTSMAP* mrpt::slam::CSensoryFrame::buildAuxPointsMap ( const void *  options = NULL) const
inline

Returns a cached points map representing this laser scan, building it upon the first call.

Parameters
optionsCan be NULL to use default point maps' insertion options, or a pointer to a "CPointsMap::TInsertionOptions" structure to override some params. Usage:
mrpt::slam::CPointsMap *map = sf->buildAuxPointsMap<mrpt::slam::CPointsMap>(&options or NULL);
See also
getAuxPointsMap

Definition at line 101 of file CSensoryFrame.h.

References mrpt::slam::CMetricMapPtr::pointer().

◆ clear()

void mrpt::slam::CSensoryFrame::clear ( )

Clear all current observations.

◆ clone()

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

Cloning interface for smart pointers.

Definition at line 135 of file CObject.h.

◆ Create()

static CSensoryFramePtr mrpt::slam::CSensoryFrame::Create ( )
static

◆ CreateObject()

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

◆ duplicate()

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

◆ empty()

bool mrpt::slam::CSensoryFrame::empty ( ) const
inline

Returns true if there are no observations in the list.

Definition at line 258 of file CSensoryFrame.h.

◆ end() [1/2]

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

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

...
for (CSensoryFrame::iterator it=sf.begin();it!=sf.end();++it)
{
(*it)->... // (*it) is a "CObservation*"
}

Definition at line 225 of file CSensoryFrame.h.

◆ end() [2/2]

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

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

...
for (CSensoryFrame::iterator it=sf.begin();it!=sf.end();++it)
{
(*it)->... // (*it) is a "CObservation*"
}

Definition at line 251 of file CSensoryFrame.h.

◆ erase()

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

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

◆ eraseByIndex()

void mrpt::slam::CSensoryFrame::eraseByIndex ( const size_t &  idx)

Removes the i'th observation in the list (0=first).

◆ eraseByLabel()

void mrpt::slam::CSensoryFrame::eraseByLabel ( const std::string &  label)

Removes all the observations that match a given sensorLabel.

◆ getAuxPointsMap()

template<class POINTSMAP >
const POINTSMAP* mrpt::slam::CSensoryFrame::getAuxPointsMap ( ) const
inline

Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(), or NULL otherwise.

Usage:

mrpt::slam::CPointsMap *map = obs->getAuxPointsMap<mrpt::slam::CPointsMap>();
See also
buildAuxPointsMap

Definition at line 88 of file CSensoryFrame.h.

References mrpt::slam::CMetricMapPtr::pointer().

◆ getObservationByClass()

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

Returns the i'th observation of a given class (or of a descendant class), or NULL if there is no such observation in the array.

Example:

CObservationImagePtr obs = m_SF->getObservationByClass<CObservationImage>();

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

Definition at line 180 of file CSensoryFrame.h.

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

◆ getObservationByIndex()

CObservationPtr mrpt::slam::CSensoryFrame::getObservationByIndex ( const size_t &  idx) const

Returns the i'th observation in the list (0=first).

See also
begin, size

◆ getObservationByIndexAs()

template<typename T >
T mrpt::slam::CSensoryFrame::getObservationByIndexAs ( const size_t &  idx) const
inline

Returns the i'th observation in the list (0=first), and as a different smart pointer type:

sf.getObservationByIndexAs<CObservationStereoImagesPtr>(i);
See also
begin, size

Definition at line 283 of file CSensoryFrame.h.

◆ getObservationBySensorLabel()

CObservationPtr mrpt::slam::CSensoryFrame::getObservationBySensorLabel ( const std::string &  label,
const size_t &  idx = 0 
) const

Returns the i'th observation in the list with the given "sensorLabel" (0=first).

Returns
The observation, or NULL if not found.
See also
begin, size

◆ getObservationBySensorLabelAs()

template<typename T >
T mrpt::slam::CSensoryFrame::getObservationBySensorLabelAs ( const std::string &  label,
const size_t &  idx = 0 
) const
inline

Returns the i'th observation in the list with the given "sensorLabel" (0=first), and as a different smart pointer type:

sf.getObservationBySensorLabelAs<CObservationStereoImagesPtr>(i);
See also
begin, size

Definition at line 301 of file CSensoryFrame.h.

◆ GetRuntimeClass()

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

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

◆ insert()

void mrpt::slam::CSensoryFrame::insert ( const CObservationPtr obs)

Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the passed object, this class will do at destructor or when appropriate.

◆ insertObservationsInto() [1/2]

bool mrpt::slam::CSensoryFrame::insertObservationsInto ( mrpt::slam::CMetricMap theMap,
const CPose3D robotPose = NULL 
) const

Insert all the observations in this SF into a metric map or any kind (see mrpt::slam::CMetricMap).

It calls CObservation::insertObservationInto for all stored observation.

Parameters
theMapThe map where this observation is to be inserted: the map will be updated.
robotPoseThe pose of the robot base for this observation, relative to the target metric map. Set to NULL (default) to use (0,0,0deg)
Returns
Returns true if the map has been updated, or false if this observations has nothing to do with a metric map (for example, a sound observation).
See also
mrpt::slam::CMetricMap, CObservation::insertObservationInto, CMetricMap::insertObservation

◆ insertObservationsInto() [2/2]

bool mrpt::slam::CSensoryFrame::insertObservationsInto ( mrpt::slam::CMetricMapPtr theMap,
const CPose3D robotPose = NULL 
) const
inline

Insert all the observations in this SF into a metric map or any kind (see mrpt::slam::CMetricMap).

It calls CObservation::insertObservationInto for all stored observation.

Parameters
theMapThe map where this observation is to be inserted: the map will be updated.
robotPoseThe pose of the robot base for this observation, relative to the target metric map. Set to NULL (default) to use (0,0,0deg)
Returns
Returns true if the map has been updated, or false if this observations has nothing to do with a metric map (for example, a sound observation).
See also
mrpt::slam::CMetricMap, CObservation::insertObservationInto, CMetricMap::insertObservation

Definition at line 143 of file CSensoryFrame.h.

References mrpt::slam::CMetricMapPtr::pointer().

◆ internal_buildAuxPointsMap()

void mrpt::slam::CSensoryFrame::internal_buildAuxPointsMap ( const void *  options = NULL) const
protected

Internal method, used from buildAuxPointsMap()

◆ moveFrom()

void mrpt::slam::CSensoryFrame::moveFrom ( CSensoryFrame sf)

Copies all the observation from another object, then erase them from the origin object (this method is fast since only pointers are copied); Previous objects in this objects are not deleted.

See also
operator +=

◆ operator+=() [1/2]

void mrpt::slam::CSensoryFrame::operator+= ( const CSensoryFrame sf)

You can use "sf1+=sf2;" to add observations in sf2 to sf1.

Objects are copied, not referenced, thus the source can be safely deleted next.

See also
moveFrom

◆ operator+=() [2/2]

void mrpt::slam::CSensoryFrame::operator+= ( const CObservationPtr obs)

You can use "sf+=obs;" to add the observation "obs" to the "sf1".

Objects are copied, using the smart pointer, thus the original pointer can be safely deleted next.

See also
moveFrom

◆ operator=()

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

Copy.

◆ push_back()

void mrpt::slam::CSensoryFrame::push_back ( const CObservationPtr obs)

Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the passed object, this class will do at destructor or when appropriate.

◆ readFromStream()

void mrpt::slam::CSensoryFrame::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::CSensoryFrame::size ( ) const
inline

Returns the number of observations in the list.

Definition at line 255 of file CSensoryFrame.h.

◆ swap()

void mrpt::slam::CSensoryFrame::swap ( CSensoryFrame sf)

Efficiently swaps the contents of two objects.

◆ writeToStream()

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

mrpt::utils::CLASSINIT mrpt::slam::CSensoryFrame::_init_CSensoryFrame
staticprotected

Definition at line 57 of file CSensoryFrame.h.

◆ classCObject

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

Definition at line 120 of file CObject.h.

◆ classCSensoryFrame

mrpt::utils::TRuntimeClassId mrpt::slam::CSensoryFrame::classCSensoryFrame
static

Definition at line 57 of file CSensoryFrame.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::CSensoryFrame::classinfo
static

Definition at line 57 of file CSensoryFrame.h.

◆ m_cachedMap

mrpt::slam::CMetricMapPtr mrpt::slam::CSensoryFrame::m_cachedMap
mutableprotected

A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap().

It's a generic smart pointer to avoid depending here in the library mrpt-obs on classes on other libraries.

Definition at line 74 of file CSensoryFrame.h.

◆ m_observations

std::deque<CObservationPtr> mrpt::slam::CSensoryFrame::m_observations
protected

The set of observations taken at the same time instant.

See the top of this page for instructions on accessing this.

Definition at line 314 of file CSensoryFrame.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