46 template <
typename OP>
54 for_each(mmm.maps.begin(), mmm.maps.end(), op);
78 const CPose3D& _takenFrom,
double& _total_log_lik)
79 : obs(_obs), takenFrom(_takenFrom), total_log_lik(_total_log_lik)
84 template <
typename PTR>
87 total_log_lik += ptr->computeObservationLikelihood(obs, takenFrom);
99 : obs(_obs), can(_can)
104 template <
typename PTR>
107 can = can || ptr->canComputeObservationLikelihood(obs);
120 const CPose3D* _robot_pose,
int& _total_insert)
121 : obs(_obs), robot_pose(_robot_pose), total_insert(_total_insert)
126 template <
typename PTR>
129 bool ret = ptr->insertObservation(obs, robot_pose);
130 if (ret) total_insert++;
143 template <
typename PTR>
146 if (ptr) ptr->getAs3DObject(obj_gl);
153 template <
typename PTR>
156 if (ptr) ptr->auxParticleFilterCleanUp();
164 MapIsEmpty(
bool& _is_empty) : is_empty(_is_empty) { is_empty =
true; }
165 template <
typename PTR>
168 if (ptr) is_empty = is_empty && ptr->isEmpty();
175 #define ALL_PROXIES_INIT \
176 m_pointsMaps(maps), m_gridMaps(maps), m_octoMaps(maps), \
177 m_colourOctoMaps(maps), m_gasGridMaps(maps), m_wifiGridMaps(maps), \
178 m_heightMaps(maps), m_heightMRFMaps(maps), m_reflectivityMaps(maps), \
179 m_colourPointsMap(maps), m_weightedPointsMap(maps), \
180 m_landmarksMap(maps), m_beaconMap(maps)
211 maps = std::move(o.maps);
231 if (initializers !=
nullptr)
235 initializers->
begin();
236 it != initializers->
end(); ++it)
254 if (ptr) ptr->clear();
269 out << static_cast<uint32_t>(
m_ID);
291 this->
maps.resize(n);
337 return total_insert != 0;
351 "There is not exactly 1 points maps in the multimetric map.");
353 otherMap, otherMapPose, correspondences,
params, extraResults);
373 for (
size_t idx = 0; idx <
maps.size(); idx++)
380 static_cast<unsigned int>(idx));
407 float accumResult = 0;
409 for (
size_t idx = 0; idx <
maps.size(); idx++)
418 const size_t nMapsComputed =
maps.size();
419 if (nMapsComputed) accumResult /= nMapsComputed;
465 return maps[idx].get_ptr();
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Declares a virtual base class for all metric maps storage classes.
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
virtual float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const
Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map,...
std::shared_ptr< CMetricMap > Ptr
virtual void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const =0
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
This class stores any customizable set of metric maps.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
mrpt::maps::CMetricMap::Ptr getMapByIndex(size_t idx) const
Gets the i-th map.
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...
bool isEmpty() const override
Returns true if all maps returns true to their isEmpty() method, which is map-dependent.
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
CMultiMetricMap(const mrpt::maps::TSetOfMetricMapInitializers *initializers=nullptr)
Constructor.
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
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:
unsigned int m_ID
An auxiliary variable that can be used freely by the users (this will be copied to other maps using t...
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
The implementation in this class just calls all the corresponding method of the contained metric maps...
CMultiMetricMap & operator=(const CMultiMetricMap &o)
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 auxParticleFilterCleanUp() override
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::...
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...
ProxyFilterContainerByClass< mrpt::maps::CSimplePointsMap::Ptr, TListMaps > m_pointsMaps
STL-like proxy to access this kind of maps in maps.
void internal_clear() override
Clear all elements of the map.
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers *initializers)
Sets the list of internal map according to the passed list of map initializers (Current maps' content...
void deleteAllMaps()
Deletes all maps and clears the internal lists of maps (with clear_unique(), so user copies remain al...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
TListMaps maps
The list of MRPT metric maps in this object.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
std::deque< TMetricMapInitializer::Ptr >::const_iterator const_iterator
Declares a class that represents any robot's observation.
std::shared_ptr< CSetOfObjects > Ptr
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Virtual base class for "archives": classes abstracting I/O streams.
#define ASSERT_(f)
Defines an assertion mechanism.
#define ASSERT_BELOW_(__A, __B)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define MRPT_CHECK_NORMAL_NUMBER(v)
Throws an exception if the number is NaN, IND, or +/-INF, or return the same number otherwise.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
GLenum const GLfloat * params
GLsizei const GLchar ** string
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Functions for estimating the optimal transformation between two frames of references given measuremen...
unsigned __int32 uint32_t
void operator()(PTR &ptr)
void operator()(PTR &ptr)
MapCanComputeLikelihood(const CMultiMetricMap &m, const CObservation *_obs, bool &_can)
void operator()(PTR &ptr)
const CPose3D & takenFrom
MapComputeLikelihood(const CMultiMetricMap &m, const CObservation *_obs, const CPose3D &_takenFrom, double &_total_log_lik)
static void run(const CMultiMetricMap &_mmm, OP op)
MapGetAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &_obj_gl)
void operator()(PTR &ptr)
mrpt::opengl::CSetOfObjects::Ptr & obj_gl
const CPose3D * robot_pose
MapInsertObservation(const CMultiMetricMap &m, const CObservation *_obs, const CPose3D *_robot_pose, int &_total_insert)
void operator()(PTR &ptr)
void operator()(PTR &ptr)
MapIsEmpty(bool &_is_empty)
void operator()(T &container)
Parameters for the determination of matchings between point clouds, etc.
Parameters for CMetricMap::compute3DMatchingRatio()
Class factory & registry for map classes.
mrpt::maps::CMetricMap * factoryMapObjectFromDefinition(const mrpt::maps::TMetricMapInitializer &mi) const
Return nullptr if not found.
static TMetricMapTypesRegistry & Instance()