10#define CSENSORYFRAME_H
85 template <
class POINTSMAP>
87 return static_cast<POINTSMAP*
>(m_cachedMap.pointer());
98 template <
class POINTSMAP>
100 internal_buildAuxPointsMap(options);
101 return static_cast<POINTSMAP*
>(m_cachedMap.pointer());
143 return insertObservationsInto(theMap.pointer(), robotPose);
177 template <
typename T>
181 size_t foundCount = 0;
184 if ( (*it)->GetRuntimeClass()->derivedFrom( class_ID ) )
185 if (foundCount++ == ith)
186 return typename T::SmartPtr(*it);
187 return typename T::SmartPtr();
253 inline size_t size()
const {
return m_observations.size(); }
256 inline bool empty()
const {
return m_observations.empty(); }
280 template <
typename T>
283 return static_cast<T
>(getObservationByIndex(idx));
298 template <
typename T>
301 return T(getObservationBySensorLabel(label,idx));
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Declares a virtual base class for all metric maps storage classes.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
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...
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...
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 internal_buildAuxPointsMap(const void *options=NULL) const
Internal method, used from buildAuxPointsMap()
const_iterator end() const
Returns a iterator to the end of the list of observations: this is an example of usage:
const POINTSMAP * buildAuxPointsMap(const void *options=NULL) const
Returns a cached points map representing this laser scan, building it upon the first call.
std::deque< CObservationPtr >::iterator iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
bool empty() const
Returns true if there are no observations in the list.
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).
CSensoryFrame()
Default constructor.
CObservationPtr getObservationByIndex(const size_t &idx) const
Returns the i'th observation in the list (0=first).
const_iterator begin() const
Returns a iterator to the first observation: this is an example of usage:
iterator erase(const iterator &it)
Removes the given observation in the list, and return an iterator to the next element (or this->end()...
void eraseByLabel(const std::string &label)
Removes all the observations that match a given sensorLabel.
std::deque< CObservationPtr > m_observations
The set of observations taken at the same time instant.
T getObservationByIndexAs(const size_t &idx) const
Returns the i'th observation in the list (0=first), and as a different smart pointer type:
void moveFrom(CSensoryFrame &sf)
Copies all the observation from another object, then erase them from the origin object (this method i...
void clear()
Clear all current observations.
iterator end()
Returns a iterator to the end of the list of observations: this is an example of usage:
std::deque< CObservationPtr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
const POINTSMAP * getAuxPointsMap() const
Returns the cached points map representation of the scan, if already build with buildAuxPointsMap(),...
size_t size() const
Returns the number of observations in the list.
void swap(CSensoryFrame &sf)
Efficiently swaps the contents of two objects.
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 p...
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 s...
virtual ~CSensoryFrame()
Destructor.
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).
void eraseByIndex(const size_t &idx)
Removes the i'th observation in the list (0=first).
iterator begin()
Returns a iterator to the first observation: this is an example of usage:
CSensoryFrame(const CSensoryFrame &)
Copy constructor.
mrpt::maps::CMetricMapPtr m_cachedMap
A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap().
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The virtual base class which provides a unified interface for all persistent objects in MRPT.
const Scalar * const_iterator
EIGEN_STRONG_INLINE iterator begin()
EIGEN_STRONG_INLINE iterator end()
std::vector< T1 > & operator+=(std::vector< T1 > &a, const std::vector< T2 > &b)
a+=b (element-wise sum)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A structure that holds runtime class type information.