Main MRPT website > C++ reference for MRPT 1.9.9
CIncrementalMapPartitioner.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "slam-precomp.h" // Precompiled headers
11 
18 #include <mrpt/utils/CTicTac.h>
22 #include <mrpt/opengl/CSphere.h>
24 
25 using namespace mrpt::slam;
26 using namespace mrpt::obs;
27 using namespace mrpt::maps;
28 using namespace mrpt::math;
29 using namespace mrpt::graphs;
30 using namespace mrpt::poses;
31 using namespace mrpt::utils;
32 using namespace mrpt;
33 using namespace std;
34 
36 
37 /*---------------------------------------------------------------
38  Constructor
39  ---------------------------------------------------------------*/
41  : COutputLogger("CIncrementalMapPartitioner"),
42  options(),
43  m_individualFrames(),
44  m_individualMaps(),
45  m_A(0, 0),
46  m_last_partition(),
47  m_last_last_partition_are_new_ones(false),
48  m_modified_nodes()
49 {
50  clear();
51 }
52 
53 /*---------------------------------------------------------------
54  Destructor
55  ---------------------------------------------------------------*/
57 /*---------------------------------------------------------------
58  Destructor
59  ---------------------------------------------------------------*/
61  : partitionThreshold(1.0f),
62  gridResolution(0.10f),
63  minDistForCorrespondence(0.20f),
64  minMahaDistForCorrespondence(2.0f),
65  forceBisectionOnly(false),
66  useMapMatching(true),
67  minimumNumberElementsEachCluster(1)
68 {
69 }
70 
71 /*---------------------------------------------------------------
72  loadFromConfigFile
73  ---------------------------------------------------------------*/
75  const mrpt::utils::CConfigFileBase& source, const string& section)
76 {
78 
79  MRPT_LOAD_CONFIG_VAR(partitionThreshold, float, source, section);
80  MRPT_LOAD_CONFIG_VAR(gridResolution, float, source, section);
81  MRPT_LOAD_CONFIG_VAR(minDistForCorrespondence, float, source, section);
82  MRPT_LOAD_CONFIG_VAR(forceBisectionOnly, bool, source, section);
83  MRPT_LOAD_CONFIG_VAR(useMapMatching, bool, source, section);
85  minimumNumberElementsEachCluster, int, source, section);
86 
87  MRPT_END
88 }
89 
90 /*---------------------------------------------------------------
91  dumpToTextStream
92  ---------------------------------------------------------------*/
94  mrpt::utils::CStream& out) const
95 {
96  out.printf(
97  "\n----------- [CIncrementalMapPartitioner::TOptions] ------------ "
98  "\n\n");
99 
100  out.printf(
101  "partitionThreshold = %f\n", partitionThreshold);
102  out.printf(
103  "gridResolution = %f\n", gridResolution);
104  out.printf(
105  "minDistForCorrespondence = %f\n",
106  minDistForCorrespondence);
107  out.printf(
108  "forceBisectionOnly = %c\n",
109  forceBisectionOnly ? 'Y' : 'N');
110  out.printf(
111  "useMapMatching = %c\n",
112  useMapMatching ? 'Y' : 'N');
113  out.printf(
114  "minimumNumberElementsEachCluster = %i\n",
115  minimumNumberElementsEachCluster);
116 }
117 
118 /*---------------------------------------------------------------
119  clear
120  ---------------------------------------------------------------*/
122 {
124 
125  m_A.setSize(0, 0);
126 
127  m_individualFrames.clear(); // Free the map...
128 
129  // Free individual maps:
130  // for (deque_serializable<mrpt::maps::CMultiMetricMap>::iterator
131  // it=m_individualMaps.begin();it!=m_individualMaps.end();++it) delete
132  // (*it);
133  m_individualMaps.clear();
134 
135  m_last_partition.clear(); // Delete last partitions
136  m_modified_nodes.clear(); // Delete modified nodes
137 }
138 
139 /*---------------------------------------------------------------
140  addMapFrame
141  ---------------------------------------------------------------*/
143  const CSensoryFrame::Ptr& frame, const CPosePDF::Ptr& robotPose)
144 {
145  MRPT_START
146  return addMapFrame(
147  frame, CPose3DPDF::Ptr(CPose3DPDF::createFrom2D(*robotPose)));
148  MRPT_END
149 }
150 
151 /*---------------------------------------------------------------
152  addMapFrame
153  ---------------------------------------------------------------*/
155  const CSensoryFrame::Ptr& frame, const CPose3DPDF::Ptr& robotPose)
156 {
157  size_t i = 0, j = 0, n = 0;
158  CPose3D pose_i, pose_j, relPose;
159  CPose3DPDF::Ptr posePDF_i, posePDF_j;
160  CSensoryFrame::Ptr sf_i, sf_j;
161  CMultiMetricMap *map_i = NULL, *map_j = NULL;
163  static CPose3D nullPose(0, 0, 0);
164 
165  // Create the maps:
166  TSetOfMetricMapInitializers mapInitializer;
167 
168  {
170  mapInitializer.push_back(def);
171  }
172 
173  {
175  mapInitializer.push_back(def);
176  }
177 
178  // Add new metric map to "m_individualMaps"
179  // --------------------------------------------
180  m_individualMaps.push_back(CMultiMetricMap());
181  CMultiMetricMap& newMetricMap = m_individualMaps.back();
182  newMetricMap.setListOfMaps(&mapInitializer);
183 
184  MRPT_START
185 
186  // Create the metric map:
187  // -----------------------------------------------------------------
188  ASSERT_(newMetricMap.m_pointsMaps.size() > 0);
189  newMetricMap.m_pointsMaps[0]->insertionOptions.isPlanarMap = false; // true
190  newMetricMap.m_pointsMaps[0]->insertionOptions.minDistBetweenLaserPoints =
191  0.20f;
194  1.3f *
195  newMetricMap.m_pointsMaps[0]
196  ->insertionOptions.minDistBetweenLaserPoints);
197 
201 
202  // JLBC,17/AGO/2006: "m_individualMaps" were created from the robot pose,
203  // but it is
204  // more convenient now to save them as the robot being at (0,0,0).
205 
206  // frame->insertObservationsInto(newMetricMap.m_pointsMaps[0]);
207  newMetricMap.m_pointsMaps[0]->copyFrom(
208  *frame->buildAuxPointsMap<CPointsMap>(
209  &newMetricMap.m_pointsMaps[0]->insertionOptions)); // Faster :-)
210 
211  // Insert just the VisualLandmarkObservations:
212  mrpt::maps::CLandmarksMap& lm = *newMetricMap.m_landmarksMap;
216  frame->insertObservationsInto(&lm);
217 
218  // Add to corresponding vectors:
219  m_individualFrames.insert(robotPose, frame);
220  // Already added to "m_individualMaps" above
221 
222  // Expand the adjacency matrix
223  // -----------------------------------------------------------------
224  n = m_A.getColCount();
225  n++;
226  m_A.setSize(n, n);
227 
228  ASSERT_(m_individualMaps.size() == n);
230 
231  // Adjust size of vector containing the modified nodes
232  // ---------------------------------------------------
233  // The new must be taken into account as well.
234  m_modified_nodes.push_back(true);
235 
236  // Methods to compute adjacency matrix:
237  // true: matching between maps
238  // false: matching between observations through
239  // "CObservation::likelihoodWith"
240  // ------------------------------------------------------------------------------
241  bool useMapOrSF = options.useMapMatching;
242 
243  // Calculate the new matches - put them in the matrix
244  // ----------------------------------------------------------------
245  // for (i=n-1;i<n;i++)
246  i = n - 1; // Execute procedure until "i=n-1"; Last row/column is empty
247  {
248  // Get node "i":
249  m_individualFrames.get(i, posePDF_i, sf_i);
250  posePDF_i->getMean(pose_i);
251 
252  // And its points map:
253  map_i = &m_individualMaps[i];
254 
255  for (j = 0; j < n - 1; j++)
256  {
257  // Get node "j":
258  m_individualFrames.get(j, posePDF_j, sf_j);
259  posePDF_j->getMean(pose_j);
260 
261  relPose = pose_j - pose_i;
262 
263  // And its points map:
264  map_j = &m_individualMaps[j];
265 
266  // Compute matching ratio:
267  if (useMapOrSF)
268  {
269  m_A(i, j) = map_i->compute3DMatchingRatio(map_j, relPose, mrp);
270  }
271  else
272  {
273  // m_A(i,j) = sf_i->likelihoodWith(sf_j.pointer());
274  m_A(i, j) = observationsOverlap(sf_i, sf_j, &relPose);
275  }
276 
277  } // for j
278 
279  } // for i
280 
281  for (i = 0; i < n - 1;
282  i++) // Execute procedure until "i=n-1"; Last row/column is empty
283  {
284  // Get node "i":
285  m_individualFrames.get(i, posePDF_i, sf_i);
286  posePDF_i->getMean(pose_i);
287 
288  // And its points map:
289  map_i = &m_individualMaps[i];
290 
291  j = n - 1; // for (j=n-1;j<n;j++)
292  {
293  // Get node "j":
294  m_individualFrames.get(j, posePDF_j, sf_j);
295  posePDF_j->getMean(pose_j);
296 
297  relPose = pose_j - pose_i;
298 
299  // And its points map:
300  map_j = &m_individualMaps[j];
301 
302  // Compute matching ratio:
303  if (useMapOrSF)
304  {
305  m_A(i, j) =
306  map_i->compute3DMatchingRatio(map_j, CPose3D(relPose), mrp);
307  }
308  else
309  {
310  // m_A(i,j) = sf_i->likelihoodWith(sf_j.pointer());
311  m_A(i, j) = observationsOverlap(sf_i, sf_j, &relPose);
312  }
313  } // for j
314  } // for i
315 
316  // Self-similatity: Not used
317  m_A(n - 1, n - 1) = 0;
318 
319  // make matrix symetric
320  // -----------------------------------------------------------------
321  for (i = 0; i < n; i++)
322  for (j = i + 1; j < n; j++)
323  m_A(i, j) = m_A(j, i) = 0.5f * (m_A(i, j) + m_A(j, i));
324 
325  /* DEBUG: Save the matrix: * /
326  A.saveToTextFile("debug_matriz.txt",1);
327  / **/
328 
329  // Add the affected nodes to the list of modified ones
330  // -----------------------------------------------------------------
331  for (i = 0; i < n; i++) m_modified_nodes[i] = m_A(i, n - 1) > 0;
332 
334  {
335  // Insert into the "new_ones" partition:
336  m_last_partition[m_last_partition.size() - 1].push_back(n - 1);
337  }
338  else
339  {
340  // Add a new partition:
341  vector_uint dummyPart;
342  dummyPart.push_back(n - 1);
343  m_last_partition.push_back(dummyPart);
344 
345  // The last one is the new_ones partition:
347  }
348 
349  return n - 1; // Index of the new node
350 
352  cout << "Unexpected runtime error:\n"; cout << "\tn=" << n << "\n";
353  cout << "\ti=" << i << "\n"; cout << "\tj=" << j << "\n";
354  cout << "\tmap_i=" << map_i << "\n";
355  cout << "\tmap_j=" << map_j << "\n";
356  cout << "relPose: " << relPose << endl;
357  cout << "map_i.size()=" << map_i->m_pointsMaps[0]->size() << "\n";
358  cout << "map_j.size()=" << map_j->m_pointsMaps[0]->size() << "\n";
359  map_i->m_pointsMaps[0]->save2D_to_text_file(
360  string("debug_DUMP_map_i.txt"));
361  map_j->m_pointsMaps[0]->save2D_to_text_file(
362  string("debug_DUMP_map_j.txt"));
363  m_A.saveToTextFile("debug_DUMP_exception_A.txt"););
364 }
365 
366 /*---------------------------------------------------------------
367  updatePartitions
368  ---------------------------------------------------------------*/
370  vector<vector_uint>& partitions)
371 {
372  MRPT_START
373 
374  unsigned int i, j;
375  unsigned int n_nodes;
376  unsigned int n_clusters_last;
377  vector_uint mods; // The list of nodes that will have been regrouped
378  vector_bool last_parts_are_mods;
379 
380  n_nodes = m_modified_nodes.size(); // total number of nodes (scans)
381  n_clusters_last =
382  m_last_partition.size(); // Number of clusters in the last partition
383 
384  last_parts_are_mods.resize(n_clusters_last);
385 
386  // If a single scan of the cluster is affected, the whole cluster is
387  // affected
388  // -------------------------------------------------------------------
389  for (i = 0; i < n_clusters_last; i++)
390  {
392 
393  // Recorrer esta particion:
394  last_parts_are_mods[i] = false;
395 
396  // for (j=0;j<p.size();j++)
397  // if (m_modified_nodes[ p[j] ])
398  // last_parts_are_mods[i] = true;
399 
400  last_parts_are_mods[i] = true;
401 
402  // If changed mark all the nodes
403  if (last_parts_are_mods[i])
404  for (j = 0; j < p.size(); j++) m_modified_nodes[p[j]] = true;
405  }
406 
407  // How many nodes are going to be partitioned?
408  mods.clear();
409  for (i = 0; i < n_nodes; i++)
410  if (m_modified_nodes[i]) mods.push_back(i);
411 
412  // printf("[%u nodes to be recomputed]", mods.size());
413 
414  if (mods.size() > 0)
415  {
416  // Construct submatrix of adjacencies only with the nodes that are going
417  // to be regrouped
418  // -------------------------------------------------------------------
419  CMatrix A_mods;
420  A_mods.setSize(mods.size(), mods.size());
421  for (i = 0; i < mods.size(); i++)
422  {
423  for (j = 0; j < mods.size(); j++)
424  {
425  A_mods(i, j) = m_A(mods[i], mods[j]);
426  }
427  }
428 
429  // Partitions of the modified nodes
430  vector<vector_uint> mods_parts;
431  mods_parts.clear();
432 
434  A_mods, mods_parts, options.partitionThreshold, true, true,
436  options.minimumNumberElementsEachCluster, false /* verbose */
437  );
438 
439  // Aggregate the results with the clusters that were not used and return
440  // them
441  // --------------------------------------------------------------------------
442  partitions.clear();
443 
444  // 1) Add the partitions that have not been modified
445  // -----------------------------------------------
446  for (i = 0; i < m_last_partition.size(); i++)
447  if (!last_parts_are_mods[i])
448  partitions.push_back(m_last_partition[i]);
449 
450  // 2) Add the modified partitions
451  // WARNING: Translate the indices acordingly
452  // -----------------------------------------------
453  for (i = 0; i < mods_parts.size(); i++)
454  {
455  vector_uint v;
456  v.clear();
457  for (j = 0; j < mods_parts[i].size(); j++)
458  v.push_back(mods[mods_parts[i][j]]);
459 
460  partitions.push_back(v);
461  }
462  }
463 
464  // Update all nodes
465  for (i = 0; i < n_nodes; i++) m_modified_nodes[i] = false;
466 
467  // Save partition so that we take it into account in the next iteration
468  // ------------------------------------------------------------------------
469  size_t n = partitions.size();
470  m_last_partition.resize(n);
471  for (i = 0; i < n; i++) m_last_partition[i] = partitions[i];
472 
474 
475  MRPT_END
476 }
477 
478 /*---------------------------------------------------------------
479  getNodesCount
480  ------------------------------------------------------------ ---*/
482 {
483  return m_individualFrames.size();
484 }
485 
486 /*---------------------------------------------------------------
487  removeSetOfNodes
488  ---------------------------------------------------------------*/
490  vector_uint indexesToRemove, bool changeCoordsRef)
491 {
492  MRPT_START
493 
494  size_t nOld = m_A.getColCount();
495  size_t nNew = nOld - indexesToRemove.size();
496  size_t i, j;
497 
498  // Assure indexes are sorted:
499  std::sort(indexesToRemove.begin(), indexesToRemove.end());
500 
501  ASSERT_(nNew >= 1);
502 
503  // Build the vector with the nodes that REMAINS;
504  vector_uint indexesToStay;
505  indexesToStay.reserve(nNew);
506  for (i = 0; i < nOld; i++)
507  {
508  bool remov = false;
509  for (j = 0; !remov && j < indexesToRemove.size(); j++)
510  {
511  if (indexesToRemove[j] == i) remov = true;
512  }
513 
514  if (!remov) indexesToStay.push_back(i);
515  }
516 
517  ASSERT_(indexesToStay.size() == nNew);
518 
519  // Update the A matrix:
520  // ---------------------------------------------------
521  CMatrixDouble newA(nNew, nNew);
522  for (i = 0; i < nNew; i++)
523  for (j = 0; j < nNew; j++)
524  newA(i, j) = m_A(indexesToStay[i], indexesToStay[j]);
525 
526  // Substitute "A":
527  m_A = newA;
528 
529  // The last partitioning is all the nodes together:
530  // --------------------------------------------------
531  m_last_partition.resize(1);
532  m_last_partition[0].resize(nNew);
533  for (i = 0; i < nNew; i++) m_last_partition[0][i] = i;
534 
536 
537  // The matrix "A" is supposed to be right, thus recomputing is not required:
538  m_modified_nodes.assign(nNew, false);
539 
540  // The new sequence of maps:
541  // --------------------------------------------------
542  vector_uint::reverse_iterator it;
543  for (it = indexesToRemove.rbegin(); it != indexesToRemove.rend(); ++it)
544  {
546  m_individualMaps.begin() + *it;
547  // delete *itM; // Delete map
548  m_individualMaps.erase(itM); // Delete from list
549  }
550 
551  // The new sequence of localized SFs:
552  // --------------------------------------------------
553  for (it = indexesToRemove.rbegin(); it != indexesToRemove.rend(); ++it)
555 
556  // Change coordinates reference of frames:
558  CPose3DPDF::Ptr posePDF;
559 
560  if (changeCoordsRef)
561  {
563  m_individualFrames.get(0, posePDF, SF);
564 
565  CPose3D p;
566  posePDF->getMean(p);
568  }
569 
570  // All done!
571 
572  MRPT_END
573 }
574 
575 /*---------------------------------------------------------------
576  markAllNodesForReconsideration
577  ---------------------------------------------------------------*/
579 {
581  m_last_partition.clear(); // No partitions in last step
582 
584  it != m_modified_nodes.end(); ++it)
585  *it = 1; // true;
586 }
587 
588 /*---------------------------------------------------------------
589  changeCoordinatesOrigin
590  ---------------------------------------------------------------*/
592  const CPose3D& newOrigin)
593 {
595 }
596 
597 /*---------------------------------------------------------------
598  changeCoordinatesOriginPoseIndex
599  ---------------------------------------------------------------*/
601  const unsigned& newOriginPose)
602 {
603  MRPT_START
604 
605  CPose3DPDF::Ptr pdf;
607  m_individualFrames.get(newOriginPose, pdf, sf);
608 
609  CPose3D p;
610  pdf->getMean(p);
612 
613  MRPT_END
614 }
615 
616 /*---------------------------------------------------------------
617  getAs3DScene
618  ---------------------------------------------------------------*/
621  const std::map<uint32_t, int64_t>* renameIndexes) const
622 {
623  objs->clear();
624  ASSERT_(m_individualFrames.size() == m_A.getColCount());
625 
626  objs->insert(
627  mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
628  -100, 100, -100, 100, 0, 5));
629 
630  for (size_t i = 0; i < m_individualFrames.size(); i++)
631  {
632  CPose3DPDF::Ptr i_pdf;
633  CSensoryFrame::Ptr i_sf;
634  m_individualFrames.get(i, i_pdf, i_sf);
635 
636  CPose3D i_mean;
637  i_pdf->getMean(i_mean);
638 
639  opengl::CSphere::Ptr i_sph =
640  mrpt::make_aligned_shared<opengl::CSphere>();
641  i_sph->setRadius(0.02f);
642  i_sph->setColor(0, 0, 1);
643 
644  if (!renameIndexes)
645  i_sph->setName(format("%u", static_cast<unsigned int>(i)));
646  else
647  {
649  renameIndexes->find(i);
650  ASSERT_(itName != renameIndexes->end());
651  i_sph->setName(
652  format("%lu", static_cast<unsigned long>(itName->second)));
653  }
654 
655  i_sph->enableShowName();
656  i_sph->setPose(i_mean);
657 
658  objs->insert(i_sph);
659 
660  // Arcs:
661  for (size_t j = i + 1; j < m_individualFrames.size(); j++)
662  {
663  CPose3DPDF::Ptr j_pdf;
664  CSensoryFrame::Ptr j_sf;
665  m_individualFrames.get(j, j_pdf, j_sf);
666 
667  CPose3D j_mean;
668  j_pdf->getMean(j_mean);
669 
670  float SSO_ij = m_A(i, j);
671 
672  if (SSO_ij > 0.01)
673  {
675  mrpt::make_aligned_shared<opengl::CSimpleLine>();
676  lin->setLineCoords(
677  i_mean.x(), i_mean.y(), i_mean.z(), j_mean.x(), j_mean.y(),
678  j_mean.z());
679 
680  lin->setColor(SSO_ij, 0, 1 - SSO_ij, SSO_ij * 0.6);
681  lin->setLineWidth(SSO_ij * 10);
682 
683  objs->insert(lin);
684  }
685  }
686  }
687 }
688 
689 /*---------------------------------------------------------------
690  readFromStream
691  ---------------------------------------------------------------*/
693  mrpt::utils::CStream& in, int version)
694 {
695  switch (version)
696  {
697  case 0:
698  {
702  }
703  break;
704  default:
706  };
707 }
708 
709 /*---------------------------------------------------------------
710  writeToStream
711  Implements the writing to a CStream capability of
712  CSerializable objects
713  ---------------------------------------------------------------*/
715  mrpt::utils::CStream& out, int* version) const
716 {
717  if (version)
718  *version = 0;
719  else
720  {
723  }
724 }
725 
726 /*---------------------------------------------------------------
727  addMapFrame
728  ---------------------------------------------------------------*/
730  const CSensoryFrame& frame, const CPose3DPDF& robotPose3D)
731 {
732  return addMapFrame(
733  CSensoryFrame::Ptr(new CSensoryFrame(frame)),
734  std::dynamic_pointer_cast<CPose3DPDF>(
735  robotPose3D.duplicateGetSmartPtr()));
736 }
#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...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Algorithms for finding the min-normalized-cut of a weighted undirected graph.
A class for storing a map of 3D probabilistic landmarks.
Definition: CLandmarksMap.h:76
mrpt::maps::CLandmarksMap::TInsertionOptions insertionOptions
This class stores any customizable set of metric maps.
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams &params) const override
See the definition in the base class: Calls in this class become a call to every single map in this s...
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::CSimplePointsMap::Ptr, TListMaps > m_pointsMaps
STL-like proxy to access this kind of maps in maps.
void setListOfMaps(const mrpt::maps::TSetOfMetricMapInitializers *initializers)
Sets the list of internal map according to the passed list of map initializers (Current maps' content...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
Definition: CPointsMap.h:67
void insert(const mrpt::poses::CPose3DPDF *in_posePDF, const mrpt::obs::CSensoryFrame &in_SF)
Add a new pair to the sequence.
Definition: CSimpleMap.cpp:177
void clear()
Remove all stored pairs.
Definition: CSimpleMap.cpp:70
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...
Definition: CSimpleMap.cpp:315
void get(size_t index, mrpt::poses::CPose3DPDF::Ptr &out_posePDF, mrpt::obs::CSensoryFrame::Ptr &out_SF) const
Access to the i'th pair, first one is index '0'.
Definition: CSimpleMap.cpp:78
void remove(size_t index)
Deletes the i'th pair, first one is index '0'.
Definition: CSimpleMap.cpp:91
size_t size() const
Returns the count of pairs (pose,sensory data)
Definition: CSimpleMap.cpp:65
A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap...
void push_back(const MAP_DEFINITION &o)
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:26
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:55
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:32
std::shared_ptr< CSimpleLine > Ptr
Definition: CSimpleLine.h:24
std::shared_ptr< CSphere > Ptr
Definition: CSphere.h:33
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:89
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
Definition: CPose3DPDF.h:44
std::shared_ptr< CPose3DPDF > Ptr
Definition: CPose3DPDF.h:45
double x() const
Common members of all points & poses classes.
Definition: CPoseOrPoint.h:135
std::shared_ptr< CPosePDF > Ptr
Definition: CPosePDF.h:44
This class can be used to make partitions on a map/graph build from observations taken at some poses/...
std::vector< uint8_t > m_modified_nodes
The list of keyframes to consider in the next update.
void markAllNodesForReconsideration()
Mark all nodes for reconsideration in the next call to "updatePartitions", instead of considering jus...
std::deque< mrpt::maps::CMultiMetricMap > m_individualMaps
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
mrpt::math::CMatrixD m_A
Adjacency matrix.
std::vector< vector_uint > m_last_partition
The last partition.
void removeSetOfNodes(vector_uint indexesToRemove, bool changeCoordsRef=true)
Remove the stated nodes (0-based indexes) from the internal lists.
bool m_last_last_partition_are_new_ones
This will be true after adding new observations, and before an "updatePartitions" is invoked.
void updatePartitions(std::vector< vector_uint > &partitions)
This method executed only the neccesary part of the partition to take into account the lastest added ...
unsigned int getNodesCount()
Get the total node count currently in the internal map/graph.
mrpt::slam::CIncrementalMapPartitioner::TOptions options
void changeCoordinatesOriginPoseIndex(const unsigned &newOriginPose)
The new origin is given by the index of the pose that is to become the new origin.
void getAs3DScene(mrpt::opengl::CSetOfObjects::Ptr &objs, const std::map< uint32_t, int64_t > *renameIndexes=NULL) const
Return a 3D representation of the current state: poses & links between them.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
unsigned int addMapFrame(const mrpt::obs::CSensoryFrame::Ptr &frame, const mrpt::poses::CPosePDF::Ptr &robotPose2D)
void changeCoordinatesOrigin(const mrpt::poses::CPose3D &newOrigin)
This class allows loading and storing values and vectors of different types from a configuration text...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:45
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:42
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
Definition: CStream.cpp:597
A list of TMatchingPair.
Definition: TMatchingPair.h:94
Scalar * iterator
Definition: eigen_plugins.h:26
const Scalar * const_iterator
Definition: eigen_plugins.h:27
GLenum GLsizei n
Definition: glext.h:5074
const GLdouble * v
Definition: glext.h:3678
GLuint in
Definition: glext.h:7274
GLfloat GLfloat p
Definition: glext.h:6305
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::utils::CObject::Ptr duplicateGetSmartPtr() const
Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object w...
Definition: CObject.h:179
std::vector< bool > vector_bool
A type for passing a vector of bools.
Definition: types_simple.h:31
std::vector< uint32_t > vector_uint
Definition: types_simple.h:29
double observationsOverlap(const mrpt::obs::CObservation *o1, const mrpt::obs::CObservation *o2, const mrpt::poses::CPose3D *pose_o2_wrt_o1=nullptr)
Estimates the "overlap" or "matching ratio" of two observations (range [0,1]), possibly taking into a...
#define MRPT_START
Definition: mrpt_macros.h:425
#define ASSERT_(f)
Definition: mrpt_macros.h:309
#define MRPT_END
Definition: mrpt_macros.h:429
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: mrpt_macros.h:181
#define MRPT_END_WITH_CLEAN_UP(stuff)
Definition: mrpt_macros.h:431
Abstract graph and tree data structures, plus generic graph algorithms.
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:20
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:18
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
void clear()
Clear the contents of this container.
Definition: ts_hash_map.h:189
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:19
bool insert_SIFTs_from_monocular_images
If set to true (default), the insertion of a CObservationImage in the map will insert SIFT 3D feature...
bool insert_Landmarks_from_range_scans
If set to true (default), inserting a CObservation2DRangeScan in the map will generate landmarks for ...
bool insert_SIFTs_from_stereo_images
If set to true (default), the insertion of a CObservationStereoImages in the map will insert SIFT 3D ...
Parameters for CMetricMap::compute3DMatchingRatio()
float maxMahaDistForCorr
(Default: 2.0f) The minimum Mahalanobis distance between 2 probabilistic map elements for counting th...
float maxDistForCorr
(Default: 0.10f) The minimum distance between 2 non-probabilistic map elements for counting them as a...
float partitionThreshold
The partition threshold for bisection in range [0,2], default=1.0.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
int minimumNumberElementsEachCluster
If a partition leads to a cluster with less elements than this, it will be rejected even if had a goo...
bool useMapMatching
If set to true (default), adjacency matrix is computed from maps matching; otherwise,...



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 63ea9d1f1 Thu Nov 23 00:06:53 2017 +0100 at mar 26 may 2026 12:19:29 CEST