9 #ifndef CMultiMetricMap_H 10 #define CMultiMetricMap_H 36 class TSetOfMetricMapInitializers;
170 typedef std::deque<mrpt::utils::poly_ptr_ptr<mrpt::maps::CMetricMap::Ptr>>
198 template <
typename T>
201 size_t foundCount = 0;
204 if ((*it)->GetRuntimeClass()->derivedFrom(class_ID))
205 if (foundCount++ == ith)
206 return std::dynamic_pointer_cast<T>(it->get_ptr());
207 return typename T::Ptr();
216 template <
class SELECTED_CLASS_PTR,
class CONTAINER>
219 typedef typename SELECTED_CLASS_PTR::element_type*
ptr_t;
220 typedef const typename SELECTED_CLASS_PTR::element_type*
const_ptr_t;
249 if (dynamic_cast<const_ptr_t>(it->get())) cnt++;
257 if (dynamic_cast<const_ptr_t>(it->get()))
260 return std::dynamic_pointer_cast<
261 typename SELECTED_CLASS_PTR::element_type>(
264 throw std::out_of_range(
"Index is out of range");
266 template <
typename ELEMENT>
279 template <
class SELECTED_CLASS_PTR,
class CONTAINER>
282 typedef typename SELECTED_CLASS_PTR::element_type
pointee_t;
283 typedef typename SELECTED_CLASS_PTR::element_type*
ptr_t;
284 typedef const typename SELECTED_CLASS_PTR::element_type*
const_ptr_t;
308 operator const SELECTED_CLASS_PTR&()
const 313 explicit operator bool()
const 316 return m_ret ? true :
false;
329 throw std::runtime_error(
"Tried to derefer nullptr pointer");
337 throw std::runtime_error(
"Tried to derefer nullptr pointer");
348 if (dynamic_cast<const_ptr_t>(it->get()))
354 m_ret = SELECTED_CLASS_PTR();
360 ProxyFilterContainerByClass<mrpt::maps::CSimplePointsMap::Ptr, TListMaps>
void auxParticleFilterCleanUp() override
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::...
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
TListMaps::const_iterator const_iterator
Parameters for CMetricMap::compute3DMatchingRatio()
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers &initializers)
void deleteAllMaps()
Deletes all maps and clears the internal lists of maps (with clear_unique(), so user copies remain al...
ProxyFilterContainerByClass< mrpt::maps::COctoMap::Ptr, TListMaps > m_octoMaps
STL-like proxy to access this kind of maps in maps.
T::Ptr getMapByClass(const 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 s...
ProxyFilterContainerByClass< mrpt::maps::CSimplePointsMap::Ptr, TListMaps > m_pointsMaps
STL-like proxy to access this kind of maps in maps.
ProxyFilterContainerByClass(CONTAINER &source)
std::shared_ptr< CGasConcentrationGridMap2D > Ptr
ProxyFilterContainerByClass< mrpt::maps::CGasConcentrationGridMap2D::Ptr, TListMaps > m_gasGridMaps
STL-like proxy to access this kind of maps in maps.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
const Scalar * const_iterator
Takes a const ref of a STL non-associative container of smart pointers at construction and exposes an...
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
ProxyFilterContainerByClass< mrpt::maps::CWirelessPowerGridMap2D::Ptr, TListMaps > m_wifiGridMaps
STL-like proxy to access this kind of maps in maps.
ProxySelectorContainerByClass< mrpt::maps::CBeaconMap::Ptr, TListMaps > m_beaconMap
Proxy that looks like a smart pointer to the first matching object in maps.
const SELECTED_CLASS_PTR::element_type * const_ptr_t
bool isEmpty() const override
Returns true if all maps returns true to their isEmpty() method, which is map-dependent.
void internal_update_ref() const
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const override
See the definition in the base class: Calls in this class become a call to every single map in this s...
const SELECTED_CLASS_PTR::element_type * const_ptr_t
std::shared_ptr< CMetricMap > Ptr
void internal_clear() override
Clear all elements of the map.
CMultiMetricMap & operator=(const CMultiMetricMap &o)
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
std::shared_ptr< CSetOfObjects > Ptr
CMultiMetricMap(const mrpt::maps::TSetOfMetricMapInitializers *initializers=nullptr)
Constructor.
ProxySelectorContainerByClass< mrpt::maps::CLandmarksMap::Ptr, TListMaps > m_landmarksMap
Proxy that looks like a smart pointer to the first matching object in maps.
ProxyFilterContainerByClass< mrpt::maps::COccupancyGridMap2D::Ptr, TListMaps > m_gridMaps
STL-like proxy to access this kind of maps in maps.
ProxyFilterContainerByClass< mrpt::maps::CColouredOctoMap::Ptr, TListMaps > m_colourOctoMaps
STL-like proxy to access this kind of maps in maps.
ProxySelectorContainerByClass(CONTAINER &source)
ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > & operator=(ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &&o)
ProxySelectorContainerByClass(ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &)
std::shared_ptr< CColouredPointsMap > Ptr
bool internal_canComputeObservationLikelihood(const mrpt::obs::CObservation *obs) const override
Returns true if any of the inner maps is able to compute a sensible likelihood function for this obse...
GLsizei const GLchar ** string
void push_back(const ELEMENT &element)
mrpt::maps::CMetricMap::Ptr getMapByIndex(size_t idx) const
Gets the i-th map.
ProxyFilterContainerByClass(ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &&)
ProxySelectorContainerByClass< mrpt::maps::CWeightedPointsMap::Ptr, TListMaps > m_weightedPointsMap
Proxy that looks like a smart pointer to the first matching object in maps.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
SELECTED_CLASS_PTR::element_type pointee_t
SELECTED_CLASS_PTR::element_type * ptr_t
std::shared_ptr< CWirelessPowerGridMap2D > Ptr
ProxySelectorContainerByClass(ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &&)
Declares a virtual base class for all metric maps storage classes.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
virtual const mrpt::maps::CSimplePointsMap * getAsSimplePointsMap() const override
If the map is a simple point map or it's a multi-metric map that contains EXACTLY one simple point ma...
SELECTED_CLASS_PTR::element_type * ptr_t
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers *initializers)
Sets the list of internal map according to the passed list of map initializers (Current maps' content...
ProxyFilterContainerByClass< mrpt::maps::CReflectivityGridMap2D::Ptr, TListMaps > m_reflectivityMaps
STL-like proxy to access this kind of maps in maps.
ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > & operator=(const ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &o)
ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > & operator=(ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &&o)
GLsizei GLsizei GLchar * source
ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > & operator=(const ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &o)
unsigned int m_ID
An auxiliary variable that can be used freely by the users (this will be copied to other maps using t...
std::shared_ptr< CWeightedPointsMap > Ptr
TListMaps maps
The list of MRPT metric maps in this object.
A proxy like ProxyFilterContainerByClass, but it directly appears as if it was a single smart pointer...
ProxyFilterContainerByClass(ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &)
A structure that holds runtime class type information.
const_iterator end() const
ProxyFilterContainerByClass< mrpt::maps::CHeightGridMap2D::Ptr, TListMaps > m_heightMaps
STL-like proxy to access this kind of maps in maps.
This class stores any customizable set of metric maps.
ProxyFilterContainerByClass< mrpt::maps::CHeightGridMap2D_MRF::Ptr, TListMaps > m_heightMRFMaps
STL-like proxy to access this kind of maps in maps.
Parameters for the determination of matchings between point clouds, etc.
virtual void determineMatching2D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose2D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const mrpt::maps::TMatchingParams ¶ms, mrpt::maps::TMatchingExtraResults &extraResults) const override
Computes the matching between this and another 2D point map, which includes finding: ...
pointee_t & operator*() const
std::shared_ptr< CReflectivityGridMap2D > Ptr
GLenum const GLfloat * params
SELECTED_CLASS_PTR operator[](size_t index) const
std::deque< mrpt::utils::poly_ptr_ptr< mrpt::maps::CMetricMap::Ptr > > TListMaps
std::shared_ptr< CHeightGridMap2D_MRF > Ptr
ProxySelectorContainerByClass< mrpt::maps::CColouredPointsMap::Ptr, TListMaps > m_colourPointsMap
Proxy that looks like a smart pointer to the first matching object in maps.
TListMaps::iterator iterator
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
The implementation in this class just calls all the corresponding method of the contained metric maps...
const_iterator begin() const