47 m_last_last_partition_are_new_ones(false),
65 partitionThreshold(1.0f),
66 gridResolution(0.10f),
67 minDistForCorrespondence(0.20f),
68 minMahaDistForCorrespondence(2.0f),
69 forceBisectionOnly(false),
71 minimumNumberElementsEachCluster(1) { }
78 const string §ion)
97 out.
printf(
"\n----------- [CIncrementalMapPartitioner::TOptions] ------------ \n\n");
99 out.
printf(
"partitionThreshold = %f\n",partitionThreshold);
100 out.
printf(
"gridResolution = %f\n",gridResolution);
101 out.
printf(
"minDistForCorrespondence = %f\n",minDistForCorrespondence);
102 out.
printf(
"forceBisectionOnly = %c\n",forceBisectionOnly ?
'Y':
'N');
103 out.
printf(
"useMapMatching = %c\n",useMapMatching ?
'Y':
'N');
104 out.
printf(
"minimumNumberElementsEachCluster = %i\n",minimumNumberElementsEachCluster);
131 const CSensoryFramePtr &frame,
132 const CPosePDFPtr &robotPose)
135 return addMapFrame(frame,CPose3DPDFPtr(CPose3DPDF::createFrom2D(*robotPose)));
144 const CSensoryFramePtr &frame,
145 const CPose3DPDFPtr &robotPose)
148 CPose3D pose_i, pose_j, relPose;
149 CPose3DPDFPtr posePDF_i, posePDF_j;
150 CSensoryFramePtr sf_i, sf_j;
153 static CPose3D nullPose(0,0,0);
179 newMetricMap.
m_pointsMaps[0]->insertionOptions.isPlanarMap =
false;
180 newMetricMap.
m_pointsMaps[0]->insertionOptions.minDistBetweenLaserPoints = 0.20f;
198 frame->insertObservationsInto(&lm);
206 n =
m_A.getColCount();
231 posePDF_i->getMean(pose_i);
240 posePDF_j->getMean(pose_j);
242 relPose = pose_j - pose_i;
261 for (i=0; i<
n-1; i++)
265 posePDF_i->getMean(pose_i);
274 posePDF_j->getMean(pose_j);
276 relPose = pose_j - pose_i;
321 dummyPart.push_back(
n-1);
331 cout <<
"Unexpected runtime error:\n"; \
332 cout <<
"\tn=" <<
n <<
"\n"; \
333 cout <<
"\ti=" << i <<
"\n"; \
334 cout <<
"\tj=" << j <<
"\n"; \
335 cout <<
"\tmap_i=" << map_i <<
"\n"; \
336 cout <<
"\tmap_j=" << map_j <<
"\n"; \
337 cout <<
"relPose: "<< relPose << endl; \
338 cout <<
"map_i.size()=" << map_i->m_pointsMaps[0]->
size() <<
"\n"; \
339 cout <<
"map_j.size()=" << map_j->m_pointsMaps[0]->size() <<
"\n"; \
340 map_i->m_pointsMaps[0]->save2D_to_text_file(
string(
"debug_DUMP_map_i.txt")); \
341 map_j->m_pointsMaps[0]->save2D_to_text_file(
string(
"debug_DUMP_map_j.txt")); \
342 m_A.saveToTextFile(
"debug_DUMP_exception_A.txt"); \
351 vector<vector_uint> &partitions)
356 unsigned int n_nodes;
357 unsigned int n_clusters_last;
364 last_parts_are_mods.resize(n_clusters_last);
368 for (i=0;i<n_clusters_last;i++)
373 last_parts_are_mods[i] =
false;
379 last_parts_are_mods[i] =
true;
382 if (last_parts_are_mods[i])
383 for (j=0;j<
p.size();j++)
389 for (i=0;i<n_nodes;i++)
402 A_mods.setSize(mods.size(),mods.size());
403 for (i=0;i<mods.size();i++)
405 for (j=0;j<mods.size();j++)
407 A_mods(i,j) =
m_A(mods[i],mods[j]);
412 vector<vector_uint> mods_parts;
433 if (!last_parts_are_mods[i])
440 for (i=0;i<mods_parts.size();i++)
444 for (j=0;j<mods_parts[i].size();j++)
445 v.push_back(mods[mods_parts[i][j]]);
447 partitions.push_back(
v);
452 for (i=0;i<n_nodes;i++)
457 size_t n = partitions.size();
483 size_t nOld =
m_A.getColCount();
484 size_t nNew = nOld - indexesToRemove.size();
488 std::sort(indexesToRemove.begin(), indexesToRemove.end());
494 indexesToStay.reserve(nNew);
498 for (j=0;!remov && j<indexesToRemove.size();j++)
500 if (indexesToRemove[j]==i)
505 indexesToStay.push_back(i);
508 ASSERT_(indexesToStay.size() == nNew);
515 newA(i,j)=
m_A(indexesToStay[i],indexesToStay[j]);
535 vector_uint::reverse_iterator it;
536 for (it= indexesToRemove.rbegin(); it!=indexesToRemove.rend(); ++it)
545 for (it = indexesToRemove.rbegin(); it!=indexesToRemove.rend(); ++it)
550 CPose3DPDFPtr posePDF;
609 mrpt::opengl::CSetOfObjectsPtr &objs,
610 const std::map<uint32_t,int64_t> *renameIndexes
621 CSensoryFramePtr i_sf;
625 i_pdf->getMean(i_mean);
628 i_sph->setRadius(0.02f);
629 i_sph->setColor(0,0,1);
632 i_sph->setName(
format(
"%u",static_cast<unsigned int>(i)));
636 ASSERT_(itName != renameIndexes->end());
637 i_sph->setName(
format(
"%lu",static_cast<unsigned long>(itName->second)));
640 i_sph->enableShowName();
641 i_sph->setPose(i_mean);
650 CSensoryFramePtr j_sf;
654 j_pdf->getMean(j_mean);
656 float SSO_ij =
m_A(i,j);
662 i_mean.
x(), i_mean.
y(), i_mean.z(),
663 j_mean.
x(), j_mean.
y(), j_mean.z());
665 lin->setColor(SSO_ij, 0, 1-SSO_ij, SSO_ij*0.6);
666 lin->setLineWidth(SSO_ij * 10);
float partitionThreshold
The partition threshold for bisection in range [0,2], default=1.0.
std::deque< mrpt::maps::CMultiMetricMap > m_individualMaps
double x() const
Common members of all points & poses classes.
Parameters for CMetricMap::compute3DMatchingRatio()
mrpt::maps::CSimpleMap m_individualFrames
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
bool insert_SIFTs_from_stereo_images
If set to true (default), the insertion of a CObservationStereoImages in the map will insert SIFT 3D ...
std::vector< uint32_t > vector_uint
mrpt::math::CMatrixD m_A
Adjacency matrix.
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const MRPT_OVERRIDE
See the definition in the base class: Calls in this class become a call to every single map in this s...
double SLAM_IMPEXP observationsOverlap(const mrpt::obs::CObservation *o1, const mrpt::obs::CObservation *o2, const mrpt::poses::CPose3D *pose_o2_wrt_o1=NULL)
Estimates the "overlap" or "matching ratio" of two observations (range [0,1]), possibly taking into a...
#define MRPT_END_WITH_CLEAN_UP(stuff)
unsigned int getNodesCount()
Get the total node count currently in the internal map/graph.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
void markAllNodesForReconsideration()
Mark all nodes for reconsideration in the next call to "updatePartitions", instead of considering jus...
bool useMapMatching
If set to true (default), adjacency matrix is computed from maps matching; otherwise, the method CObservation::likelihoodWith will be called directly from the SFs.
Abstract graph and tree data structures, plus generic graph algorithms.
void updatePartitions(std::vector< vector_uint > &partitions)
This method executed only the neccesary part of the partition to take into account the lastest added ...
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
const Scalar * const_iterator
void getAs3DScene(mrpt::opengl::CSetOfObjectsPtr &objs, const std::map< uint32_t, int64_t > *renameIndexes=NULL) const
Return a 3D representation of the current state: poses & links between them.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
void removeSetOfNodes(vector_uint indexesToRemove, bool changeCoordsRef=true)
Remove the stated nodes (0-based indexes) from the internal lists.
static CSpherePtr Create()
void clear()
Clear the contents of this container.
void changeCoordinatesOrigin(const mrpt::poses::CPose3D &newOrigin)
This class allows loading and storing values and vectors of different types from a configuration text...
std::vector< bool > vector_bool
A type for passing a vector of bools.
float maxDistForCorr
(Default: 0.10f) The minimum distance between 2 non-probabilistic map elements for counting them as a...
bool insert_SIFTs_from_monocular_images
If set to true (default), the insertion of a CObservationImage in the map will insert SIFT 3D feature...
void changeCoordinatesOriginPoseIndex(const unsigned &newOriginPose)
The new origin is given by the index of the pose that is to become the new origin.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
This base provides a set of functions for maths stuff.
A class for storing a map of 3D probabilistic landmarks.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
ProxySelectorContainerByClass< mrpt::maps::CLandmarksMapPtr, TListMaps > m_landmarksMap
Proxy that looks like a smart pointer to the first matching object in maps.
This namespace contains representation of robot actions and observations.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
mrpt::slam::CIncrementalMapPartitioner::TOptions options
size_t size() const
Returns the count of pairs (pose,sensory data)
unsigned int addMapFrame(const mrpt::obs::CSensoryFramePtr &frame, const mrpt::poses::CPosePDFPtr &robotPose2D)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
mrpt::utils::CObjectPtr duplicateGetSmartPtr() const
Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object w...
mrpt::maps::CLandmarksMap::TInsertionOptions insertionOptions
void push_back(const MAP_DEFINITION &o)
std::vector< vector_uint > m_last_partition
The last partition.
void get(size_t index, mrpt::poses::CPose3DPDFPtr &out_posePDF, mrpt::obs::CSensoryFramePtr &out_SF) const
Access to the i'th pair, first one is index '0'.
#define MRPT_LOAD_CONFIG_VAR(variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
static CGridPlaneXYPtr Create()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::maps::CMultiMetricMap CMultiMetricMap
Backward compatible typedef.
This class can be used to make partitions on a map/graph build from observations taken at some poses/...
int minimumNumberElementsEachCluster
If a partition leads to a cluster with less elements than this, it will be rejected even if had a goo...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
virtual ~CIncrementalMapPartitioner()
dtor
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers *initializers)
Sets the list of internal map according to the passed list of map initializers (Current maps' content...
static CSimpleLinePtr Create()
float minDistForCorrespondence
bool m_last_last_partition_are_new_ones
This will be true after adding new observations, and before an "updatePartitions" is invoked...
GLsizei GLsizei GLchar * source
float maxMahaDistForCorr
(Default: 2.0f) The minimum Mahalanobis distance between 2 probabilistic map elements for counting th...
bool insert_Landmarks_from_range_scans
If set to true (default), inserting a CObservation2DRangeScan in the map will generate landmarks for ...
ProxyFilterContainerByClass< mrpt::maps::CSimplePointsMapPtr, TListMaps > m_pointsMaps
STL-like proxy to access this kind of maps in maps.
This class stores any customizable set of metric maps.
float minMahaDistForCorrespondence
This class is a "CSerializable" wrapper for "CMatrixFloat".
void insert(const mrpt::poses::CPose3DPDF *in_posePDF, const mrpt::obs::CSensoryFrame &in_SF)
Add a new pair to the sequence.
void changeCoordinatesOrigin(const mrpt::poses::CPose3D &newOrigin)
Change the coordinate origin of all stored poses, for consistency with future new poses to enter in t...
Algorithms for finding the min-normalized-cut of a weighted undirected graph.
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
void clear()
Remove all stored pairs.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
void remove(size_t index)
Deletes the i'th pair, first one is index '0'.
std::vector< uint8_t > m_modified_nodes
The list of keyframes to consider in the next update.