MRPT
2.0.1
|
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 51 of file CSensoryFrame.h.
#include <mrpt/obs/CSensoryFrame.h>
Public Types | |
using | iterator = std::deque< CObservation::Ptr >::iterator |
You can use CSensoryFrame::begin to get a iterator to the first element. More... | |
using | const_iterator = std::deque< CObservation::Ptr >::const_iterator |
You can use CSensoryFrame::begin to get a iterator to the first element. More... | |
Public Member Functions | |
CSensoryFrame ()=default | |
Default constructor. More... | |
CSensoryFrame (const CSensoryFrame &) | |
Copy constructor. More... | |
CSensoryFrame & | operator= (const CSensoryFrame &o) |
Copy. More... | |
void | clear () |
Clear all current observations. More... | |
bool | insertObservationsInto (mrpt::maps::CMetricMap *theMap, const mrpt::poses::CPose3D *robotPose=nullptr) const |
Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::CMetricMap). More... | |
bool | insertObservationsInto (mrpt::maps::CMetricMap::Ptr &theMap, const mrpt::poses::CPose3D *robotPose=nullptr) 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 CObservation::Ptr &obs) |
You can use "sf+=obs;" to add the observation "obs" to the "sf1". More... | |
void | push_back (const CObservation::Ptr &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 CObservation::Ptr &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 (size_t ith=0) const |
Returns the i'th observation of a given class (or of a descendant class), or nullptr 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 (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... | |
const CObservation::Ptr & | getObservationByIndex (size_t idx) const |
Returns the i'th observation in the list (0=first). More... | |
CObservation::Ptr & | getObservationByIndex (size_t idx) |
template<typename T > | |
T | getObservationByIndexAs (size_t idx) const |
Returns the i'th observation in the list (0=first), and as a different smart pointer type: More... | |
CObservation::Ptr | getObservationBySensorLabel (const std::string &label, 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, 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... | |
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< CObservation::Ptr > | m_observations |
The set of observations taken at the same time instant. More... | |
RTTI stuff | |
using | Ptr = std::shared_ptr< mrpt::obs ::CSensoryFrame > |
using | ConstPtr = std::shared_ptr< const mrpt::obs ::CSensoryFrame > |
using | UniquePtr = std::unique_ptr< mrpt::obs ::CSensoryFrame > |
using | ConstUniquePtr = std::unique_ptr< const mrpt::obs ::CSensoryFrame > |
static const mrpt::rtti::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "mrpt::obs" "::" "CSensoryFrame" |
static const mrpt::rtti::TRuntimeClassId * | _GetBaseClass () |
static constexpr auto | getClassName () |
static const mrpt::rtti::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static std::shared_ptr< CObject > | CreateObject () |
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::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::rtti::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
Cached points map | |
mrpt::maps::CMetricMap::Ptr | 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 nullptr otherwise. More... | |
template<class POINTSMAP > | |
const POINTSMAP * | buildAuxPointsMap (const void *options=nullptr) const |
Returns a cached points map representing this laser scan, building it upon the first call. More... | |
void | internal_buildAuxPointsMap (const void *options=nullptr) const |
Internal method, used from buildAuxPointsMap() More... | |
using mrpt::obs::CSensoryFrame::const_iterator = std::deque<CObservation::Ptr>::const_iterator |
You can use CSensoryFrame::begin to get a iterator to the first element.
Definition at line 221 of file CSensoryFrame.h.
using mrpt::obs::CSensoryFrame::ConstPtr = std::shared_ptr<const mrpt::obs :: CSensoryFrame > |
Definition at line 53 of file CSensoryFrame.h.
using mrpt::obs::CSensoryFrame::ConstUniquePtr = std::unique_ptr<const mrpt::obs :: CSensoryFrame > |
Definition at line 53 of file CSensoryFrame.h.
using mrpt::obs::CSensoryFrame::iterator = std::deque<CObservation::Ptr>::iterator |
You can use CSensoryFrame::begin to get a iterator to the first element.
Definition at line 217 of file CSensoryFrame.h.
using mrpt::obs::CSensoryFrame::Ptr = std::shared_ptr< mrpt::obs :: CSensoryFrame > |
A type for the associated smart pointer
Definition at line 53 of file CSensoryFrame.h.
using mrpt::obs::CSensoryFrame::UniquePtr = std::unique_ptr< mrpt::obs :: CSensoryFrame > |
Definition at line 53 of file CSensoryFrame.h.
|
default |
Default constructor.
CSensoryFrame::CSensoryFrame | ( | const CSensoryFrame & | o | ) |
Copy constructor.
Definition at line 26 of file CSensoryFrame.cpp.
|
staticprotected |
|
inline |
Returns a constant iterator to the first observation: this is an example of usage:
Definition at line 235 of file CSensoryFrame.h.
References m_observations.
Referenced by mrpt::maps::CMetricMap::canComputeObservationsLikelihood().
|
inline |
Returns a iterator to the first observation: this is an example of usage:
Definition at line 261 of file CSensoryFrame.h.
References m_observations.
|
inline |
Returns a cached points map representing this laser scan, building it upon the first call.
options | Can be nullptr 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 nullptr); |
Definition at line 106 of file CSensoryFrame.h.
References internal_buildAuxPointsMap(), and m_cachedMap.
void CSensoryFrame::clear | ( | ) |
Clear all current observations.
Definition at line 42 of file CSensoryFrame.cpp.
Referenced by mrpt::apps::RawlogGrabberApp::process_observations_for_sf().
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::rtti::CObject.
|
inlinestatic |
Definition at line 53 of file CSensoryFrame.h.
|
inlinestatic |
Definition at line 53 of file CSensoryFrame.h.
|
static |
|
inlinestatic |
Definition at line 53 of file CSensoryFrame.h.
|
inlineinherited |
Makes a deep copy of the object and returns a smart pointer to it.
Definition at line 204 of file CObject.h.
References mrpt::rtti::CObject::clone().
Referenced by mrpt::obs::CRawlog::insert().
|
inline |
Returns true if there are no observations in the list.
Definition at line 278 of file CSensoryFrame.h.
References m_observations.
|
inline |
Returns a constant iterator to the end of the list of observations: this is an example of usage:
Definition at line 248 of file CSensoryFrame.h.
References m_observations.
Referenced by mrpt::maps::CMetricMap::canComputeObservationsLikelihood().
|
inline |
Returns a iterator to the end of the list of observations: this is an example of usage:
Definition at line 274 of file CSensoryFrame.h.
References m_observations.
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 184 of file CSensoryFrame.cpp.
References ASSERT_, mrpt::containers::end(), MRPT_END, and MRPT_START.
void CSensoryFrame::eraseByIndex | ( | size_t | idx | ) |
Removes the i'th observation in the list (0=first).
Definition at line 147 of file CSensoryFrame.cpp.
References ASSERT_, mrpt::containers::begin(), MRPT_END, MRPT_START, mrpt::math::size(), and THROW_EXCEPTION_FMT.
void CSensoryFrame::eraseByLabel | ( | const std::string & | label | ) |
Removes all the observations that match a given sensorLabel.
Definition at line 224 of file CSensoryFrame.cpp.
References mrpt::system::os::_strcmpi(), mrpt::containers::begin(), and mrpt::containers::end().
|
inline |
Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(), or nullptr otherwise.
Usage:
Definition at line 88 of file CSensoryFrame.h.
References m_cachedMap.
|
inlinestatic |
Definition at line 53 of file CSensoryFrame.h.
|
inline |
Returns the i'th observation of a given class (or of a descendant class), or nullptr if there is no such observation in the array.
Example:
By default (ith=0), the first observation is returned.
Definition at line 201 of file CSensoryFrame.h.
References MRPT_END, and MRPT_START.
Referenced by mrpt::apps::RawlogGrabberApp::dump_verbose_info(), and TEST().
const CObservation::Ptr & CSensoryFrame::getObservationByIndex | ( | size_t | idx | ) | const |
Returns the i'th observation in the list (0=first).
Definition at line 164 of file CSensoryFrame.cpp.
References ASSERT_BELOW_, mrpt::containers::begin(), MRPT_END, MRPT_START, and mrpt::math::size().
Referenced by getObservationByIndexAs(), and mrpt::apps::RawlogGrabberApp::process_observations_for_sf().
CObservation::Ptr & CSensoryFrame::getObservationByIndex | ( | size_t | idx | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 172 of file CSensoryFrame.cpp.
References ASSERT_BELOW_, mrpt::containers::begin(), MRPT_END, MRPT_START, and mrpt::math::size().
|
inline |
Returns the i'th observation in the list (0=first), and as a different smart pointer type:
Definition at line 306 of file CSensoryFrame.h.
References getObservationByIndex().
CObservation::Ptr CSensoryFrame::getObservationBySensorLabel | ( | const std::string & | label, |
size_t | idx = 0 |
||
) | const |
Returns the i'th observation in the list with the given "sensorLabel" (0=first).
Definition at line 197 of file CSensoryFrame.cpp.
References mrpt::system::os::_strcmpi(), MRPT_END, and MRPT_START.
Referenced by getObservationBySensorLabelAs().
|
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 328 of file CSensoryFrame.h.
References getObservationBySensorLabel().
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::serialization::CSerializable.
|
static |
void CSensoryFrame::insert | ( | const CObservation::Ptr & | 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 138 of file CSensoryFrame.cpp.
Referenced by mrpt::hmtslam::CHMTSLAM::LSLAM_process_message_from_AA(), mrpt::apps::RawlogGrabberApp::process_observations_for_sf(), and mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::updateMapPartitions().
bool CSensoryFrame::insertObservationsInto | ( | mrpt::maps::CMetricMap * | theMap, |
const mrpt::poses::CPose3D * | robotPose = nullptr |
||
) | 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 nullptr (default) to use (0,0,0deg) |
Definition at line 266 of file CSensoryFrame.cpp.
Referenced by mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), mrpt::maps::CMultiMetricMapPDF::insertObservation(), insertObservationsInto(), 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 nullptr (default) to use (0,0,0deg) |
Definition at line 161 of file CSensoryFrame.h.
References insertObservationsInto().
|
protected |
Internal method, used from buildAuxPointsMap()
Definition at line 252 of file CSensoryFrame.cpp.
References IS_CLASS, and mrpt::obs::ptr_internal_build_points_map_from_scan2D.
Referenced by buildAuxPointsMap().
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.
void CSensoryFrame::operator+= | ( | const CObservation::Ptr & | 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 120 of file CSensoryFrame.cpp.
CSensoryFrame & CSensoryFrame::operator= | ( | const CSensoryFrame & | o | ) |
Copy.
Definition at line 31 of file CSensoryFrame.cpp.
References mrpt::containers::clear(), m_observations, MRPT_END, and MRPT_START.
void CSensoryFrame::push_back | ( | const CObservation::Ptr & | 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 129 of file CSensoryFrame.cpp.
|
overrideprotectedvirtual |
Pure virtual method for reading (deserializing) from an abstract archive.
Users don't call this method directly. Instead, use stream >> object;
.
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 I/O error |
Implements mrpt::serialization::CSerializable.
Definition at line 59 of file CSensoryFrame.cpp.
References mrpt::containers::clear(), INVALID_TIMESTAMP, MRPT_END, MRPT_START, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and mrpt::serialization::CArchive::ReadBufferFixEndianness().
|
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.
|
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 48 of file CSensoryFrame.cpp.
|
overrideprotectedvirtual |
Pure virtual method for writing (serializing) to an abstract archive.
Users don't call this method directly. Instead, use stream << object;
.
std::exception | On any I/O error |
Implements mrpt::serialization::CSerializable.
Definition at line 49 of file CSensoryFrame.cpp.
|
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.
|
inline |
Returns the number of observations in the list.
Definition at line 276 of file CSensoryFrame.h.
References m_observations.
Referenced by mrpt::apps::RawlogGrabberApp::process_observations_for_sf().
void CSensoryFrame::swap | ( | CSensoryFrame & | sf | ) |
Efficiently swaps the contents of two objects.
Definition at line 215 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 nullptr is class does not support conversion to MATLAB. Definition at line 90 of file CSerializable.h.
|
static |
Definition at line 53 of file 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 CSensoryFrame.h.
Referenced by buildAuxPointsMap(), getAuxPointsMap(), 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 343 of file CSensoryFrame.h.
Referenced by begin(), empty(), end(), operator=(), size(), and swap().
|
staticprotected |
Definition at line 53 of file CSensoryFrame.h.
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |