Main MRPT website > C++ reference for MRPT 1.9.9
CMetricMapBuilderRBPF.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-2018, 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 
16 #include <mrpt/math/utils.h>
17 
18 using namespace mrpt;
19 using namespace mrpt::slam;
20 using namespace mrpt::math;
21 using namespace mrpt::maps;
22 using namespace mrpt::obs;
23 using namespace mrpt::poses;
24 using namespace mrpt::bayes;
25 using namespace mrpt::img;
26 
27 /*---------------------------------------------------------------
28  Constructor
29  ---------------------------------------------------------------*/
31  const TConstructionOptions& initializationOptions)
32  : mapPDF(
33  initializationOptions.PF_options,
34  &initializationOptions.mapsInitializers,
35  &initializationOptions.predictionOptions),
36  m_PF_options(initializationOptions.PF_options),
37  insertionLinDistance(initializationOptions.insertionLinDistance),
38  insertionAngDistance(initializationOptions.insertionAngDistance),
39  localizeLinDistance(initializationOptions.localizeLinDistance),
40  localizeAngDistance(initializationOptions.localizeAngDistance),
41  odoIncrementSinceLastLocalization(),
42  odoIncrementSinceLastMapUpdate()
43 {
44  setLoggerName("CMetricMapBuilderRBPF");
45  setVerbosityLevel(initializationOptions.verbosity_level);
46  // Reset:
47  clear();
48 }
49 
51 {
52  this->setLoggerName("CMetricMapBuilderRBPF");
53  MRPT_LOG_WARN("Empty constructor invoked!\n");
54 }
55 
56 /*---------------------------------------------------------------
57  Copy operator
58  ---------------------------------------------------------------*/
61 {
62  if (this == &src)
63  {
64  return *this;
65  }
66  mapPDF = src.mapPDF;
67  m_PF_options = src.m_PF_options;
68  insertionLinDistance = src.insertionLinDistance;
69  insertionAngDistance = src.insertionAngDistance;
70  localizeLinDistance = src.localizeLinDistance;
71  localizeAngDistance = src.localizeAngDistance;
72  odoIncrementSinceLastLocalization = src.odoIncrementSinceLastLocalization;
73  odoIncrementSinceLastMapUpdate = src.odoIncrementSinceLastMapUpdate;
74  m_statsLastIteration = src.m_statsLastIteration;
75  return *this;
76 }
77 
78 /*---------------------------------------------------------------
79  Destructor
80  ---------------------------------------------------------------*/
82 /*---------------------------------------------------------------
83  clear
84  ---------------------------------------------------------------*/
86 {
87  std::lock_guard<std::mutex> csl(
88  critZoneChangingMap); // Enter critical section (updating map)
89 
90  MRPT_LOG_DEBUG("CMetricMapBuilderRBPF::clear() called.");
91  static CPose2D nullPose(0, 0, 0);
92 
93  // Reset traveled distances counters:
95 
97 
98  // Clear maps for each particle:
99  mapPDF.clear(nullPose);
100 }
101 
102 /*---------------------------------------------------------------
103  processActionObservation
104  ---------------------------------------------------------------*/
106  CActionCollection& action, CSensoryFrame& observations)
107 {
108  MRPT_START
109  std::lock_guard<std::mutex> csl(
110  critZoneChangingMap); // Enter critical section (updating map)
111 
112  // Update the traveled distance estimations:
113  {
118  if (act3D)
119  {
121  "processActionObservation(): Input action is "
122  "CActionRobotMovement3D="
123  << act3D->poseChange.getMeanVal().asString());
124  odoIncrementSinceLastMapUpdate += act3D->poseChange.getMeanVal();
125  odoIncrementSinceLastLocalization += act3D->poseChange;
126  }
127  else if (act2D)
128  {
130  "processActionObservation(): Input action is "
131  "CActionRobotMovement2D="
132  << act2D->poseChange->getMeanVal().asString());
134  mrpt::poses::CPose3D(act2D->poseChange->getMeanVal());
136  mrpt::poses::CPose3D(act2D->poseChange->getMeanVal());
137  }
138  else
139  {
140  MRPT_LOG_WARN("Action contains no odometry.\n");
141  }
142  }
143 
144  // Execute particle filter:
145  // But only if the traveled distance since the last update is long enough,
146  // or this is the first observation, etc...
147  // ----------------------------------------------------------------------------
148  bool do_localization =
149  (!mapPDF.SFs.size() || // This is the first observation!
154 
155  bool do_map_update =
156  (!mapPDF.SFs.size() || // This is the first observation!
160 
161  // Used any "options.alwaysInsertByClass" ??
162  for (auto itCl = options.alwaysInsertByClass.data.begin();
163  !do_map_update && itCl != options.alwaysInsertByClass.data.end();
164  ++itCl)
165  for (auto& o : observations)
166  if (o->GetRuntimeClass() == *itCl)
167  {
168  do_map_update = true;
169  do_localization = true;
170  break;
171  }
172 
173  if (do_map_update) do_localization = true;
174 
176  mrpt::format(
177  "do_map_update=%s do_localization=%s", do_map_update ? "YES" : "NO",
178  do_localization ? "YES" : "NO"));
179 
180  if (do_localization)
181  {
182  // Create an artificial action object, since
183  // we've been collecting them until a threshold:
184  // ------------------------------------------------
185  CActionCollection fakeActs;
186  {
189  if (act3D)
190  {
191  CActionRobotMovement3D newAct;
192  newAct.estimationMethod = act3D->estimationMethod;
194  newAct.timestamp = act3D->timestamp;
195  fakeActs.insert(newAct);
196  }
197  else
198  {
199  // It must be 2D odometry:
202  ASSERT_(act2D);
203  CActionRobotMovement2D newAct;
204  newAct.computeFromOdometry(
206  act2D->motionModelConfiguration);
207  newAct.timestamp = act2D->timestamp;
208  fakeActs.insert(newAct);
209  }
210  }
211 
213  "odoIncrementSinceLastLocalization before resetting = "
215  // Reset distance counters:
218 
219  CParticleFilter pf;
220  pf.m_options = m_PF_options;
222 
223  pf.executeOn(mapPDF, &fakeActs, &observations);
224 
226  {
227  // Get current pose estimation:
228  CPose3DPDFParticles poseEstimation;
229  CPose3D meanPose;
230  mapPDF.getEstimatedPosePDF(poseEstimation);
231  poseEstimation.getMean(meanPose);
232 
233  CPose3D estPos;
235  poseEstimation.getCovarianceAndMean(cov, estPos);
236 
238  "New pose=" << estPos << std::endl
239  << "New ESS:" << mapPDF.ESS() << std::endl);
241  format(
242  " STDs: x=%2.3f y=%2.3f z=%.03f yaw=%2.3fdeg\n",
243  sqrt(cov(0, 0)), sqrt(cov(1, 1)), sqrt(cov(2, 2)),
244  RAD2DEG(sqrt(cov(3, 3)))));
245  }
246  }
247 
248  if (do_map_update)
249  {
251 
252  // Update the particles' maps:
253  // -------------------------------------------------
254  MRPT_LOG_INFO("New observation inserted into the map.");
255 
256  // Add current observation to the map:
257  const bool anymap_update = mapPDF.insertObservation(observations);
258  if (!anymap_update)
260  "**No map was updated** after inserting a CSensoryFrame with "
261  << observations.size());
262 
264  }
265  else
266  {
268  }
269 
270  // Added 29/JUN/2007 JLBC: Tell all maps that they can now free aux.
271  // variables
272  // (if any) since one PF cycle is over:
274  mapPDF.m_particles.begin();
275  it != mapPDF.m_particles.end(); ++it)
276  it->d->mapTillNow.auxParticleFilterCleanUp();
277 
278  MRPT_END;
279 }
280 
281 MRPT_TODO(
282  "Split initialize() in two, one generic without pose, one with "
283  "particles-based PDF");
284 
285 /*---------------------------------------------------------------
286  initialize
287  ---------------------------------------------------------------*/
289  const CSimpleMap& initialMap, const CPosePDF* x0)
290 {
292  "[initialize] Called with " << initialMap.size()
293  << " nodes in fixed map");
294 
295  this->clear();
296 
297  std::lock_guard<std::mutex> csl(
298  critZoneChangingMap); // Enter critical section (updating map)
299 
300  mrpt::poses::CPose3D curPose;
301  if (x0)
302  {
303  curPose = mrpt::poses::CPose3D(x0->getMeanVal());
304  }
305  else if (!initialMap.empty())
306  {
307  // get pose of last keyframe:
308  curPose = initialMap.rbegin()->first->getMeanVal();
309  }
310  MRPT_LOG_INFO_STREAM("[initialize] Initial pose: " << curPose);
311 
312  // Clear maps for each particle & set pose:
313  mapPDF.clear(initialMap, curPose);
314 }
315 
316 /*---------------------------------------------------------------
317  getCurrentPoseEstimation
318  ---------------------------------------------------------------*/
320 {
321  CPose3DPDFParticles::Ptr posePDF =
322  mrpt::make_aligned_shared<CPose3DPDFParticles>();
323  mapPDF.getEstimatedPosePDF(*posePDF);
324 
325  // Adds additional increment from accumulated odometry since last
326  // localization update:
327  for (auto& p : posePDF->m_particles)
328  {
329  p.d.composePose(
331  }
332  return posePDF;
333 }
334 
335 /*---------------------------------------------------------------
336  getCurrentMostLikelyPath
337  ---------------------------------------------------------------*/
339  std::deque<TPose3D>& outPath) const
340 {
341  double maxW = -1, w;
342  size_t mostLik = 0;
343  for (size_t i = 0; i < mapPDF.particlesCount(); i++)
344  {
345  w = mapPDF.getW(i);
346  if (w > maxW)
347  {
348  maxW = w;
349  mostLik = i;
350  }
351  }
352 
353  mapPDF.getPath(mostLik, outPath);
354 }
355 
356 /*---------------------------------------------------------------
357  getCurrentlyBuiltMap
358  ---------------------------------------------------------------*/
360 {
361  const_cast<CMetricMapBuilderRBPF*>(this)
363  out_map = mapPDF.SFs;
364 }
365 
367 {
369 }
370 
371 /*---------------------------------------------------------------
372  getCurrentlyBuiltMapSize
373  ---------------------------------------------------------------*/
375 {
376  return mapPDF.SFs.size();
377 }
378 
380 {
381  using mrpt::round;
382 
383  unsigned int i, M = mapPDF.particlesCount();
384  std::deque<TPose3D> path;
385  unsigned int imgHeight = 0;
386 
387  MRPT_START
388 
389  const mrpt::maps::CMultiMetricMap* currentMetricMapEstimation =
391 
392  ASSERT_(currentMetricMapEstimation->m_gridMaps.size() > 0);
393 
394  // Find which is the most likely path index:
395  unsigned int bestPath = 0;
396  double bestPathLik = -1;
397  for (i = 0; i < M; i++)
398  {
399  if (mapPDF.getW(i) > bestPathLik)
400  {
401  bestPathLik = mapPDF.getW(i);
402  bestPath = i;
403  }
404  }
405 
406  // Compute the length of the paths:
407  mapPDF.getPath(0, path);
408 
409  // Adapt the canvas size:
410  bool alreadyCopiedImage = false;
411  {
412  CImage* obj = dynamic_cast<CImage*>(img);
413  if (obj)
414  obj->resize(
415  currentMetricMapEstimation->m_gridMaps[0]->getSizeX(),
416  currentMetricMapEstimation->m_gridMaps[0]->getSizeY(), 1, true);
417  }
418  if (!alreadyCopiedImage)
419  {
420  CImage imgGrid;
421 
422  // grid map as bitmap:
423  // ----------------------------------
424  currentMetricMapEstimation->m_gridMaps[0]->getAsImage(imgGrid);
425 
426  img->drawImage(0, 0, imgGrid);
427  imgHeight = imgGrid.getHeight();
428  }
429 
430  int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
431  float x_min = currentMetricMapEstimation->m_gridMaps[0]->getXMin();
432  float y_min = currentMetricMapEstimation->m_gridMaps[0]->getYMin();
433  float resolution =
434  currentMetricMapEstimation->m_gridMaps[0]->getResolution();
435 
436  // Paths hypothesis:
437  // ----------------------------------
438  /***/
439  for (i = 0; i <= M; i++)
440  {
441  if (i != bestPath || i == M)
442  {
443  mapPDF.getPath(i == M ? bestPath : i, path);
444 
445  size_t nPoses = path.size();
446 
447  // First point: (0,0)
448  x2 = round((path[0].x - x_min) / resolution);
449  y2 = round((path[0].y - y_min) / resolution);
450 
451  // Draw path in the bitmap:
452  for (size_t j = 0; j < nPoses; j++)
453  {
454  // For next segment
455  x1 = x2;
456  y1 = y2;
457 
458  // Coordinates -> pixels
459  x2 = round((path[j].x - x_min) / resolution);
460  y2 = round((path[j].y - y_min) / resolution);
461 
462  // Draw line:
463  img->line(
464  x1, round((imgHeight - 1) - y1), x2,
465  round((imgHeight - 1) - y2),
466  i == M ? TColor(0, 0, 0)
467  : TColor(0x50, 0x50, 0x50), // Color, gray levels,
468  i == M ? 3 : 1 // Line width
469  );
470  }
471  }
472  }
473 
474  MRPT_END
475 }
476 
477 /*---------------------------------------------------------------
478  saveCurrentEstimationToImage
479  ---------------------------------------------------------------*/
481  const std::string& file, bool formatEMF_BMP)
482 {
483  MRPT_START
484 
485  if (formatEMF_BMP)
486  {
487  // Draw paths (using vectorial plots!) over the EMF file:
488  // --------------------------------------------------------
489  CEnhancedMetaFile EMF(file, 100 /* Scale */);
491  }
492  else
493  {
494  CImage img(1, 1, CH_GRAY);
496  img.saveToFile(file);
497  }
498 
499  MRPT_END
500 }
501 
502 /*---------------------------------------------------------------
503  getCurrentJointEntropy
504  ---------------------------------------------------------------*/
506 {
508 }
509 
510 /*---------------------------------------------------------------
511  saveCurrentPathEstimationToTextFile
512  ---------------------------------------------------------------*/
514  const std::string& fil)
515 {
517 }
518 
519 /*---------------------------------------------------------------
520  TConstructionOptions
521  ---------------------------------------------------------------*/
523  : insertionLinDistance(1.0f),
524  insertionAngDistance(DEG2RAD(30)),
525  localizeLinDistance(0.4f),
526  localizeAngDistance(DEG2RAD(10)),
527  PF_options(),
528  mapsInitializers(),
529  predictionOptions(),
530  verbosity_level(mrpt::system::LVL_INFO)
531 {
532 }
533 
534 /*---------------------------------------------------------------
535  dumpToTextStream
536  ---------------------------------------------------------------*/
538  std::ostream& out) const
539 {
540  out << mrpt::format(
541  "\n----------- [CMetricMapBuilderRBPF::TConstructionOptions] "
542  "------------ \n\n");
543 
544  out << mrpt::format(
545  "insertionLinDistance = %f m\n",
547  out << mrpt::format(
548  "insertionAngDistance = %f deg\n",
550  out << mrpt::format(
551  "localizeLinDistance = %f m\n",
553  out << mrpt::format(
554  "localizeAngDistance = %f deg\n",
556  out << mrpt::format(
557  "verbosity_level = %s\n",
559  verbosity_level)
560  .c_str());
561 
562  PF_options.dumpToTextStream(out);
563 
564  out << mrpt::format(
565  " Now showing 'mapsInitializers' and 'predictionOptions':\n");
566  out << mrpt::format("\n");
567 
568  mapsInitializers.dumpToTextStream(out);
569  predictionOptions.dumpToTextStream(out);
570 }
571 
572 /*---------------------------------------------------------------
573  loadFromConfigFile
574  ---------------------------------------------------------------*/
576  const mrpt::config::CConfigFileBase& iniFile, const std::string& section)
577 {
578  MRPT_START
579 
580  PF_options.loadFromConfigFile(iniFile, section);
581 
584  insertionAngDistance_deg, double, insertionAngDistance, iniFile,
585  section);
586 
589  localizeAngDistance_deg, double, localizeAngDistance, iniFile, section);
590  verbosity_level = iniFile.read_enum<mrpt::system::VerbosityLevel>(
591  section, "verbosity_level", verbosity_level);
592 
593  mapsInitializers.loadFromConfigFile(iniFile, section);
594  predictionOptions.loadFromConfigFile(iniFile, section);
595 
596  MRPT_END
597 }
mrpt::maps::CMultiMetricMapPDF::insertObservation
bool insertObservation(mrpt::obs::CSensoryFrame &sf)
Insert an observation to the map, at each particle's pose and to each particle's metric map.
Definition: CMultiMetricMapPDF.cpp:408
mrpt::img::CImage::resize
void resize(unsigned int width, unsigned int height, TImageChannels nChannels, bool originTopLeft)
Changes the size of the image, erasing previous contents (does NOT scale its current content,...
Definition: img/CImage.h:261
mrpt::maps::CSimpleMap::empty
bool empty() const
Returns size()!=0.
Definition: CSimpleMap.cpp:54
mrpt::system::COutputLogger::isLoggingLevelVisible
bool isLoggingLevelVisible(VerbosityLevel level) const
Definition: system/COutputLogger.h:201
mrpt::slam::CMetricMapBuilder::options
TOptions options
Definition: CMetricMapBuilder.h:143
mrpt::poses::CPose3DPDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
Definition: CPose3DPDFGaussian.h:40
mrpt::slam::CMetricMapBuilderRBPF::odoIncrementSinceLastMapUpdate
mrpt::poses::CPose3D odoIncrementSinceLastMapUpdate
Traveled distance since last map update.
Definition: CMetricMapBuilderRBPF.h:79
mrpt::bayes::CParticleFilter::executeOn
void executeOn(CParticleFilterCapable &obj, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, TParticleFilterStats *stats=nullptr)
Executes a complete prediction + update step of the selected particle filtering algorithm.
Definition: CParticleFilter.cpp:45
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMetricMap
const mrpt::maps::CMultiMetricMap * getCurrentlyBuiltMetricMap() const
Returns the map built so far.
Definition: CMetricMapBuilderRBPF.cpp:366
mrpt::maps::CMultiMetricMapPDF::saveCurrentPathEstimationToTextFile
void saveCurrentPathEstimationToTextFile(const std::string &fil)
A logging utility: saves the current path estimation for each particle in a text file (a row per part...
Definition: CMultiMetricMapPDF.cpp:579
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: CMetricMapBuilderRBPF.cpp:575
mrpt::slam::CMetricMapBuilderRBPF::m_PF_options
bayes::CParticleFilter::TParticleFilterOptions m_PF_options
The configuration of the particle filter.
Definition: CMetricMapBuilderRBPF.h:66
mrpt::slam::CMetricMapBuilderRBPF::getCurrentMostLikelyPath
void getCurrentMostLikelyPath(std::deque< mrpt::math::TPose3D > &outPath) const
Returns the current most-likely path estimation (the path associated to the most likely particle).
Definition: CMetricMapBuilderRBPF.cpp:338
MRPT_LOG_INFO
#define MRPT_LOG_INFO(_STRING)
Definition: system/COutputLogger.h:429
mrpt::slam::CMetricMapBuilderRBPF::TStats::observationsInserted
bool observationsInserted
Whether the SF has been inserted in the metric maps.
Definition: CMetricMapBuilderRBPF.h:200
mrpt::system::COutputLogger::setVerbosityLevel
void setVerbosityLevel(const VerbosityLevel level)
alias of setMinLoggingLevel()
Definition: COutputLogger.cpp:138
MRPT_LOAD_CONFIG_VAR
#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...
Definition: config/CConfigFileBase.h:282
MRPT_LOG_DEBUG
#define MRPT_LOG_DEBUG(_STRING)
Use: MRPT_LOG_DEBUG("message");
Definition: system/COutputLogger.h:427
src
GLuint src
Definition: glext.h:7278
mrpt::obs::CActionCollection::getActionByClass
T::Ptr getActionByClass(const size_t &ith=0) const
Access to the i'th action of a given class, or a nullptr smart pointer if there is no action of that ...
Definition: CActionCollection.h:131
CMetricMapBuilderRBPF.h
mrpt::bayes::CParticleFilter::m_options
CParticleFilter::TParticleFilterOptions m_options
The options to be used in the PF, must be set before executing any step of the particle filter.
Definition: CParticleFilter.h:209
mrpt::slam::CMetricMapBuilderRBPF::processActionObservation
void processActionObservation(mrpt::obs::CActionCollection &action, mrpt::obs::CSensoryFrame &observations)
Appends a new action and observations to update this map: See the description of the class at the top...
Definition: CMetricMapBuilderRBPF.cpp:105
mrpt::bayes::CParticleFilterDataImpl::getW
double getW(size_t i) const override
Access to i'th particle (logarithm) weight, where first one is index 0.
Definition: CParticleFilterData.h:42
mrpt::maps::CMultiMetricMapPDF::clear
void clear(const mrpt::poses::CPose2D &initialPose)
Clear all elements of the maps, and restore all paths to a single starting pose.
Definition: CMultiMetricMapPDF.cpp:75
mrpt::poses::CPose3DPDFParticles::Ptr
std::shared_ptr< CPose3DPDFParticles > Ptr
Definition: CPose3DPDFParticles.h:41
mrpt::poses::CPose3D::setFromValues
void setFromValues(const double x0, const double y0, const double z0, const double yaw=0, const double pitch=0, const double roll=0)
Set the pose from a 3D position (meters) and yaw/pitch/roll angles (radians) - This method recomputes...
Definition: CPose3D.cpp:239
mrpt::bayes::CParticleFilter
This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilt...
Definition: CParticleFilter.h:51
mrpt::maps::CMultiMetricMapPDF::getPath
void getPath(size_t i, std::deque< math::TPose3D > &out_path) const
Return the path (in absolute coordinate poses) for the i'th particle.
Definition: CMultiMetricMapPDF.cpp:441
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::maps::CMultiMetricMapPDF::getCurrentMostLikelyMetricMap
const CMultiMetricMap * getCurrentMostLikelyMetricMap() const
Returns a pointer to the current most likely map (associated to the most likely particle)
Definition: CMultiMetricMapPDF.cpp:533
mrpt::obs::CActionRobotMovement3D
Represents a probabilistic 3D (6D) movement.
Definition: CActionRobotMovement3D.h:29
CEnhancedMetaFile.h
mrpt::slam::CMetricMapBuilder::TOptions::debugForceInsertion
bool debugForceInsertion
Always insert into map.
Definition: CMetricMapBuilder.h:129
mrpt::slam::CMetricMapBuilderRBPF
This class implements a Rao-Blackwelized Particle Filter (RBPF) approach to map building (SLAM).
Definition: CMetricMapBuilderRBPF.h:58
mrpt::maps::CSimpleMap::rbegin
const_reverse_iterator rbegin() const
Definition: CSimpleMap.h:192
MRPT_TODO
MRPT_TODO("Split initialize() in two, one generic without pose, one with " "particles-based PDF")
mrpt::math::CProbabilityDensityFunction::getMeanVal
TDATA getMeanVal() const
Returns the mean, or mathematical expectation of the probability density distribution (PDF).
Definition: CProbabilityDensityFunction.h:69
mrpt::obs::CActionCollection
Declares a class for storing a collection of robot actions.
Definition: CActionCollection.h:28
mrpt::poses::CPoseOrPoint::norm
double norm() const
Returns the euclidean norm of vector: .
Definition: CPoseOrPoint.h:253
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
w
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
mrpt::img::CEnhancedMetaFile
This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics.
Definition: CEnhancedMetaFile.h:24
mrpt::system::LVL_INFO
@ LVL_INFO
Definition: system/COutputLogger.h:31
mrpt::obs::CActionRobotMovement2D
Represents a probabilistic 2D movement of the robot mobile base.
Definition: CActionRobotMovement2D.h:32
ASSERT_
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
p
GLfloat GLfloat p
Definition: glext.h:6305
MRPT_LOG_WARN_STREAM
#define MRPT_LOG_WARN_STREAM(__CONTENTS)
Definition: system/COutputLogger.h:475
mrpt::obs::CActionRobotMovement2D::Ptr
std::shared_ptr< CActionRobotMovement2D > Ptr
Definition: CActionRobotMovement2D.h:34
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:25
mrpt::RAD2DEG
double RAD2DEG(const double x)
Radians to degrees.
Definition: core/include/mrpt/core/bits_math.h:48
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::verbosity_level
mrpt::system::VerbosityLevel verbosity_level
Definition: CMetricMapBuilderRBPF.h:106
mrpt::slam::CMetricMapBuilderRBPF::saveCurrentPathEstimationToTextFile
void saveCurrentPathEstimationToTextFile(const std::string &fil)
A logging utility: saves the current path estimation for each particle in a text file (a row per part...
Definition: CMetricMapBuilderRBPF.cpp:513
mrpt::math::cov
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample,...
Definition: ops_matrices.h:148
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::TConstructionOptions
TConstructionOptions()
Constructor.
Definition: CMetricMapBuilderRBPF.cpp:522
mrpt::slam::CMetricMapBuilderRBPF::CMetricMapBuilderRBPF
CMetricMapBuilderRBPF()
This second constructor is created for the situation where a class member needs to be of type CMetric...
Definition: CMetricMapBuilderRBPF.cpp:50
CObservationStereoImages.h
mrpt::maps::CMultiMetricMapPDF::SFs
mrpt::maps::CSimpleMap SFs
The SFs and their corresponding pose estimations.
Definition: CMultiMetricMapPDF.h:101
mrpt::slam::CMetricMapBuilderRBPF::m_statsLastIteration
TStats m_statsLastIteration
This structure will hold stats after each execution of processActionObservation.
Definition: CMetricMapBuilderRBPF.h:205
mrpt::poses::CPose3DPDFParticles::getCovarianceAndMean
void getCovarianceAndMean(mrpt::math::CMatrixDouble66 &cov, CPose3D &mean_point) const override
Returns an estimate of the pose covariance matrix (6x6 cov matrix) and the mean, both at once.
Definition: CPose3DPDFParticles.cpp:69
mrpt::slam::CMetricMapBuilderRBPF::saveCurrentEstimationToImage
void saveCurrentEstimationToImage(const std::string &file, bool formatEMF_BMP=true)
A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
Definition: CMetricMapBuilderRBPF.cpp:480
mrpt::obs::CSensoryFrame
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:54
mrpt::img
Definition: CCanvas.h:17
mrpt::img::CCanvas
This virtual class defines the interface of any object accepting drawing primitives on it.
Definition: CCanvas.h:42
mrpt::system::VerbosityLevel
VerbosityLevel
Enumeration of available verbosity levels.
Definition: system/COutputLogger.h:28
mrpt::round
int round(const T value)
Returns the closer integer (int) to x.
Definition: round.h:23
mrpt::bayes::CParticleFilterDataImpl::particlesCount
size_t particlesCount() const override
Get the m_particles count.
Definition: CParticleFilterData.h:56
MRPT_START
#define MRPT_START
Definition: exceptions.h:262
mrpt::slam::CMetricMapBuilderRBPF::odoIncrementSinceLastLocalization
mrpt::poses::CPose3DPDFGaussian odoIncrementSinceLastLocalization
Traveled distance since last localization update.
Definition: CMetricMapBuilderRBPF.h:77
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMapSize
unsigned int getCurrentlyBuiltMapSize()
Returns just how many sensory-frames are stored in the currently build map.
Definition: CMetricMapBuilderRBPF.cpp:374
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:40
mrpt::maps::CMultiMetricMap
This class stores any customizable set of metric maps.
Definition: CMultiMetricMap.h:141
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::poses::CPose3D::asTPose
mrpt::math::TPose3D asTPose() const
Definition: CPose3D.cpp:1046
CActionRobotMovement3D.h
iniFile
string iniFile(myDataDir+string("benchmark-options.ini"))
mrpt::maps::CMultiMetricMapPDF::getCurrentJointEntropy
double getCurrentJointEntropy()
Returns the joint entropy estimation over paths and maps, acording to "Information Gain-based Explora...
Definition: CMultiMetricMapPDF.cpp:481
mrpt::typemeta::TEnumType
A helper class that can convert an enum value into its textual representation, and viceversa.
Definition: config/CConfigFileBase.h:24
mrpt::maps::CSimpleMap::size
size_t size() const
Returns the count of pairs (pose,sensory data)
Definition: CSimpleMap.cpp:53
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::maps::CMultiMetricMapPDF::getEstimatedPosePDF
void getEstimatedPosePDF(mrpt::poses::CPose3DPDFParticles &out_estimation) const
Returns the current estimate of the robot pose, as a particles PDF.
Definition: CMultiMetricMapPDF.cpp:171
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CMetricMapBuilderRBPF.cpp:537
mrpt::slam::CMetricMapBuilderRBPF::getCurrentJointEntropy
double getCurrentJointEntropy()
Definition: CMetricMapBuilderRBPF.cpp:505
mrpt::slam::CMetricMapBuilderRBPF::initialize
void initialize(const mrpt::maps::CSimpleMap &initialMap=mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF *x0=nullptr)
Initialize the method, starting with a known location PDF "x0"(if supplied, set to nullptr to left un...
Definition: CMetricMapBuilderRBPF.cpp:288
mrpt::obs::CActionRobotMovement3D::estimationMethod
TEstimationMethod estimationMethod
This fields indicates the way this estimation was obtained.
Definition: CActionRobotMovement3D.h:56
MRPT_LOAD_HERE_CONFIG_VAR_DEGREES_NO_DEFAULT
#define MRPT_LOAD_HERE_CONFIG_VAR_DEGREES_NO_DEFAULT( variableName, variableType, targetVariable, configFileObject, sectionNameStr)
Definition: config/CConfigFileBase.h:357
mrpt::poses::CPose3DPDFParticles
Declares a class that represents a Probability Density function (PDF) of a 3D pose.
Definition: CPose3DPDFParticles.h:31
mrpt::slam::CMetricMapBuilderRBPF::localizeLinDistance
float localizeLinDistance
Distances (linear and angular) for updating the robot pose estimate (and particles weighs,...
Definition: CMetricMapBuilderRBPF.h:74
utils.h
mrpt::math::CMatrixFixedNumeric
A numeric matrix of compile-time fixed size.
Definition: CMatrixFixedNumeric.h:40
MRPT_LOG_WARN
#define MRPT_LOG_WARN(_STRING)
Definition: system/COutputLogger.h:431
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
mrpt::slam::CMetricMapBuilderRBPF::getCurrentPoseEstimation
mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const
Returns a copy of the current best pose estimation as a pose PDF.
Definition: CMetricMapBuilderRBPF.cpp:319
mrpt::rtti::CListOfClasses::data
TSet data
Definition: CListOfClasses.h:28
mrpt::slam::CMetricMapBuilderRBPF::insertionLinDistance
float insertionLinDistance
Distances (linear and angular) for inserting a new observation into the map.
Definition: CMetricMapBuilderRBPF.h:70
mrpt::poses::CPosePDF
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:41
mrpt::slam::CMetricMapBuilderRBPF::getCurrentlyBuiltMap
void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap &out_map) const
Fills "out_map" with the set of "poses"-"sensory-frames", thus the so far built map.
Definition: CMetricMapBuilderRBPF.cpp:359
mrpt::obs::CActionRobotMovement3D::poseChange
mrpt::poses::CPose3DPDFGaussian poseChange
The 3D pose change probabilistic estimation.
Definition: CActionRobotMovement3D.h:49
mrpt::img::CCanvas::drawImage
virtual void drawImage(int x, int y, const mrpt::img::CImage &img)
Draws an image as a bitmap at a given position.
Definition: CCanvas.cpp:254
MRPT_LOG_DEBUG_STREAM
#define MRPT_LOG_DEBUG_STREAM(__CONTENTS)
Use: MRPT_LOG_DEBUG_STREAM("Var=" << value << " foo=" << foo_var);
Definition: system/COutputLogger.h:471
mrpt::bayes::CParticleFilterData::m_particles
CParticleList m_particles
The array of particles.
Definition: CParticleFilterData.h:218
mrpt::slam::CMetricMapBuilderRBPF::drawCurrentEstimationToImage
void drawCurrentEstimationToImage(mrpt::img::CCanvas *img)
A useful method for debugging: draws the current map and path hypotheses to a CCanvas
Definition: CMetricMapBuilderRBPF.cpp:379
mrpt::img::CImage::getHeight
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:892
img
GLint GLvoid * img
Definition: glext.h:3763
slam-precomp.h
mrpt::bayes
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
Definition: CKalmanFilterCapable.h:32
mrpt::poses::CPose3D::yaw
double yaw() const
Get the YAW angle (in radians)
Definition: CPose3D.h:528
MRPT_END
#define MRPT_END
Definition: exceptions.h:266
mrpt::obs::CActionCollection::insert
void insert(CAction &action)
Add a new object to the list.
Definition: CActionCollection.cpp:85
mrpt::slam::CMetricMapBuilder::critZoneChangingMap
std::mutex critZoneChangingMap
Critical zones.
Definition: CMetricMapBuilder.h:39
mrpt::obs::CActionRobotMovement3D::Ptr
std::shared_ptr< CActionRobotMovement3D > Ptr
Definition: CActionRobotMovement3D.h:31
mrpt::maps::CSimpleMap
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Definition: CSimpleMap.h:35
mrpt::slam::CMetricMapBuilderRBPF::localizeAngDistance
float localizeAngDistance
Definition: CMetricMapBuilderRBPF.h:74
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:13
mrpt::poses::CPose3DPDF::Ptr
std::shared_ptr< CPose3DPDF > Ptr
Definition: CPose3DPDF.h:45
mrpt::poses::CPose3DPDFGaussian::cov
mrpt::math::CMatrixDouble66 cov
The 6x6 covariance matrix.
Definition: CPose3DPDFGaussian.h:83
mrpt::poses::CPose3DPDFParticles::getMean
void getMean(CPose3D &mean_pose) const override
Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF),...
Definition: CPose3DPDFParticles.cpp:51
MRPT_LOG_INFO_STREAM
#define MRPT_LOG_INFO_STREAM(__CONTENTS)
Definition: system/COutputLogger.h:473
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::slam::CMetricMapBuilderRBPF::clear
void clear()
Clear all elements of the maps.
Definition: CMetricMapBuilderRBPF.cpp:85
mrpt::system::COutputLogger::getMinLoggingLevel
VerbosityLevel getMinLoggingLevel() const
Definition: system/COutputLogger.h:200
mrpt::maps
Definition: CBeacon.h:24
iterator
Scalar * iterator
Definition: eigen_plugins.h:26
mrpt::obs::CActionRobotMovement2D::computeFromOdometry
void computeFromOdometry(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &options)
Computes the PDF of the pose increment from an odometry reading and according to the given motion mod...
Definition: CActionRobotMovement2D.cpp:381
mrpt::maps::CMultiMetricMapPDF::updateSensoryFrameSequence
void updateSensoryFrameSequence()
Update the poses estimation of the member "SFs" according to the current path belief.
Definition: CMultiMetricMapPDF.cpp:554
mrpt::slam::CMetricMapBuilderRBPF::TConstructionOptions
Options for building a CMetricMapBuilderRBPF object, passed to the constructor.
Definition: CMetricMapBuilderRBPF.h:85
mrpt::system::COutputLogger::setLoggerName
void setLoggerName(const std::string &name)
Set the name of the COutputLogger instance.
Definition: COutputLogger.cpp:127
mrpt::obs::CAction::timestamp
mrpt::system::TTimeStamp timestamp
The associated time-stamp.
Definition: CAction.h:36
mrpt::slam::CMetricMapBuilderRBPF::~CMetricMapBuilderRBPF
virtual ~CMetricMapBuilderRBPF()
Destructor.
Definition: CMetricMapBuilderRBPF.cpp:81
mrpt::slam
Definition: CMultiMetricMapPDF.h:27
mrpt::slam::CMetricMapBuilderRBPF::insertionAngDistance
float insertionAngDistance
Definition: CMetricMapBuilderRBPF.h:70
mrpt::slam::CMetricMapBuilderRBPF::mapPDF
mrpt::maps::CMultiMetricMapPDF mapPDF
The map PDF: It includes a path and associated map for each particle.
Definition: CMetricMapBuilderRBPF.h:62
CH_GRAY
#define CH_GRAY
Definition: img/CImage.h:44
mrpt::poses::CPose3DPDFGaussian::mean
CPose3D mean
The mean value.
Definition: CPose3DPDFGaussian.h:79
mrpt::bayes::CParticleFilterDataImpl::ESS
double ESS() const override
Returns the normalized ESS (Estimated Sample Size), in the range [0,1].
Definition: CParticleFilterData.h:88
y
GLenum GLint GLint y
Definition: glext.h:3538
x
GLenum GLint x
Definition: glext.h:3538
mrpt::slam::CMetricMapBuilderRBPF::operator=
CMetricMapBuilderRBPF & operator=(const CMetricMapBuilderRBPF &src)
Copy Operator.
Definition: CMetricMapBuilderRBPF.cpp:59
mrpt::slam::CMetricMapBuilder::TOptions::alwaysInsertByClass
mrpt::rtti::CListOfClasses alwaysInsertByClass
A list of observation classes (derived from mrpt::obs::CObservation) which will be always inserted in...
Definition: CMetricMapBuilder.h:140
mrpt::DEG2RAD
double DEG2RAD(const double x)
Degrees to radians.
Definition: core/include/mrpt/core/bits_math.h:42



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST