9 #ifndef CMultiMetricMap_H 10 #define CMultiMetricMap_H 34 class TSetOfMetricMapInitializers;
196 template <
typename T>
199 size_t foundCount = 0;
201 &T::GetRuntimeClassIdStatic();
203 if ((*it)->GetRuntimeClass()->derivedFrom(class_ID))
204 if (foundCount++ == ith)
205 return std::dynamic_pointer_cast<T>(it->get_ptr());
206 return typename T::Ptr();
215 template <
class SELECTED_CLASS_PTR,
class CONTAINER>
218 using ptr_t =
typename SELECTED_CLASS_PTR::element_type*;
219 using const_ptr_t =
const typename SELECTED_CLASS_PTR::element_type*;
248 if (dynamic_cast<const_ptr_t>(it->get())) cnt++;
256 if (dynamic_cast<const_ptr_t>(it->get()))
259 return std::dynamic_pointer_cast<
260 typename SELECTED_CLASS_PTR::element_type>(
263 throw std::out_of_range(
"Index is out of range");
265 template <
typename ELEMENT>
278 template <
class SELECTED_CLASS_PTR,
class CONTAINER>
281 using pointee_t =
typename SELECTED_CLASS_PTR::element_type;
282 using ptr_t =
typename SELECTED_CLASS_PTR::element_type*;
283 using const_ptr_t =
const typename SELECTED_CLASS_PTR::element_type*;
307 operator const SELECTED_CLASS_PTR&()
const 312 explicit operator bool()
const 315 return m_ret ? true :
false;
328 throw std::runtime_error(
"Tried to derefer nullptr pointer");
336 throw std::runtime_error(
"Tried to derefer nullptr pointer");
347 if (dynamic_cast<const_ptr_t>(it->get()))
353 m_ret = SELECTED_CLASS_PTR();
359 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.
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.
typename shared_ptr< COctoMap > ::element_type * ptr_t
ProxyFilterContainerByClass(CONTAINER &source)
typename std::shared_ptr ::element_type * ptr_t
std::shared_ptr< CGasConcentrationGridMap2D > Ptr
ProxySelectorContainerByClass< mrpt::maps::CColouredPointsMap::Ptr, TListMaps > m_colourPointsMap
Proxy that looks like a smart pointer to the first matching object in maps.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
A structure that holds runtime class type information.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
virtual void determineMatching2D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose2D &otherMapPose, mrpt::tfest::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: ...
Takes a const ref of a STL non-associative container of smart pointers at construction and exposes an...
ProxySelectorContainerByClass< mrpt::maps::CWeightedPointsMap::Ptr, TListMaps > m_weightedPointsMap
Proxy that looks like a smart pointer to the first matching object in maps.
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
ProxySelectorContainerByClass< mrpt::maps::CBeaconMap::Ptr, TListMaps > m_beaconMap
Proxy that looks like a smart pointer to the first matching object in maps.
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...
void internal_clear() override
Clear all elements of the map.
const typename std::shared_ptr ::element_type * const_ptr_t
typename std::shared_ptr ::element_type pointee_t
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()
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)
ProxyFilterContainerByClass< mrpt::maps::CWirelessPowerGridMap2D::Ptr, TListMaps > m_wifiGridMaps
STL-like proxy to access this kind of maps in maps.
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 > &&)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
std::shared_ptr< CWirelessPowerGridMap2D > Ptr
ProxySelectorContainerByClass(ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &&)
ProxyFilterContainerByClass< mrpt::maps::CGasConcentrationGridMap2D::Ptr, TListMaps > m_gasGridMaps
STL-like proxy to access this kind of maps in maps.
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...
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...
ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > & operator=(const ProxySelectorContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &o)
TListMaps::const_iterator const_iterator
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.
ProxyFilterContainerByClass< mrpt::maps::CHeightGridMap2D_MRF::Ptr, TListMaps > m_heightMRFMaps
STL-like proxy to access this kind of maps in maps.
A proxy like ProxyFilterContainerByClass, but it directly appears as if it was a single smart pointer...
ProxyFilterContainerByClass(ProxyFilterContainerByClass< SELECTED_CLASS_PTR, CONTAINER > &)
const_iterator end() const
std::deque< mrpt::containers::deepcopy_poly_ptr< mrpt::maps::CMetricMap::Ptr > > TListMaps
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.
Parameters for the determination of matchings between point clouds, etc.
pointee_t & operator*() const
std::shared_ptr< CReflectivityGridMap2D > Ptr
GLenum const GLfloat * params
SELECTED_CLASS_PTR operator[](size_t index) const
const Scalar * const_iterator
std::shared_ptr< CHeightGridMap2D_MRF > Ptr
ProxyFilterContainerByClass< mrpt::maps::CReflectivityGridMap2D::Ptr, TListMaps > m_reflectivityMaps
STL-like proxy to access this kind of maps in maps.
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
TListMaps::iterator iterator
const typename shared_ptr< COctoMap > ::element_type * const_ptr_t