Go to the documentation of this file.
48 template <
typename OP>
54 std::for_each(mmm.maps.begin(), mmm.maps.end(), op);
68 : obs(_obs), can(_can)
73 template <
typename PTR>
76 can = can || ptr->canComputeObservationLikelihood(obs);
84 template <
typename PTR>
87 if (ptr) ptr->auxParticleFilterCleanUp();
95 MapIsEmpty(
bool& _is_empty) : is_empty(_is_empty) { is_empty =
true; }
96 template <
typename PTR>
99 if (ptr) is_empty = is_empty && ptr->isEmpty();
122 for (
const auto& i : inits)
125 auto* theMap = mmr.factoryMapObjectFromDefinition(*i.get());
135 std::for_each(maps.begin(), maps.end(), [](
auto ptr) {
136 if (ptr) ptr->clear();
143 const auto n =
static_cast<uint32_t
>(maps.size());
145 for (uint32_t i = 0; i < n; i++)
out << *maps[i];
166 this->maps.resize(n);
168 maps.begin(), maps.end(),
182 double ret_log_lik = 0;
184 std::for_each(maps.begin(), maps.end(), [&](
auto& ptr) {
185 ret_log_lik += ptr->computeObservationLikelihood(obs, takenFrom);
196 bool can_comp =
false;
197 std::for_each(maps.begin(), maps.end(), [&](
auto& ptr) {
198 can_comp = can_comp || ptr->canComputeObservationLikelihood(obs);
206 int total_insert = 0;
208 std::for_each(maps.begin(), maps.end(), [&](
auto& ptr) {
209 const bool ret = ptr->insertObservation(obs, robotPose);
210 if (ret) total_insert++;
212 return total_insert != 0;
221 const auto numPointsMaps = countMapsByClass<CSimplePointsMap>();
225 "There is not exactly 1 points maps in the multimetric map.");
226 mapByClass<CSimplePointsMap>()->determineMatching2D(
227 otherMap, otherMapPose, correspondences,
params, extraResults);
240 const std::string& filNamePrefix)
const
244 for (
size_t idx = 0; idx < maps.size(); idx++)
248 std::string fil = filNamePrefix;
254 static_cast<unsigned int>(idx));
265 std::for_each(maps.begin(), maps.end(), [&](
auto& ptr) {
266 ptr->getAs3DObject(outObj);
279 float accumResult = 0;
281 for (
const auto& map : maps)
290 const size_t nMapsComputed = maps.size();
291 if (nMapsComputed) accumResult /= nMapsComputed;
300 std::for_each(maps.begin(), maps.end(), [](
auto& ptr) {
301 ptr->auxParticleFilterCleanUp();
309 const auto numPointsMaps = countMapsByClass<CSimplePointsMap>();
310 ASSERT_(numPointsMaps == 1 || numPointsMaps == 0);
314 return this->mapByClass<CSimplePointsMap>(0).get();
321 return maps.at(idx).get_ptr();
void operator()(PTR &ptr)
static TMetricMapTypesRegistry & Instance()
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
std::shared_ptr< mrpt::opengl ::CSetOfObjects > Ptr
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:
bool isEmpty() const override
Returns true if all maps returns true in their isEmpty() method.
virtual void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const =0
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
void auxParticleFilterCleanUp() override
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::...
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
Parameters for CMetricMap::compute3DMatchingRatio()
mrpt::vision::TStereoCalibResults out
Functions for estimating the optimal transformation between two frames of references given measuremen...
#define ASSERT_(f)
Defines an assertion mechanism.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This namespace contains representation of robot actions and observations.
Virtual base class for "archives": classes abstracting I/O streams.
std::string fileNameStripInvalidChars(const std::string &filename, const char replacement_to_invalid_chars='_')
Replace invalid filename chars by underscores ('_') or any other user-given char.
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
bool internal_canComputeObservationLikelihood(const mrpt::obs::CObservation &obs) const override
Declares a virtual base class for all metric maps storage classes.
MapIsEmpty(bool &_is_empty)
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
This class stores any customizable set of metric maps.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const override
Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map,...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
std::shared_ptr< CMetricMap > Ptr
mrpt::maps::CMetricMap::Ptr mapByIndex(size_t idx) const
Gets the i-th map \excepmapByIndextime_error On out-of-bounds.
void operator()(PTR &ptr)
mrpt::vision::TStereoCalibParams params
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
Parameters for the determination of matchings between point clouds, etc.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
void internal_clear() override
Internal method called by clear()
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers &init)
Sets the list of internal map according to the passed list of map initializers (current maps will be ...
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
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,...
void operator()(PTR &ptr)
static void run(const CMultiMetricMap &_mmm, OP op)
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
CMultiMetricMap()=default
Default ctor: empty list of maps.
Declares a class that represents any robot's observation.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
const mrpt::maps::CSimplePointsMap * getAsSimplePointsMap() const override
If the map is a simple points map or it's a multi-metric map that contains EXACTLY one simple points ...
std::string std::string format(std::string_view fmt, ARGS &&... args)
MapCanComputeLikelihood(const CMultiMetricMap &m, const CObservation *_obs, bool &_can)
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020 | |