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:
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.
Definition at line 52 of file obs/CSensoryFrame.h.
#include <mrpt/obs/CSensoryFrame.h>
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 | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) throw () |
void | operator delete[] (void *ptr) throw () |
void | operator delete (void *memory, void *ptr) throw () |
void * | operator new (size_t size, const std::nothrow_t &) throw () |
void | operator delete (void *ptr, const std::nothrow_t &) throw () |
CSensoryFrame () | |
Default constructor. More... | |
CSensoryFrame (const CSensoryFrame &) | |
Copy constructor. More... | |
CSensoryFrame & | operator= (const CSensoryFrame &o) |
Copy. More... | |
virtual | ~CSensoryFrame () |
Destructor. More... | |
void | clear () |
Clear all current observations. More... | |
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). More... | |
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). 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::Ptr | 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 constant iterator to the first observation: this is an example of usage: More... | |
const_iterator | end () const |
Returns a constant 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 > | |
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 > | |
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... | |
virtual mxArray * | writeToMatlab () 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... | |
CObject * | clone () const |
Cloning interface for smart pointers. More... | |
RTTI classes and functions | |
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... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
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< CObservationPtr > | m_observations |
The set of observations taken at the same time instant. More... | |
RTTI stuff | |
typedef CSensoryFramePtr | Ptr |
typedef CSensoryFramePtr | ConstPtr |
static mrpt::utils::CLASSINIT | _init_CSensoryFrame |
static mrpt::utils::TRuntimeClassId | classCSensoryFrame |
static const mrpt::utils::TRuntimeClassId * | classinfo |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | duplicate () const |
Returns a copy of the object, indepently of its class. More... | |
static mrpt::utils::CObject * | CreateObject () |
static CSensoryFramePtr | Create () |
Cached points map | |
mrpt::maps::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... | |
typedef std::deque<CObservationPtr>::const_iterator mrpt::obs::CSensoryFrame::const_iterator |
You can use CSensoryFrame::begin to get a iterator to the first element.
Definition at line 197 of file obs/CSensoryFrame.h.
typedef CSensoryFramePtr mrpt::obs::CSensoryFrame::ConstPtr |
Definition at line 55 of file obs/CSensoryFrame.h.
typedef std::deque<CObservationPtr>::iterator mrpt::obs::CSensoryFrame::iterator |
You can use CSensoryFrame::begin to get a iterator to the first element.
Definition at line 193 of file obs/CSensoryFrame.h.
typedef CSensoryFramePtr mrpt::obs::CSensoryFrame::Ptr |
A typedef for the associated smart pointer
Definition at line 55 of file obs/CSensoryFrame.h.
CSensoryFrame::CSensoryFrame | ( | ) |
Default constructor.
Definition at line 32 of file CSensoryFrame.cpp.
CSensoryFrame::CSensoryFrame | ( | const CSensoryFrame & | o | ) |
Copy constructor.
Definition at line 41 of file CSensoryFrame.cpp.
|
virtual |
|
staticprotected |
|
inline |
Returns a constant iterator to the first observation: this is an example of usage:
Definition at line 210 of file obs/CSensoryFrame.h.
Referenced by mrpt::maps::CMetricMap::canComputeObservationsLikelihood(), mrpt::maps::CMetricMap::computeObservationsLikelihood(), eraseByIndex(), eraseByLabel(), getObservationByIndex(), getObservationBySensorLabel(), insertObservationsInto(), internal_buildAuxPointsMap(), mrpt::slam::observationsOverlap(), operator+=(), mrpt::slam::CMonteCarloLocalization3D::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::slam::CMonteCarloLocalization2D::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::maps::CMultiMetricMapPDF::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::maps::CMultiMetricMapPDF::prediction_and_update_pfOptimalProposal(), mrpt::slam::CMetricMapBuilderICP::processActionObservation(), and mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().
|
inline |
Returns a iterator to the first observation: this is an example of usage:
Definition at line 236 of file obs/CSensoryFrame.h.
|
inline |
Returns a cached points map representing this laser scan, building it upon the first call.
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::maps::CPointsMap *map = sf->buildAuxPointsMap<mrpt::maps::CPointsMap>(&options or NULL); |
Definition at line 99 of file obs/CSensoryFrame.h.
void CSensoryFrame::clear | ( | ) |
Clear all current observations.
Definition at line 80 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
Referenced by operator=(), readFromStream(), and ~CSensoryFrame().
|
inlineinherited |
|
static |
|
static |
|
virtual |
Returns a copy of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
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 162 of file CObject.h.
References mrpt::utils::CObjectPtr.
Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().
|
inline |
Returns true if there are no observations in the list.
Definition at line 256 of file obs/CSensoryFrame.h.
|
inline |
Returns a constant iterator to the end of the list of observations: this is an example of usage:
Definition at line 223 of file obs/CSensoryFrame.h.
Referenced by mrpt::maps::CMetricMap::canComputeObservationsLikelihood(), mrpt::maps::CMetricMap::computeObservationsLikelihood(), erase(), eraseByLabel(), getObservationBySensorLabel(), insertObservationsInto(), internal_buildAuxPointsMap(), mrpt::slam::observationsOverlap(), operator+=(), mrpt::slam::CMonteCarloLocalization3D::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::slam::CMonteCarloLocalization2D::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::maps::CMultiMetricMapPDF::PF_SLAM_computeObservationLikelihoodForParticle(), mrpt::maps::CMultiMetricMapPDF::prediction_and_update_pfOptimalProposal(), mrpt::slam::CMetricMapBuilderICP::processActionObservation(), and mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().
|
inline |
Returns a iterator to the end of the list of observations: this is an example of usage:
Definition at line 249 of file obs/CSensoryFrame.h.
CSensoryFrame::iterator 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).
Definition at line 226 of file CSensoryFrame.cpp.
References ASSERT_, end(), m_cachedMap, m_observations, MRPT_END, and MRPT_START.
Referenced by eraseByLabel().
void CSensoryFrame::eraseByIndex | ( | const size_t & | idx | ) |
Removes the i'th observation in the list (0=first).
Definition at line 195 of file CSensoryFrame.cpp.
References ASSERT_, begin(), m_cachedMap, m_observations, MRPT_END, MRPT_START, size(), and THROW_EXCEPTION_FMT.
void CSensoryFrame::eraseByLabel | ( | const std::string & | label | ) |
Removes all the observations that match a given sensorLabel.
Definition at line 279 of file CSensoryFrame.cpp.
References mrpt::system::os::_strcmpi(), begin(), end(), erase(), and m_cachedMap.
|
inline |
Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(), or NULL otherwise.
Usage:
Definition at line 86 of file obs/CSensoryFrame.h.
|
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:
By default (ith=0), the first observation is returned.
Definition at line 178 of file obs/CSensoryFrame.h.
References begin(), MRPT_END, and MRPT_START.
Referenced by mrpt::hmtslam::CTopLCDetector_FabMap::OnNewPose(), and TEST().
CObservationPtr CSensoryFrame::getObservationByIndex | ( | const size_t & | idx | ) | const |
Returns the i'th observation in the list (0=first).
Definition at line 212 of file CSensoryFrame.cpp.
References begin(), MRPT_END, MRPT_START, size(), and THROW_EXCEPTION_FMT.
|
inline |
Returns the i'th observation in the list (0=first), and as a different smart pointer type:
Definition at line 281 of file obs/CSensoryFrame.h.
CObservationPtr 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).
Definition at line 240 of file CSensoryFrame.cpp.
References mrpt::system::os::_strcmpi(), begin(), end(), MRPT_END, and MRPT_START.
|
inline |
Returns the i'th observation in the list with the given "sensorLabel" (0=first), and as a different smart pointer type:
Definition at line 299 of file obs/CSensoryFrame.h.
|
virtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
void 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.
Definition at line 186 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
Referenced by mrpt::hmtslam::CHMTSLAM::LSLAM_process_message_from_AA().
bool 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.
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) |
Definition at line 317 of file CSensoryFrame.cpp.
References begin(), and end().
Referenced by mrpt::maps::CMultiMetricMapPDF::insertObservation(), mrpt::hmtslam::CHMTSLAM::LSLAM_process_message_from_AA(), mrpt::maps::CMultiMetricMapPDF::prediction_and_update_pfOptimalProposal(), and mrpt::hmtslam::CLSLAM_RBPF_2DLASER::prediction_and_update_pfOptimalProposal().
|
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.
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) |
Definition at line 141 of file obs/CSensoryFrame.h.
Internal method, used from buildAuxPointsMap()
Definition at line 306 of file CSensoryFrame.cpp.
References begin(), end(), IS_CLASS, m_cachedMap, and mrpt::obs::ptr_internal_build_points_map_from_scan2D.
void 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.
Definition at line 260 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
Referenced by mrpt::hmtslam::CLocalMetricHypothesis::updateAreaFromLMH().
Definition at line 55 of file obs/CSensoryFrame.h.
Definition at line 55 of file obs/CSensoryFrame.h.
|
inline |
Definition at line 55 of file obs/CSensoryFrame.h.
Definition at line 55 of file obs/CSensoryFrame.h.
|
inline |
Definition at line 55 of file obs/CSensoryFrame.h.
Definition at line 55 of file obs/CSensoryFrame.h.
|
inline |
Definition at line 55 of file obs/CSensoryFrame.h.
|
inline |
Definition at line 55 of file obs/CSensoryFrame.h.
void 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.
Definition at line 153 of file CSensoryFrame.cpp.
References begin(), end(), m_cachedMap, m_observations, and MRPT_UNUSED_PARAM.
void 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.
Definition at line 168 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
CSensoryFrame & CSensoryFrame::operator= | ( | const CSensoryFrame & | o | ) |
Copy.
Definition at line 50 of file CSensoryFrame.cpp.
References clear(), m_cachedMap, m_observations, MRPT_END, and MRPT_START.
void 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.
Definition at line 177 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
|
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.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 107 of file CSensoryFrame.cpp.
References clear(), INVALID_TIMESTAMP, m_cachedMap, m_observations, MRPT_END, MRPT_START, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and version.
|
inline |
Returns the number of observations in the list.
Definition at line 253 of file obs/CSensoryFrame.h.
Referenced by eraseByIndex(), getObservationByIndex(), and mrpt::slam::CMetricMapBuilderRBPF::processActionObservation().
void CSensoryFrame::swap | ( | CSensoryFrame & | sf | ) |
Efficiently swaps the contents of two objects.
Definition at line 270 of file CSensoryFrame.cpp.
References m_cachedMap, and m_observations.
|
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.
mxArray
(caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB. Definition at line 79 of file CSerializable.h.
|
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.
out | The output binary stream where object must be dumped. |
getVersion | If 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. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 89 of file CSensoryFrame.cpp.
References m_observations, and version.
|
staticprotected |
Definition at line 55 of file obs/CSensoryFrame.h.
|
staticinherited |
|
static |
Definition at line 55 of file obs/CSensoryFrame.h.
|
staticinherited |
Definition at line 42 of file CSerializable.h.
|
static |
Definition at line 55 of file obs/CSensoryFrame.h.
|
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.
Referenced by clear(), erase(), eraseByIndex(), eraseByLabel(), insert(), internal_buildAuxPointsMap(), moveFrom(), operator+=(), operator=(), push_back(), readFromStream(), and swap().
|
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.
Referenced by clear(), erase(), eraseByIndex(), insert(), moveFrom(), operator+=(), operator=(), push_back(), readFromStream(), swap(), and writeToStream().
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |