Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Types | Public Member Functions | Protected Attributes
mrpt::obs::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);
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
void insert(const CObservationPtr &obs)
Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the p...

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 52 of file obs/CSensoryFrame.h.

#include <mrpt/obs/CSensoryFrame.h>

Inheritance diagram for mrpt::obs::CSensoryFrame:
Inheritance graph

Public Types

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

Public Member Functions

 CSensoryFrame ()
 Default constructor.
 
 CSensoryFrame (const CSensoryFrame &)
 Copy constructor.
 
CSensoryFrameoperator= (const CSensoryFrame &o)
 Copy.
 
virtual ~CSensoryFrame ()
 Destructor.
 
void clear ()
 Clear all current observations.
 
bool insertObservationsInto (mrpt::maps::CMetricMap *theMap, const mrpt::poses::CPose3D *robotPose=NULL) const
 Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::CMetricMap).
 
bool insertObservationsInto (mrpt::maps::CMetricMapPtr &theMap, const mrpt::poses::CPose3D *robotPose=NULL) const
 Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::CMetricMap).
 
void operator+= (const CSensoryFrame &sf)
 You can use "sf1+=sf2;" to add observations in sf2 to sf1.
 
void operator+= (const CObservationPtr &obs)
 You can use "sf+=obs;" to add the observation "obs" to the "sf1".
 
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.
 
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.
 
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.
 
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.
 
const_iterator begin () const
 Returns a iterator to the first observation: this is an example of usage:
 
const_iterator end () const
 Returns a iterator to the end of the list of observations: this is an example of usage:
 
iterator begin ()
 Returns a iterator to the first observation: this is an example of usage:
 
iterator end ()
 Returns a iterator to the end of the list of observations: this is an example of usage:
 
size_t size () const
 Returns the number of observations in the list.
 
bool empty () const
 Returns true if there are no observations in the list.
 
void eraseByIndex (const size_t &idx)
 Removes the i'th observation in the list (0=first).
 
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).
 
void eraseByLabel (const std::string &label)
 Removes all the observations that match a given sensorLabel.
 
CObservationPtr getObservationByIndex (const size_t &idx) const
 Returns the i'th observation in the list (0=first).
 
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:
 
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).
 
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:
 
void swap (CSensoryFrame &sf)
 Efficiently swaps the contents of two objects.
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE
 
void readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE
 

Protected Attributes

std::deque< CObservationPtrm_observations
 The set of observations taken at the same time instant.
 

RTTI stuff <br>

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 MRPT_OVERRIDE
 
virtual mrpt::utils::CObjectduplicate () const MRPT_OVERRIDE
 
static mrpt::utils::CObjectCreateObject ()
 
static CSensoryFramePtr Create ()
 

Cached points map


mrpt::maps::CMetricMapPtr m_cachedMap
 A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap().
 
template<class POINTSMAP >
const POINTSMAP * getAuxPointsMap () const
 Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(), or NULL otherwise.
 
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.
 
void internal_buildAuxPointsMap (const void *options=NULL) const
 Internal method, used from buildAuxPointsMap()
 

Member Typedef Documentation

◆ const_iterator

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

Definition at line 197 of file obs/CSensoryFrame.h.

◆ iterator

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

Definition at line 193 of file obs/CSensoryFrame.h.

◆ SmartPtr

A typedef for the associated smart pointer

Definition at line 55 of file obs/CSensoryFrame.h.

Constructor & Destructor Documentation

◆ CSensoryFrame() [1/2]

mrpt::obs::CSensoryFrame::CSensoryFrame ( )

Default constructor.

◆ CSensoryFrame() [2/2]

mrpt::obs::CSensoryFrame::CSensoryFrame ( const CSensoryFrame )

Copy constructor.

◆ ~CSensoryFrame()

virtual mrpt::obs::CSensoryFrame::~CSensoryFrame ( )
virtual

Destructor.

Member Function Documentation

◆ _GetBaseClass()

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

◆ begin() [1/2]

iterator mrpt::obs::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*"
}
const_iterator end() const
Returns a iterator to the end of the list of observations: this is an example of usage:
std::deque< CObservationPtr >::iterator iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
const_iterator begin() const
Returns a iterator to the first observation: this is an example of usage:

Definition at line 236 of file obs/CSensoryFrame.h.

◆ begin() [2/2]

const_iterator mrpt::obs::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 210 of file obs/CSensoryFrame.h.

◆ buildAuxPointsMap()

template<class POINTSMAP >
const POINTSMAP * mrpt::obs::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::maps::CPointsMap *map = sf->buildAuxPointsMap<mrpt::maps::CPointsMap>(&options or NULL);
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
See also
getAuxPointsMap

Definition at line 99 of file obs/CSensoryFrame.h.

◆ clear()

void mrpt::obs::CSensoryFrame::clear ( )

Clear all current observations.

◆ Create()

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

◆ CreateObject()

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

◆ duplicate()

virtual mrpt::utils::CObject * mrpt::obs::CSensoryFrame::duplicate ( ) const
virtual

◆ empty()

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

Returns true if there are no observations in the list.

Definition at line 256 of file obs/CSensoryFrame.h.

◆ end() [1/2]

iterator mrpt::obs::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 249 of file obs/CSensoryFrame.h.

◆ end() [2/2]

const_iterator mrpt::obs::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 223 of file obs/CSensoryFrame.h.

◆ erase()

iterator mrpt::obs::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::obs::CSensoryFrame::eraseByIndex ( const size_t &  idx)

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

◆ eraseByLabel()

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

Removes all the observations that match a given sensorLabel.

◆ getAuxPointsMap()

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

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

Usage:

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

Definition at line 86 of file obs/CSensoryFrame.h.

◆ getObservationByClass()

template<typename T >
T::SmartPtr mrpt::obs::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>();
Declares a class derived from "CObservation" that encapsules an image from a camera,...
struct OBS_IMPEXP CObservationImagePtr

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

Definition at line 178 of file obs/CSensoryFrame.h.

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

◆ getObservationByIndex()

CObservationPtr mrpt::obs::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::obs::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);
struct OBS_IMPEXP CObservationStereoImagesPtr
See also
begin, size

Definition at line 281 of file obs/CSensoryFrame.h.

◆ getObservationBySensorLabel()

CObservationPtr mrpt::obs::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::obs::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 299 of file obs/CSensoryFrame.h.

◆ GetRuntimeClass()

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

◆ insert()

void mrpt::obs::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::obs::CSensoryFrame::insertObservationsInto ( mrpt::maps::CMetricMap theMap,
const mrpt::poses::CPose3D robotPose = NULL 
) const

Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::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::maps::CMetricMap, CObservation::insertObservationInto, CMetricMap::insertObservation

◆ insertObservationsInto() [2/2]

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

Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::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::maps::CMetricMap, CObservation::insertObservationInto, CMetricMap::insertObservation

Definition at line 141 of file obs/CSensoryFrame.h.

◆ internal_buildAuxPointsMap()

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

Internal method, used from buildAuxPointsMap()

◆ moveFrom()

void mrpt::obs::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::obs::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+=() [2/2]

void mrpt::obs::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=()

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

Copy.

◆ push_back()

void mrpt::obs::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::obs::CSensoryFrame::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protected

◆ size()

size_t mrpt::obs::CSensoryFrame::size ( ) const
inline

Returns the number of observations in the list.

Definition at line 253 of file obs/CSensoryFrame.h.

◆ swap()

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

Efficiently swaps the contents of two objects.

◆ writeToStream()

void mrpt::obs::CSensoryFrame::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protected

Member Data Documentation

◆ _init_CSensoryFrame

mrpt::utils::CLASSINIT mrpt::obs::CSensoryFrame::_init_CSensoryFrame
staticprotected

Definition at line 55 of file obs/CSensoryFrame.h.

◆ classCSensoryFrame

mrpt::utils::TRuntimeClassId mrpt::obs::CSensoryFrame::classCSensoryFrame
static

Definition at line 55 of file obs/CSensoryFrame.h.

◆ classinfo

const mrpt::utils::TRuntimeClassId* mrpt::obs::CSensoryFrame::classinfo
static

Definition at line 55 of file obs/CSensoryFrame.h.

◆ m_cachedMap

mrpt::maps::CMetricMapPtr mrpt::obs::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 72 of file obs/CSensoryFrame.h.

◆ m_observations

std::deque<CObservationPtr> mrpt::obs::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 312 of file obs/CSensoryFrame.h.




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 08:20:48 UTC 2023