Main MRPT website > C++ reference for MRPT 1.9.9
CBeacon.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 "maps-precomp.h" // Precomp header
11 
12 #include <mrpt/maps/CBeacon.h>
13 #include <mrpt/maps/CBeaconMap.h>
14 #include <mrpt/obs/CObservation.h>
15 #include <mrpt/utils/CStream.h>
16 
17 #include <mrpt/system/os.h>
18 #include <mrpt/math/geometry.h>
20 #include <mrpt/opengl/CEllipsoid.h>
22 #include <mrpt/opengl/CText.h>
23 
24 using namespace mrpt;
25 using namespace mrpt::maps;
26 using namespace mrpt::obs;
27 using namespace mrpt::math;
28 using namespace mrpt::system;
29 using namespace mrpt::poses;
30 using namespace mrpt::utils;
31 using namespace std;
32 
34 
35 /*---------------------------------------------------------------
36  Default constructor
37  ---------------------------------------------------------------*/
39  : m_typePDF(pdfGauss),
40  m_locationMC(1),
41  m_locationGauss(),
42  m_locationSOG(1),
43  m_ID(INVALID_BEACON_ID)
44 {
45 }
46 
47 /*---------------------------------------------------------------
48  Destructor
49  ---------------------------------------------------------------*/
51 /*---------------------------------------------------------------
52  writeToStream
53  Implements the writing to a CStream capability of
54  CSerializable objects
55  ---------------------------------------------------------------*/
56 void CBeacon::writeToStream(mrpt::utils::CStream& out, int* version) const
57 {
58  if (version)
59  *version = 0;
60  else
61  {
62  uint32_t i = m_ID;
63  uint32_t j = m_typePDF;
64  out << i << j << m_locationMC << m_locationGauss << m_locationSOG;
65  }
66 }
67 
68 /*---------------------------------------------------------------
69  readFromStream
70  Implements the reading from a CStream capability of
71  CSerializable objects
72  ---------------------------------------------------------------*/
74 {
75  switch (version)
76  {
77  case 0:
78  {
79  uint32_t i, j;
80  in >> i >> j >> m_locationMC >> m_locationGauss >> m_locationSOG;
81  m_ID = i;
82  m_typePDF = static_cast<TTypePDF>(j);
83  }
84  break;
85  default:
87  };
88 }
89 
90 /*---------------------------------------------------------------
91  getMean
92  ---------------------------------------------------------------*/
94 {
96  switch (m_typePDF)
97  {
98  case pdfMonteCarlo:
99  m_locationMC.getMean(p);
100  break;
101  case pdfGauss:
102  m_locationGauss.getMean(p);
103  break;
104  case pdfSOG:
105  m_locationSOG.getMean(p);
106  break;
107  default:
108  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
109  };
110  MRPT_END
111 }
112 
113 /*---------------------------------------------------------------
114  getCovarianceAndMean
115  ---------------------------------------------------------------*/
117 {
118  MRPT_START
119  switch (m_typePDF)
120  {
121  case pdfMonteCarlo:
122  m_locationMC.getCovarianceAndMean(COV, p);
123  break;
124  case pdfGauss:
125  m_locationGauss.getCovarianceAndMean(COV, p);
126  break;
127  case pdfSOG:
128  m_locationSOG.getCovarianceAndMean(COV, p);
129  break;
130  default:
131  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
132  };
133  MRPT_END
134 }
135 
136 /*---------------------------------------------------------------
137  bayesianFusion
138  ---------------------------------------------------------------*/
140  const CPointPDF& p1, const CPointPDF& p2,
141  const double& minMahalanobisDistToDrop)
142 {
143  MRPT_START
144  switch (m_typePDF)
145  {
146  case pdfMonteCarlo:
147  m_locationMC.bayesianFusion(p1, p2, minMahalanobisDistToDrop);
148  break;
149  case pdfGauss:
150  m_locationGauss.bayesianFusion(p1, p2, minMahalanobisDistToDrop);
151  break;
152  case pdfSOG:
153  m_locationSOG.bayesianFusion(p1, p2, minMahalanobisDistToDrop);
154  break;
155  default:
156  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
157  };
158  MRPT_END
159 }
160 
161 /*---------------------------------------------------------------
162  drawSingleSample
163  ---------------------------------------------------------------*/
164 void CBeacon::drawSingleSample(CPoint3D& outSample) const
165 {
166  MRPT_START
167  switch (m_typePDF)
168  {
169  case pdfMonteCarlo:
170  m_locationMC.drawSingleSample(outSample);
171  break;
172  case pdfGauss:
173  m_locationGauss.drawSingleSample(outSample);
174  break;
175  case pdfSOG:
176  m_locationSOG.drawSingleSample(outSample);
177  break;
178  default:
179  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
180  };
181  MRPT_END
182 }
183 
184 /*---------------------------------------------------------------
185  copyFrom
186  ---------------------------------------------------------------*/
188 {
189  MRPT_START
190  switch (m_typePDF)
191  {
192  case pdfMonteCarlo:
193  m_locationMC.copyFrom(o);
194  break;
195  case pdfGauss:
196  m_locationGauss.copyFrom(o);
197  break;
198  case pdfSOG:
199  m_locationSOG.copyFrom(o);
200  break;
201  default:
202  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
203  };
204  MRPT_END
205 }
206 
207 /*---------------------------------------------------------------
208  saveToTextFile
209  ---------------------------------------------------------------*/
210 void CBeacon::saveToTextFile(const std::string& file) const
211 {
212  MRPT_START
213  switch (m_typePDF)
214  {
215  case pdfMonteCarlo:
216  m_locationMC.saveToTextFile(file);
217  break;
218  case pdfGauss:
219  m_locationGauss.saveToTextFile(file);
220  break;
221  case pdfSOG:
222  m_locationSOG.saveToTextFile(file);
223  break;
224  default:
225  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
226  };
227  MRPT_END
228 }
229 
230 /*---------------------------------------------------------------
231  changeCoordinatesReference
232  ---------------------------------------------------------------*/
233 void CBeacon::changeCoordinatesReference(const CPose3D& newReferenceBase)
234 {
235  MRPT_START
236  switch (m_typePDF)
237  {
238  case pdfMonteCarlo:
239  m_locationMC.changeCoordinatesReference(newReferenceBase);
240  break;
241  case pdfGauss:
242  m_locationGauss.changeCoordinatesReference(newReferenceBase);
243  break;
244  case pdfSOG:
245  m_locationSOG.changeCoordinatesReference(newReferenceBase);
246  break;
247  default:
248  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
249  };
250  MRPT_END
251 }
252 
253 /*---------------------------------------------------------------
254  getAs3DObject
255  ---------------------------------------------------------------*/
257 {
258  MRPT_START
259 
260  switch (m_typePDF)
261  {
262  case pdfMonteCarlo:
263  {
265  mrpt::make_aligned_shared<opengl::CPointCloud>();
266  obj->setColor(1, 0, 0);
267 
268  obj->setPointSize(2.5);
269 
270  const size_t N = m_locationMC.m_particles.size();
271  obj->resize(N);
272 
273  for (size_t i = 0; i < N; i++)
274  obj->setPoint(
275  i, m_locationMC.m_particles[i].d->x,
276  m_locationMC.m_particles[i].d->y,
277  m_locationMC.m_particles[i].d->z);
278 
279  outObj->insert(obj);
280  }
281  break;
282  case pdfGauss:
283  {
285  mrpt::make_aligned_shared<opengl::CEllipsoid>();
286 
287  obj->setPose(m_locationGauss.mean);
288  obj->setLineWidth(3);
289 
290  CMatrixDouble C = CMatrixDouble(m_locationGauss.cov);
291  if (C(2, 2) == 0) C.setSize(2, 2);
292  obj->setCovMatrix(C);
293 
294  obj->setQuantiles(3);
295  obj->enableDrawSolid3D(false);
296 
297  obj->setColor(1, 0, 0, 0.85);
298  outObj->insert(obj);
299  }
300  break;
301  case pdfSOG:
302  {
303  m_locationSOG.getAs3DObject(outObj);
304  }
305  break;
306  default:
307  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
308  };
309 
310  opengl::CText::Ptr obj2 = mrpt::make_aligned_shared<opengl::CText>();
311  obj2->setString(format("#%d", static_cast<int>(m_ID)));
312 
313  CPoint3D meanP;
314  this->getMean(meanP);
315  obj2->setLocation(meanP.x() + 0.10, meanP.y() + 0.10, meanP.z());
316  outObj->insert(obj2);
317 
318  MRPT_END
319 }
320 
321 /*---------------------------------------------------------------
322  getAsMatlabDrawCommands
323  ---------------------------------------------------------------*/
325 {
326  MRPT_START
327 
328  out_Str.clear();
329  char auxStr[1000];
330 
331  switch (m_typePDF)
332  {
333  case pdfMonteCarlo:
334  {
335  // xs=[...];
336  // ys=[...];
337  // plot(xs,ys,'.','MarkerSize',4);
338  size_t i, N = m_locationMC.m_particles.size();
339  std::string sx, sy;
340 
341  sx = "xs=[";
342  sy = "ys=[";
343  for (i = 0; i < N; i++)
344  {
345  os::sprintf(
346  auxStr, sizeof(auxStr), "%.3f%c",
347  m_locationMC.m_particles[i].d->x, (i == N - 1) ? ' ' : ',');
348  sx = sx + std::string(auxStr);
349  os::sprintf(
350  auxStr, sizeof(auxStr), "%.3f%c",
351  m_locationMC.m_particles[i].d->y, (i == N - 1) ? ' ' : ',');
352  sy = sy + std::string(auxStr);
353  }
354  sx = sx + "];";
355  sy = sy + "];";
356  out_Str.add(sx);
357  out_Str.add(sy);
358  out_Str.add(std::string("plot(xs,ys,'k.','MarkerSize',4);"));
359  }
360  break;
361  case pdfGauss:
362  {
363  // m=[x y];
364  // C=[2x2]
365  // error_ellipse(C,m,'conf',0.997,'style','k');
366 
367  os::sprintf(
368  auxStr, sizeof(auxStr), "m=[%.3f %.3f];",
369  m_locationGauss.mean.x(), m_locationGauss.mean.y());
370  out_Str.add(std::string(auxStr));
371  os::sprintf(
372  auxStr, sizeof(auxStr), "C=[%e %e;%e %e];",
373  m_locationGauss.cov(0, 0), m_locationGauss.cov(0, 1),
374  m_locationGauss.cov(1, 0), m_locationGauss.cov(1, 1));
375  out_Str.add(std::string(auxStr));
376 
377  out_Str.add(
378  std::string("error_ellipse(C,m,'conf',0.997,'style','k');"));
379  }
380  break;
381  case pdfSOG:
382  {
383  for (CPointPDFSOG::const_iterator it = m_locationSOG.begin();
384  it != m_locationSOG.end(); ++it)
385  {
386  os::sprintf(
387  auxStr, sizeof(auxStr), "m=[%.3f %.3f];",
388  (it)->val.mean.x(), (it)->val.mean.y());
389  out_Str.add(std::string(auxStr));
390  os::sprintf(
391  auxStr, sizeof(auxStr), "C=[%e %e;%e %e];",
392  (it)->val.cov(0, 0), (it)->val.cov(0, 1),
393  (it)->val.cov(1, 0), (it)->val.cov(1, 1));
394  out_Str.add(std::string(auxStr));
395  out_Str.add(
396  std::string(
397  "error_ellipse(C,m,'conf',0.997,'style','k');"));
398  }
399  }
400  break;
401  default:
402  THROW_EXCEPTION("ERROR: Invalid 'm_typePDF' value");
403  };
404 
405  // The text:
406  CPoint3D meanP;
407  getMean(meanP);
408 
409  os::sprintf(
410  auxStr, sizeof(auxStr), "text(%f,%f,'#%i');", meanP.x(), meanP.y(),
411  static_cast<int>(m_ID));
412  out_Str.add(std::string(auxStr));
413 
414  MRPT_END
415 }
416 
417 /*---------------------------------------------------------------
418  generateObservationModelDistribution
419  Compute the observation model p(z_t|x_t) for a given observation (range value),
420 and return it as an approximate SOG.
421 * Note that if the beacon is a SOG itself, the number of gaussian modes will be
422 square.
423 * As a speed-up, if a "center point"+"maxDistanceFromCenter" is supplied
424 (maxDistanceFromCenter!=0), those modes farther than this sphere will be
425 discarded.
426 * Parameters such as the stdSigma of the sensor are gathered from "myBeaconMap"
427 * The result is one "ring" for each Gaussian mode that represent the beacon
428 position in this object.
429 * The position of the sensor on the robot is used to shift the resulting
430 densities such as they represent the position of the robot, not the sensor.
431 * \sa CBeaconMap::insertionOptions, generateRingSOG
432 
433  ---------------------------------------------------------------*/
435  const float& sensedRange, CPointPDFSOG& outPDF,
436  const CBeaconMap* myBeaconMap, const CPoint3D& sensorPntOnRobot,
437  const CPoint3D& centerPoint, const float& maxDistanceFromCenter) const
438 {
439  MRPT_START
440 
441  const CPointPDFSOG* beaconPos = nullptr;
442 
443  if (m_typePDF == pdfGauss)
444  {
445  // Copy the gaussian to the SOG:
446  CPointPDFSOG* new_beaconPos = new CPointPDFSOG(1);
447  new_beaconPos->push_back(CPointPDFSOG::TGaussianMode());
448  new_beaconPos->get(0).log_w = 0;
449  new_beaconPos->get(0).val = m_locationGauss;
450  beaconPos = new_beaconPos;
451  }
452  else
453  {
454  ASSERT_(m_typePDF == pdfSOG)
455  beaconPos = static_cast<const CPointPDFSOG*>(&m_locationSOG);
456  }
457 
458  outPDF.clear();
459 
460  for (CPointPDFSOG::const_iterator it = beaconPos->begin();
461  it != beaconPos->end(); ++it)
462  {
463  // The center of the ring to be generated
464  CPoint3D ringCenter(
465  (it)->val.mean.x() - sensorPntOnRobot.x(),
466  (it)->val.mean.y() - sensorPntOnRobot.y(),
467  (it)->val.mean.z() - sensorPntOnRobot.z());
468 
469  size_t startIdx = outPDF.size();
470 
472  sensedRange, // Sensed range
473  outPDF, // The ouput (Append all !!)
474  myBeaconMap, // For params
475  ringCenter, // The center of the ring to be generated
476  &(it)->val.cov, // The covariance to ADD to each mode, due to the
477  // composition of uncertainty
478  false, // clearPreviousContentsOutPDF
479  centerPoint,
480  maxDistanceFromCenter // Directly, do not create too far modes
481  );
482 
483  // Adjust the weights to the one of "this" mode:
484  for (size_t k = startIdx; k < outPDF.size(); k++)
485  outPDF.get(k).log_w = (it)->log_w;
486  }
487 
488  if (m_typePDF == pdfGauss) delete beaconPos;
489 
490  MRPT_END
491 }
492 
493 /*---------------------------------------------------------------
494  generateRingSOG
495  ---------------------------------------------------------------*/
497  const float& R, CPointPDFSOG& outPDF, const CBeaconMap* myBeaconMap,
498  const CPoint3D& sensorPnt,
499  const CMatrixDouble33* covarianceCompositionToAdd,
500  bool clearPreviousContentsOutPDF, const CPoint3D& centerPoint,
501  const float& maxDistanceFromCenter)
502 {
503  MRPT_START
504 
505  ASSERT_(myBeaconMap)
506 
507  // Compute the number of Gaussians:
508  const float minEl = DEG2RAD(myBeaconMap->insertionOptions.minElevation_deg);
509  const float maxEl = DEG2RAD(myBeaconMap->insertionOptions.maxElevation_deg);
510  ASSERT_(
511  myBeaconMap->insertionOptions.minElevation_deg <=
512  myBeaconMap->insertionOptions.maxElevation_deg)
513 
514  double el, th, A_ang;
515  const float maxDistBetweenGaussians =
516  myBeaconMap->insertionOptions.SOG_maxDistBetweenGaussians; // Meters
517 
518  // B: Number of gaussians in each cut to the sphere (XY,XZ,...)
519  size_t B = (size_t)(M_2PIf * R / maxDistBetweenGaussians) + 1;
520 
521  // Assure minimum B (maximum angular increment):
522  B = max(B, (size_t)30);
523 
524  // B must be even:
525  if (B % 2) B++;
526 
527  A_ang = M_2PI / B; // Angular increments between modes:
528 
529  // The diagonal basic covariance matrix.
530  // (0,0) is the variance in the direction "in->out" of the sphere
531  // (1,1),(2,2) is the var. in the two directions tangent to the sphere
532  CMatrixDouble33 S;
533  S(0, 0) = square(myBeaconMap->likelihoodOptions.rangeStd);
534  S(1, 1) = S(2, 2) = square(
535  A_ang * R /
536  myBeaconMap->insertionOptions
537  .SOG_separationConstant); // 4.0f * sensedRange * S(0,0);
538 
539  CPoint3D dir;
540 
541  // Create the SOG:
542  size_t modeIdx;
543  if (clearPreviousContentsOutPDF)
544  {
545  // Overwrite modes:
546  modeIdx = 0;
547  outPDF.resize(B * B);
548  }
549  else
550  {
551  // Append modes:
552  modeIdx = outPDF.size(); // Start here
553  outPDF.resize(outPDF.size() + B * B);
554  }
555 
556  size_t idxEl, idxTh; // idxEl:[0,B/2+1]
557 
558  for (idxEl = 0; idxEl <= (1 + B / 2); idxEl++)
559  {
560  el = minEl + idxEl * A_ang;
561  if (el > (maxEl + 0.5 * A_ang)) continue;
562 
563  size_t nThSteps = B;
564  // Except if we are in the top/bottom of the sphere:
565  if (fabs(cos(el)) < 1e-4)
566  {
567  nThSteps = 1;
568  }
569 
570  for (idxTh = 0; idxTh < nThSteps; idxTh++)
571  {
572  th = idxTh * A_ang;
573 
574  // Compute the mean of the new Gaussian:
575  dir.x((sensorPnt.x() + R * cos(th) * cos(el)));
576  dir.y((sensorPnt.y() + R * sin(th) * cos(el)));
577  dir.z((sensorPnt.z() + R * sin(el)));
578 
579  // If we are provided a radius for not creating modes out of it,
580  // check it:
581  bool reallyCreateIt = true;
582  if (maxDistanceFromCenter > 0)
583  reallyCreateIt =
584  dir.distanceTo(centerPoint) < maxDistanceFromCenter;
585 
586  if (reallyCreateIt)
587  {
588  // All have equal log-weights:
589  outPDF.get(modeIdx).log_w = 0;
590 
591  // The mean:
592  outPDF.get(modeIdx).val.mean = dir;
593 
594  // Compute the covariance:
595  dir = dir - sensorPnt;
598  dir.x(), dir.y(),
599  dir.z())); // 3 perpendicular & normalized vectors.
600 
601  H.multiply_HCHt(
602  S,
603  outPDF.get(modeIdx).val.cov); // out = H * S * ~H;
604  if (minEl == maxEl)
605  { // We are in 2D:
606  // 3rd column/row = 0
607  CMatrixDouble33& C33 = outPDF.get(modeIdx).val.cov;
608  C33.get_unsafe(0, 2) = C33.get_unsafe(2, 0) =
609  C33.get_unsafe(1, 2) = C33.get_unsafe(2, 1) =
610  C33.get_unsafe(2, 2) = 0;
611  }
612 
613  // Add covariance for uncertainty composition?
614  if (covarianceCompositionToAdd)
615  outPDF.get(modeIdx).val.cov += *covarianceCompositionToAdd;
616 
617  // One more mode is used:
618  modeIdx++;
619 
620  } // end if reallyCreateIt
621 
622  } // end for idxTh
623  } // end for idxEl
624 
625  // resize to the number of really used modes:
626  outPDF.resize(modeIdx);
627 
628  MRPT_END
629 }
double x() const
Common members of all points & poses classes.
Definition: CPoseOrPoint.h:135
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
Definition: CPoseOrPoint.h:206
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:30
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
void copyFrom(const mrpt::poses::CPointPDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
Definition: CBeacon.cpp:187
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
#define M_2PIf
CPoint3D mean
The mean value.
void resize(const size_t N)
Resize the number of SOG modes.
void changeCoordinatesReference(const mrpt::poses::CPose3D &newReferenceBase) override
this = p (+) this.
Definition: CBeacon.cpp:233
Declares a class that represents a Probability Density function (PDF) of a 3D point ...
Definition: CPointPDFSOG.h:36
#define THROW_EXCEPTION(msg)
The struct for each mode:
Definition: CPointPDFSOG.h:43
void clear()
Clear all the gaussian modes.
void bayesianFusion(const CPointPDF &p1, const CPointPDF &p2, const double &minMahalanobisDistToDrop=0) override
Bayesian fusion of two point distributions (product of two distributions->new distribution), then save the result in this object (WARNING: See implementing classes to see classes that can and cannot be mixtured!)
Definition: CBeacon.cpp:139
STL namespace.
CMatrixFixedNumeric< double, 3, 3 > CMatrixDouble33
Definition: eigen_frwds.h:55
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
#define M_2PI
Definition: mrpt_macros.h:437
T square(const T x)
Inline function for the square of a number.
Definition: bits.h:55
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
A class for storing a list of text lines.
Definition: CStringList.h:32
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
#define MRPT_END
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CBeacon.cpp:56
void push_back(const TGaussianMode &m)
Inserts a copy of the given mode into the SOG.
Definition: CPointPDFSOG.h:102
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
CMatrixTemplateNumeric< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).
float SOG_maxDistBetweenGaussians
A parameter for initializing 2D/3D SOGs.
Definition: CBeaconMap.h:194
std::deque< TGaussianMode >::const_iterator const_iterator
Definition: CPointPDFSOG.h:54
void getAsMatlabDrawCommands(utils::CStringList &out_Str) const
Gets a set of MATLAB commands which draw the current state of the beacon:
Definition: CBeacon.cpp:324
float rangeStd
The standard deviation used for Beacon ranges likelihood (default=0.08m).
Definition: CBeaconMap.h:129
void clear()
Clear the whole list.
Definition: CStringList.cpp:73
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:32
This namespace contains representation of robot actions and observations.
A class for storing a map of 3D probabilistic beacons, using a Montecarlo, Gaussian, or Sum of Gaussians (SOG) representation (for range-only SLAM).
Definition: CBeaconMap.h:46
int val
Definition: mrpt_jpeglib.h:955
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:19
float SOG_separationConstant
Constant used to compute the std.
Definition: CBeaconMap.h:199
void getCovarianceAndMean(mrpt::math::CMatrixDouble33 &cov, mrpt::poses::CPoint3D &mean_point) const override
Returns an estimate of the point covariance matrix (3x3 cov matrix) and the mean, both at once...
Definition: CBeacon.cpp:116
const TGaussianMode & get(size_t i) const
Access to individual beacons.
Definition: CPointPDFSOG.h:89
float maxElevation_deg
Minimum and maximum elevation angles (in degrees) for inserting new beacons at the first observation:...
Definition: CBeaconMap.h:157
#define DEG2RAD
GLsizei const GLchar ** string
Definition: glext.h:4101
A class used to store a 3D point.
Definition: CPoint3D.h:32
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
#define INVALID_BEACON_ID
Used for CObservationBeaconRange, CBeacon, etc.
Definition: CObservation.h:22
#define MRPT_START
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CMatrixTemplateNumeric< T > generateAxisBaseFromDirection(T dx, T dy, T dz)
Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of the...
Definition: geometry.h:1121
const float R
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPointPDF.h:94
size_t size() const
Return the number of Gaussian modes.
Definition: CPointPDFSOG.h:111
GLuint in
Definition: glext.h:7274
TTypePDF
See m_typePDF.
Definition: CBeacon.h:53
#define ASSERT_(f)
void saveToTextFile(const std::string &file) const override
Save PDF&#39;s particles to a text file.
Definition: CBeacon.cpp:210
mrpt::maps::CBeaconMap::TLikelihoodOptions likelihoodOptions
void drawSingleSample(mrpt::poses::CPoint3D &outSample) const override
Draw a sample from the pdf.
Definition: CBeacon.cpp:164
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...
Definition: CBeacon.cpp:73
static void generateRingSOG(const float &sensedRange, mrpt::poses::CPointPDFSOG &outPDF, const CBeaconMap *myBeaconMap, const mrpt::poses::CPoint3D &sensorPnt, const mrpt::math::CMatrixDouble33 *covarianceCompositionToAdd=nullptr, bool clearPreviousContentsOutPDF=true, const mrpt::poses::CPoint3D &centerPoint=mrpt::poses::CPoint3D(0, 0, 0), const float &maxDistanceFromCenter=0)
This static method returns a SOG with ring-shape (or as a 3D sphere) that can be used to initialize a...
Definition: CBeacon.cpp:496
std::shared_ptr< CText > Ptr
Definition: CText.h:40
mrpt::maps::CBeaconMap::TInsertionOptions insertionOptions
std::shared_ptr< CPointCloud > Ptr
Definition: CPointCloud.h:52
unsigned __int32 uint32_t
Definition: rptypes.h:47
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
Definition: CPointPDF.h:39
GLfloat GLfloat p
Definition: glext.h:6305
The class for storing individual "beacon landmarks" under a variety of 3D position PDF distributions...
Definition: CBeacon.h:42
void generateObservationModelDistribution(const float &sensedRange, mrpt::poses::CPointPDFSOG &outPDF, const CBeaconMap *myBeaconMap, const mrpt::poses::CPoint3D &sensorPntOnRobot, const mrpt::poses::CPoint3D &centerPoint=mrpt::poses::CPoint3D(0, 0, 0), const float &maxDistanceFromCenter=0) const
Compute the observation model p(z_t|x_t) for a given observation (range value), and return it as an a...
Definition: CBeacon.cpp:434
int sprintf(char *buf, size_t bufSize, const char *format,...) noexcept MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
Definition: os.cpp:188
void getMean(mrpt::poses::CPoint3D &mean_point) const override
Returns an estimate of the point, (the mean, or mathematical expectation of the PDF).
Definition: CBeacon.cpp:93
void add(const std::string &str)
Appends a new string at the end of the string list.
Definition: CStringList.cpp:43
std::shared_ptr< CEllipsoid > Ptr
Definition: CEllipsoid.h:49
virtual ~CBeacon()
Virtual destructor.
Definition: CBeacon.cpp:50



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