Main MRPT website > C++ reference
MRPT logo

mrpt::slam::CSensoryFrame Class Reference

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. More...

#include <mrpt/slam/CSensoryFrame.h>

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

List of all members.

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::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).
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).
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.
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 Attributes

std::deque< CObservationPtr > m_observations
 The set of observations taken at the same time instant.

Static Private Attributes

static mrpt::utils::CLASSINIT _init_CSensorialFrame
static mrpt::utils::TRuntimeClassId classCSensorialFrame

Cached points map



mrpt::slam::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().

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->(...)

                          CSensoryFrame  sf;
                          sf.insert(o);

The following methods are equivalent for adding new observations to a "sensory frame": CSensoryFrame::operator += CSensoryFrame::push_back CSensoryFrame::insert

To examine the objects within a sensory frame, the following methods exist: CSensoryFrame::getObservationByClass : Looks for some specific observation class. CSensoryFrame::begin : To iterate over all observations. CSensoryFrame::getObservationByIndex : To query by index.

Notice that observations objects are automatically deleted on Sensorial Frame destruction or clear.

See also:
CObservation

Definition at line 72 of file CSensoryFrame.h.


Member Typedef Documentation

typedef std::deque<CObservationPtr>::const_iterator mrpt::slam::CSensoryFrame::const_iterator

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

Definition at line 223 of file CSensoryFrame.h.

typedef std::deque<CObservationPtr>::iterator mrpt::slam::CSensoryFrame::iterator

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

Definition at line 219 of file CSensoryFrame.h.


Constructor & Destructor Documentation

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

Default constructor.

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

Copy constructor.

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

Destructor.


Member Function Documentation

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

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

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

Definition at line 262 of file CSensoryFrame.h.

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

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

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

Definition at line 236 of file CSensoryFrame.h.

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:
options Can 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 125 of file CSensoryFrame.h.

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

Clear all current observations.

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

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

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

Definition at line 275 of file CSensoryFrame.h.

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

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

Definition at line 249 of file CSensoryFrame.h.

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).

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

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

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

Removes all the observations that match a given sensorLabel.

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 112 of file CSensoryFrame.h.

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 204 of file CSensoryFrame.h.

References MRPT_END, and MRPT_START.

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

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

See also:
begin, size
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 306 of file CSensoryFrame.h.

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
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 324 of file CSensoryFrame.h.

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.

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:
theMap The map where this observation is to be inserted: the map will be updated.
robotPose The 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 167 of file CSensoryFrame.h.

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:
theMap The map where this observation is to be inserted: the map will be updated.
robotPose The 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
void mrpt::slam::CSensoryFrame::internal_buildAuxPointsMap ( const void *  options = NULL  )  const [protected]

Internal method, used from buildAuxPointsMap().

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 +=
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
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
CSensoryFrame& mrpt::slam::CSensoryFrame::operator= ( const CSensoryFrame o  ) 

Copy.

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.

size_t mrpt::slam::CSensoryFrame::size (  )  const

Returns the number of observations in the list.

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

Efficiently swaps the contents of two objects.


Member Data Documentation

Definition at line 79 of file CSensoryFrame.h.

Definition at line 80 of file CSensoryFrame.h.

mrpt::slam::CMetricMapPtr mrpt::slam::CSensoryFrame::m_cachedMap [mutable, protected]

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 98 of file CSensoryFrame.h.

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 337 of file CSensoryFrame.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010