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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019