Main MRPT website > C++ reference for MRPT 1.9.9
CAngularObservationMesh.h
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 #ifndef opengl_CAngularObservationMesh_H
10 #define opengl_CAngularObservationMesh_H
11 
15 #include <mrpt/math/CMatrixB.h>
17 #include <mrpt/maps/CPointsMap.h>
19 
20 #include <mrpt/math/geometry.h>
21 
22 namespace mrpt
23 {
24 namespace opengl
25 {
26 /**
27  * A mesh built from a set of 2D laser scan observations.
28  * Each element of this set is a single scan through the yaw, given a specific
29  * pitch.
30  * Each scan has a mrpt::poses::CPose3D identifying the origin of the scan,
31  * which ideally is the
32  * same for every one of them.
33  *
34  * <div align="center">
35  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
36  * border-style: solid;">
37  * <tr> <td> mrpt::opengl::CAngularObservationMesh </td> <td> \image html
38  * preview_CAngularObservationMesh.png </td> </tr>
39  * </table>
40  * </div>
41  *
42  * \ingroup mrpt_maps_grp
43  */
45 {
47  public:
48  /**
49  * Range specification type, with several uses.
50  */
51  struct TDoubleRange
52  {
53  private:
54  /**
55  * Range type.
56  * If 0, it's specified by an initial and a final value, and an
57  * increment.
58  * If 1, it's specified by an initial and a final value, and a fixed
59  * size of samples.
60  * If 2, it's specified by an aperture, a fixed size of samples and a
61  * boolean variable controlling direction. This type is always
62  * zero-centered.
63  */
64  char rangeType;
65  /**
66  * Union type with the actual data.
67  * \sa rangeType
68  */
69  union rd {
70  struct
71  {
72  double initial;
73  double final;
74  double increment;
75  } mode0;
76  struct
77  {
78  double initial;
79  double final;
80  size_t amount;
81  } mode1;
82  struct
83  {
84  double aperture;
85  size_t amount;
86  bool negToPos;
87  } mode2;
88  } rangeData;
89 
90  public:
91  /**
92  * Constructor from initial value, final value and range.
93  */
94  TDoubleRange(double a, double b, double c) : rangeType(0)
95  {
99  }
100  /**
101  * Constructor from initial value, final value and amount of samples.
102  */
103  TDoubleRange(double a, double b, size_t c) : rangeType(1)
104  {
108  }
109  /**
110  * Constructor from aperture, amount of samples and scan direction.
111  */
112  TDoubleRange(double a, size_t b, bool c) : rangeType(2)
113  {
117  }
118  /**
119  * Creates a range of values from the initial value, the final value
120  * and the increment.
121  * \throw std::logic_error if the increment is zero.
122  */
124  double initial, double final, double increment)
125  {
126  if (increment == 0)
127  throw std::logic_error("Invalid increment value.");
128  return TDoubleRange(initial, final, increment);
129  }
130  /**
131  * Creates a range of values from the initial value, the final value
132  * and a desired amount of samples.
133  */
135  double initial, double final, size_t amount)
136  {
137  return TDoubleRange(initial, final, amount);
138  }
139  /**
140  * Creates a zero-centered range of values from an aperture, an amount
141  * of samples and a direction.
142  */
144  double aperture, size_t amount, bool negToPos = true)
145  {
147  }
148  /**
149  * Returns the total aperture of the range.
150  * \throw std::logic_error on invalid range type.
151  */
152  inline double aperture() const
153  {
154  switch (rangeType)
155  {
156  case 0:
157  return (mrpt::sign(rangeData.mode0.increment) ==
158  mrpt::sign(
161  ? fabs(
164  : 0;
165  case 1:
167  case 2:
168  return rangeData.mode2.aperture;
169  default:
170  throw std::logic_error("Unknown range type.");
171  }
172  }
173  /**
174  * Returns the first value of the range.
175  * \throw std::logic_error on invalid range type.
176  */
177  inline double initialValue() const
178  {
179  switch (rangeType)
180  {
181  case 0:
182  case 1:
183  return rangeData.mode0.initial;
184  case 2:
185  return rangeData.mode2.negToPos
186  ? -rangeData.mode2.aperture / 2
187  : rangeData.mode2.aperture / 2;
188  default:
189  throw std::logic_error("Unknown range type.");
190  }
191  }
192  /**
193  * Returns the last value of the range.
194  * \throw std::logic_error on invalid range type.
195  */
196  inline double finalValue() const
197  {
198  switch (rangeType)
199  {
200  case 0:
201  return (mrpt::sign(rangeData.mode0.increment) ==
202  mrpt::sign(
207  case 1:
208  return rangeData.mode1.final;
209  case 2:
210  return rangeData.mode2.negToPos
211  ? rangeData.mode2.aperture / 2
212  : -rangeData.mode2.aperture / 2;
213  default:
214  throw std::logic_error("Unknown range type.");
215  }
216  }
217  /**
218  * Returns the increment between two consecutive values of the range.
219  * \throw std::logic_error on invalid range type.
220  */
221  inline double increment() const
222  {
223  switch (rangeType)
224  {
225  case 0:
226  return rangeData.mode0.increment;
227  case 1:
229  static_cast<double>(rangeData.mode1.amount - 1);
230  case 2:
231  return rangeData.mode2.negToPos
233  static_cast<double>(
234  rangeData.mode2.amount - 1)
236  static_cast<double>(
237  rangeData.mode2.amount - 1);
238  default:
239  throw std::logic_error("Unknown range type.");
240  }
241  }
242  /**
243  * Returns the total amount of values in this range.
244  * \throw std::logic_error on invalid range type.
245  */
246  inline size_t amount() const
247  {
248  switch (rangeType)
249  {
250  case 0:
251  return (mrpt::sign(rangeData.mode0.increment) ==
252  mrpt::sign(
255  ? 1 + static_cast<size_t>(
256  ceil(
260  : 1;
261  case 1:
262  return rangeData.mode1.amount;
263  case 2:
264  return rangeData.mode2.amount;
265  default:
266  throw std::logic_error("Unknown range type.");
267  }
268  }
269  /**
270  * Gets a vector with every value in the range.
271  * \throw std::logic_error on invalid range type.
272  */
273  void values(std::vector<double>& vals) const;
274  /**
275  * Returns the direction of the scan. True if the increment is
276  * positive, false otherwise.
277  * \throw std::logic_error on invalid range type.
278  */
279  inline bool negToPos() const
280  {
281  switch (rangeType)
282  {
283  case 0:
284  return mrpt::sign(rangeData.mode0.increment) > 0;
285  case 1:
286  return mrpt::sign(
288  rangeData.mode1.initial) > 0;
289  case 2:
290  return rangeData.mode2.negToPos;
291  default:
292  throw std::logic_error("Unknown range type.");
293  }
294  }
295  };
296 
297  void getBoundingBox(
298  mrpt::math::TPoint3D& bb_min,
299  mrpt::math::TPoint3D& bb_max) const override;
300 
301  protected:
302  /** Updates the mesh, if needed. It's a const method, but modifies mutable
303  * content. */
304  void updateMesh() const;
305  /** Actual set of triangles to be displayed. */
306  mutable std::vector<CSetOfTriangles::TTriangle> triangles;
307  /** Internal method to add a triangle to the mutable mesh. */
308  void addTriangle(
309  const mrpt::math::TPoint3D& p1, const mrpt::math::TPoint3D& p2,
310  const mrpt::math::TPoint3D& p3) const;
311  /** Whether the mesh will be displayed wireframe or solid. */
313  /** Mutable variable which controls if the object has suffered any change
314  * since last time the mesh was updated. */
315  mutable bool meshUpToDate;
316  /** Whether the object may present transparencies or not. */
318  /** Mutable object with the mesh's points. */
320  /** Scan validity matrix. */
322  /** Observation pitch range. When containing exactly two elements, they
323  * represent the bounds. */
324  std::vector<double> pitchBounds;
325  /** Actual scan set which is used to generate the mesh. */
326  std::vector<mrpt::obs::CObservation2DRangeScan> scanSet;
327 
328  public:
329  /**
330  * Basic constructor.
331  */
333  : mWireframe(true),
334  meshUpToDate(false),
335  mEnableTransparency(true),
336  actualMesh(0, 0),
337  validityMatrix(0, 0),
338  pitchBounds(),
339  scanSet()
340  {
341  }
342  /** Empty destructor. */
344  /**
345  * Returns whether the object is configured as wireframe or solid.
346  */
347  inline bool isWireframe() const { return mWireframe; }
348  /**
349  * Sets the display mode for the object. True=wireframe, False=solid.
350  */
351  inline void setWireframe(bool enabled = true)
352  {
353  mWireframe = enabled;
355  }
356  /**
357  * Returns whether the object may be transparent or not.
358  */
359  inline bool isTransparencyEnabled() const { return mEnableTransparency; }
360  /**
361  * Enables or disables transparencies.
362  */
363  inline void enableTransparency(bool enabled = true)
364  {
365  mEnableTransparency = enabled;
367  }
368  /**
369  * Renderizes the object.
370  * \sa mrpt::opengl::CRenderizable
371  */
372  virtual void render_dl() const override;
373  /**
374  * Traces a ray to the object, returning the distance to a given pose
375  * through its X axis.
376  * \sa mrpt::opengl::CRenderizable,trace2DSetOfRays,trace1DSetOfRays
377  */
378  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
379  /**
380  * Sets the pitch bounds for this range.
381  */
382  void setPitchBounds(const double initial, const double final);
383  /**
384  * Sets the pitch bounds for this range.
385  */
386  void setPitchBounds(const std::vector<double>& bounds);
387  /**
388  * Gets the initial and final pitch bounds for this range.
389  */
390  void getPitchBounds(double& initial, double& final) const;
391  /**
392  * Gets the pitch bounds for this range.
393  */
394  void getPitchBounds(std::vector<double>& bounds) const;
395  /**
396  * Gets the scan set.
397  */
398  void getScanSet(
399  std::vector<mrpt::obs::CObservation2DRangeScan>& scans) const;
400  /**
401  * Sets the scan set.
402  */
403  bool setScanSet(
404  const std::vector<mrpt::obs::CObservation2DRangeScan>& scans);
405  /**
406  * Gets the mesh as a set of triangles, for displaying them.
407  * \sa generateSetOfTriangles(std::vector<TPolygon3D>
408  * &),mrpt::opengl::CSetOfTriangles,mrpt::opengl::CSetOfTriangles::TTriangle
409  */
411  /**
412  * Returns the scanned points as a 3D point cloud. The target pointmap must
413  * be passed as a pointer to allow the use of any derived class.
414  */
415  void generatePointCloud(mrpt::maps::CPointsMap* out_map) const;
416  /**
417  * Gets a set of lines containing the traced rays, for displaying them.
418  * \sa getUntracedRays,mrpt::opengl::CSetOfLines
419  */
420  void getTracedRays(CSetOfLines::Ptr& res) const;
421  /**
422  * Gets a set of lines containing the untraced rays, up to a specified
423  * distance, for displaying them.
424  * \sa getTracedRays,mrpt::opengl::CSetOfLines
425  */
426  void getUntracedRays(CSetOfLines::Ptr& res, double dist) const;
427  /**
428  * Gets the mesh as a set of polygons, to work with them.
429  * \sa generateSetOfTriangles(mrpt::opengl::CSetOfTriangles &)
430  */
431  void generateSetOfTriangles(std::vector<mrpt::math::TPolygon3D>& res) const;
432  /**
433  * Retrieves the full mesh, along with the validity matrix.
434  */
437  mrpt::math::CMatrixBool& validity) const
438  {
439  if (!meshUpToDate) updateMesh();
440  pts = actualMesh;
441  validity = validityMatrix;
442  }
443 
444  private:
445  /**
446  * Internal functor class to trace a ray.
447  */
448  template <class T>
449  class FTrace1D
450  {
451  protected:
453  const T& e;
454  std::vector<double>& values;
455  std::vector<char>& valid;
456 
457  public:
459  const T& s, const mrpt::poses::CPose3D& p, std::vector<double>& v,
460  std::vector<char>& v2)
461  : initial(p), e(s), values(v), valid(v2)
462  {
463  }
464  void operator()(double yaw)
465  {
466  double dist;
467  const mrpt::poses::CPose3D pNew =
468  initial + mrpt::poses::CPose3D(0.0, 0.0, 0.0, yaw, 0.0, 0.0);
469  if (e->traceRay(pNew, dist))
470  {
471  values.push_back(dist);
472  valid.push_back(1);
473  }
474  else
475  {
476  values.push_back(0);
477  valid.push_back(0);
478  }
479  }
480  };
481  /**
482  * Internal functor class to trace a set of rays.
483  */
484  template <class T>
485  class FTrace2D
486  {
487  protected:
488  const T& e;
492  std::vector<mrpt::obs::CObservation2DRangeScan>& vObs;
494 
495  public:
497  const T& s, const mrpt::poses::CPose3D& p,
500  std::vector<mrpt::obs::CObservation2DRangeScan>& obs,
501  const mrpt::poses::CPose3D& b)
502  : e(s), initial(p), caom(om), yaws(y), vObs(obs), pBase(b)
503  {
504  }
505  void operator()(double pitch)
506  {
507  std::vector<double> yValues;
508  yaws.values(yValues);
511  const mrpt::poses::CPose3D pNew =
512  initial + mrpt::poses::CPose3D(0, 0, 0, 0, pitch, 0);
513  std::vector<double> values;
514  std::vector<char> valid;
515  size_t nY = yValues.size();
516  values.reserve(nY);
517  valid.reserve(nY);
518  for_each(
519  yValues.begin(), yValues.end(),
520  FTrace1D<T>(e, pNew, values, valid));
521  o.aperture = yaws.aperture();
522  o.rightToLeft = yaws.negToPos();
523  o.maxRange = 10000;
524  o.sensorPose = pNew;
525  o.deltaPitch = 0;
526  o.resizeScan(values.size());
527  for (size_t i = 0; i < values.size(); i++)
528  {
529  o.setScanRange(i, values[i]);
530  o.setScanRangeValidity(i, valid[i] != 0);
531  }
532  vObs.push_back(o);
533  }
534  };
535 
536  public:
537  /**
538  * 2D ray tracing (will generate a 3D mesh). Given an object and two
539  * ranges, realizes a scan from the initial pose and stores it in a
540  * CAngularObservationMesh object.
541  * The objective may be a COpenGLScene, a CRenderizable or any children of
542  * its.
543  * \sa mrpt::opengl::CRenderizable,mrpt::opengl::COpenGLScene.
544  */
545  template <class T>
546  static void trace2DSetOfRays(
547  const T& e, const mrpt::poses::CPose3D& initial,
548  CAngularObservationMesh::Ptr& caom, const TDoubleRange& pitchs,
549  const TDoubleRange& yaws);
550  /**
551  * 2D ray tracing (will generate a vectorial mesh inside a plane). Given an
552  * object and a range, realizes a scan from the initial pose and stores it
553  * in a CObservation2DRangeScan object.
554  * The objective may be a COpenGLScene, a CRenderizable or any children of
555  * its.
556  * \sa mrpt::opengl::CRenderizable,mrpt::opengl::COpenGLScene.
557  */
558  template <class T>
559  static void trace1DSetOfRays(
560  const T& e, const mrpt::poses::CPose3D& initial,
562  {
563  std::vector<double> yValues;
564  yaws.values(yValues);
567  size_t nV = yaws.amount();
568  scanValues.reserve(nV);
569  valid.reserve(nV);
570  for_each(
571  yValues.begin(), yValues.end(),
572  FTrace1D<T>(e, initial, scanValues, valid));
573  obs.aperture = yaws.aperture();
574  obs.rightToLeft = yaws.negToPos();
575  obs.maxRange = 10000;
576  obs.sensorPose = initial;
577  obs.deltaPitch = 0;
578  obs.scan = scanValues;
579  obs.validRange = valid;
580  }
581 };
582 
583 template <class T>
585  const T& e, const mrpt::poses::CPose3D& initial,
586  CAngularObservationMesh::Ptr& caom, const TDoubleRange& pitchs,
587  const TDoubleRange& yaws)
588 {
589  std::vector<double> pValues;
590  pitchs.values(pValues);
591  std::vector<mrpt::obs::CObservation2DRangeScan> vObs;
592  vObs.reserve(pValues.size());
593  for_each(
594  pValues.begin(), pValues.end(),
595  FTrace2D<T>(e, initial, caom, yaws, vObs, initial));
596  caom->mWireframe = false;
597  caom->mEnableTransparency = false;
598  caom->setPitchBounds(pValues);
599  caom->setScanSet(vObs);
600 }
601 }
602 }
603 #endif
CSetOfLines.h
mrpt::opengl::CAngularObservationMesh::pitchBounds
std::vector< double > pitchBounds
Observation pitch range.
Definition: CAngularObservationMesh.h:324
mrpt::opengl::CSetOfLines::Ptr
std::shared_ptr< CSetOfLines > Ptr
Definition: CSetOfLines.h:35
mrpt::obs::CObservation2DRangeScan::setScanRange
void setScanRange(const size_t i, const float val)
Definition: CObservation2DRangeScan.cpp:509
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::aperture
double aperture
Definition: CAngularObservationMesh.h:84
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::final
double final
Definition: CAngularObservationMesh.h:73
mrpt::opengl::CAngularObservationMesh::generatePointCloud
void generatePointCloud(mrpt::maps::CPointsMap *out_map) const
Returns the scanned points as a 3D point cloud.
Definition: CAngularObservationMesh.cpp:292
mrpt::obs::CObservation2DRangeScan::maxRange
float maxRange
The maximum range allowed by the device, in meters (e.g.
Definition: CObservation2DRangeScan.h:130
mrpt::opengl::CAngularObservationMesh::TDoubleRange::amount
size_t amount() const
Returns the total amount of values in this range.
Definition: CAngularObservationMesh.h:246
mrpt::obs::CObservation2DRangeScan::rightToLeft
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise.
Definition: CObservation2DRangeScan.h:127
mrpt::opengl::CAngularObservationMesh::scanSet
std::vector< mrpt::obs::CObservation2DRangeScan > scanSet
Actual scan set which is used to generate the mesh.
Definition: CAngularObservationMesh.h:326
mrpt::opengl::CAngularObservationMesh::isTransparencyEnabled
bool isTransparencyEnabled() const
Returns whether the object may be transparent or not.
Definition: CAngularObservationMesh.h:359
mrpt::opengl::CAngularObservationMesh::TDoubleRange::initialValue
double initialValue() const
Returns the first value of the range.
Definition: CAngularObservationMesh.h:177
s
GLdouble s
Definition: glext.h:3676
geometry.h
mrpt::opengl::CAngularObservationMesh::addTriangle
void addTriangle(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3) const
Internal method to add a triangle to the mutable mesh.
CPointsMap.h
mrpt::opengl::CAngularObservationMesh::FTrace2D::vObs
std::vector< mrpt::obs::CObservation2DRangeScan > & vObs
Definition: CAngularObservationMesh.h:492
mrpt::obs::CObservation2DRangeScan
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Definition: CObservation2DRangeScan.h:56
mrpt::opengl::CAngularObservationMesh::FTrace2D::operator()
void operator()(double pitch)
Definition: CAngularObservationMesh.h:505
mrpt::opengl::CAngularObservationMesh::FTrace1D::initial
const mrpt::poses::CPose3D & initial
Definition: CAngularObservationMesh.h:452
mrpt::math::CMatrixBool
Declares a matrix of booleans (non serializable).
Definition: CMatrixTemplate.h:696
mrpt::opengl::CAngularObservationMesh::TDoubleRange::finalValue
double finalValue() const
Returns the last value of the range.
Definition: CAngularObservationMesh.h:196
CRenderizableDisplayList.h
mrpt::opengl::CAngularObservationMesh::render_dl
virtual void render_dl() const override
Renderizes the object.
mrpt::opengl::CAngularObservationMesh::trace1DSetOfRays
static void trace1DSetOfRays(const T &e, const mrpt::poses::CPose3D &initial, mrpt::obs::CObservation2DRangeScan &obs, const TDoubleRange &yaws)
2D ray tracing (will generate a vectorial mesh inside a plane).
Definition: CAngularObservationMesh.h:559
c
const GLubyte * c
Definition: glext.h:6313
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd
Union type with the actual data.
Definition: CAngularObservationMesh.h:69
mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D >
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::increment
double increment
Definition: CAngularObservationMesh.h:74
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:39
mrpt::opengl::CAngularObservationMesh::FTrace1D::valid
std::vector< char > & valid
Definition: CAngularObservationMesh.h:455
mrpt::opengl::CAngularObservationMesh::TDoubleRange::CreateFromIncrement
static TDoubleRange CreateFromIncrement(double initial, double final, double increment)
Creates a range of values from the initial value, the final value and the increment.
Definition: CAngularObservationMesh.h:123
mrpt::opengl::CRenderizableDisplayList::notifyChange
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Definition: CRenderizableDisplayList.h:57
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::amount
size_t amount
Definition: CAngularObservationMesh.h:80
mrpt::opengl::CAngularObservationMesh::CAngularObservationMesh
CAngularObservationMesh()
Basic constructor.
Definition: CAngularObservationMesh.h:332
CSetOfTriangles.h
mrpt::maps::CPointsMap
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
Definition: CPointsMap.h:64
mrpt::opengl::CAngularObservationMesh::TDoubleRange::CreateFromAmount
static TDoubleRange CreateFromAmount(double initial, double final, size_t amount)
Creates a range of values from the initial value, the final value and a desired amount of samples.
Definition: CAngularObservationMesh.h:134
mrpt::opengl::CAngularObservationMesh::TDoubleRange::TDoubleRange
TDoubleRange(double a, double b, size_t c)
Constructor from initial value, final value and amount of samples.
Definition: CAngularObservationMesh.h:103
mrpt::opengl::CAngularObservationMesh::TDoubleRange::TDoubleRange
TDoubleRange(double a, double b, double c)
Constructor from initial value, final value and range.
Definition: CAngularObservationMesh.h:94
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CAngularObservationMesh::TDoubleRange::increment
double increment() const
Returns the increment between two consecutive values of the range.
Definition: CAngularObservationMesh.h:221
mrpt::opengl::CAngularObservationMesh::Ptr
std::shared_ptr< CAngularObservationMesh > Ptr
Definition: CAngularObservationMesh.h:46
mrpt::opengl::CAngularObservationMesh::getScanSet
void getScanSet(std::vector< mrpt::obs::CObservation2DRangeScan > &scans) const
Gets the scan set.
Definition: CAngularObservationMesh.cpp:267
mrpt::obs::CObservation2DRangeScan::resizeScan
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
Definition: CObservation2DRangeScan.cpp:538
mrpt::obs::CObservation2DRangeScan::setScanRangeValidity
void setScanRangeValidity(const size_t i, const bool val)
Definition: CObservation2DRangeScan.cpp:531
mrpt::opengl::CAngularObservationMesh::FTrace2D::caom
CAngularObservationMesh::Ptr & caom
Definition: CAngularObservationMesh.h:490
mrpt::opengl::CAngularObservationMesh::FTrace2D::yaws
const CAngularObservationMesh::TDoubleRange & yaws
Definition: CAngularObservationMesh.h:491
p
GLfloat GLfloat p
Definition: glext.h:6305
mrpt::opengl::CAngularObservationMesh::FTrace1D::FTrace1D
FTrace1D(const T &s, const mrpt::poses::CPose3D &p, std::vector< double > &v, std::vector< char > &v2)
Definition: CAngularObservationMesh.h:458
mrpt::obs::CObservation2DRangeScan::deltaPitch
double deltaPitch
If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...
Definition: CObservation2DRangeScan.h:144
mrpt::opengl::CAngularObservationMesh::TDoubleRange::aperture
double aperture() const
Returns the total aperture of the range.
Definition: CAngularObservationMesh.h:152
mrpt::opengl::CAngularObservationMesh::setScanSet
bool setScanSet(const std::vector< mrpt::obs::CObservation2DRangeScan > &scans)
Sets the scan set.
mrpt::opengl::CAngularObservationMesh::FTrace2D::FTrace2D
FTrace2D(const T &s, const mrpt::poses::CPose3D &p, CAngularObservationMesh::Ptr &om, const CAngularObservationMesh::TDoubleRange &y, std::vector< mrpt::obs::CObservation2DRangeScan > &obs, const mrpt::poses::CPose3D &b)
Definition: CAngularObservationMesh.h:496
mrpt::opengl::CAngularObservationMesh::FTrace2D::initial
const mrpt::poses::CPose3D & initial
Definition: CAngularObservationMesh.h:489
mrpt::opengl::CAngularObservationMesh::TDoubleRange
Range specification type, with several uses.
Definition: CAngularObservationMesh.h:51
mrpt::opengl::CAngularObservationMesh::triangles
std::vector< CSetOfTriangles::TTriangle > triangles
Actual set of triangles to be displayed.
Definition: CAngularObservationMesh.h:306
v
const GLdouble * v
Definition: glext.h:3678
mrpt::opengl::CAngularObservationMesh::FTrace1D::values
std::vector< double > & values
Definition: CAngularObservationMesh.h:454
mrpt::opengl::CAngularObservationMesh::getActualMesh
void getActualMesh(mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D > &pts, mrpt::math::CMatrixBool &validity) const
Retrieves the full mesh, along with the validity matrix.
Definition: CAngularObservationMesh.h:435
mrpt::opengl::CAngularObservationMesh::enableTransparency
void enableTransparency(bool enabled=true)
Enables or disables transparencies.
Definition: CAngularObservationMesh.h:363
mrpt::aligned_std_vector
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
Definition: aligned_std_vector.h:15
mrpt::opengl::CAngularObservationMesh::TDoubleRange::negToPos
bool negToPos() const
Returns the direction of the scan.
Definition: CAngularObservationMesh.h:279
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rangeType
char rangeType
Range type.
Definition: CAngularObservationMesh.h:64
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::mode0
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@10 mode0
mrpt::opengl::CAngularObservationMesh::getBoundingBox
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
Definition: CAngularObservationMesh.cpp:431
mrpt::opengl::CAngularObservationMesh::updateMesh
void updateMesh() const
Updates the mesh, if needed.
mrpt::obs::CObservation2DRangeScan::aperture
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
Definition: CObservation2DRangeScan.h:125
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::mode2
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@12 mode2
v2
GLfloat GLfloat GLfloat v2
Definition: glext.h:4107
mrpt::opengl::CAngularObservationMesh::~CAngularObservationMesh
virtual ~CAngularObservationMesh()
Empty destructor.
Definition: CAngularObservationMesh.h:343
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::opengl::CAngularObservationMesh::mEnableTransparency
bool mEnableTransparency
Whether the object may present transparencies or not.
Definition: CAngularObservationMesh.h:317
res
GLuint res
Definition: glext.h:7268
mrpt::opengl::CAngularObservationMesh::setWireframe
void setWireframe(bool enabled=true)
Sets the display mode for the object.
Definition: CAngularObservationMesh.h:351
mrpt::opengl::CAngularObservationMesh
A mesh built from a set of 2D laser scan observations.
Definition: CAngularObservationMesh.h:44
b
GLubyte GLubyte b
Definition: glext.h:6279
mrpt::math::CMatrixB
This class is a "CSerializable" wrapper for "CMatrixBool".
Definition: CMatrixB.h:23
mrpt::opengl::CAngularObservationMesh::generateSetOfTriangles
void generateSetOfTriangles(CSetOfTriangles::Ptr &res) const
Gets the mesh as a set of triangles, for displaying them.
Definition: CAngularObservationMesh.cpp:273
values
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:3582
CMatrixB.h
mrpt::opengl::CSetOfTriangles::Ptr
std::shared_ptr< CSetOfTriangles > Ptr
Definition: CSetOfTriangles.h:27
mrpt::opengl::CAngularObservationMesh::TDoubleRange::CreateFromAperture
static TDoubleRange CreateFromAperture(double aperture, size_t amount, bool negToPos=true)
Creates a zero-centered range of values from an aperture, an amount of samples and a direction.
Definition: CAngularObservationMesh.h:143
mrpt::obs::gnss::pitch
double pitch
Definition: gnss_messages_novatel.h:264
mrpt::opengl::CAngularObservationMesh::meshUpToDate
bool meshUpToDate
Mutable variable which controls if the object has suffered any change since last time the mesh was up...
Definition: CAngularObservationMesh.h:315
mrpt::opengl::CAngularObservationMesh::FTrace2D::pBase
const mrpt::poses::CPose3D & pBase
Definition: CAngularObservationMesh.h:493
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::mode1
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@11 mode1
mrpt::opengl::CAngularObservationMesh::FTrace1D
Internal functor class to trace a ray.
Definition: CAngularObservationMesh.h:449
mrpt::opengl::CAngularObservationMesh::FTrace2D
Internal functor class to trace a set of rays.
Definition: CAngularObservationMesh.h:485
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
mrpt::opengl::CAngularObservationMesh::traceRay
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Traces a ray to the object, returning the distance to a given pose through its X axis.
mrpt::opengl::CAngularObservationMesh::mWireframe
bool mWireframe
Whether the mesh will be displayed wireframe or solid.
Definition: CAngularObservationMesh.h:312
mrpt::opengl::CAngularObservationMesh::FTrace2D::e
const T & e
Definition: CAngularObservationMesh.h:488
mrpt::obs::CObservation2DRangeScan::scan
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
Definition: CObservation2DRangeScan.h:103
mrpt::opengl::CAngularObservationMesh::FTrace1D::e
const T & e
Definition: CAngularObservationMesh.h:453
mrpt::opengl::CAngularObservationMesh::TDoubleRange::TDoubleRange
TDoubleRange(double a, size_t b, bool c)
Constructor from aperture, amount of samples and scan direction.
Definition: CAngularObservationMesh.h:112
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rangeData
union mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd rangeData
mrpt::opengl::CAngularObservationMesh::isWireframe
bool isWireframe() const
Returns whether the object is configured as wireframe or solid.
Definition: CAngularObservationMesh.h:347
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::opengl::CAngularObservationMesh::setPitchBounds
void setPitchBounds(const double initial, const double final)
Sets the pitch bounds for this range.
Definition: CAngularObservationMesh.cpp:240
mrpt::opengl::CAngularObservationMesh::getTracedRays
void getTracedRays(CSetOfLines::Ptr &res) const
Gets a set of lines containing the traced rays, for displaying them.
Definition: CAngularObservationMesh.cpp:347
mrpt::opengl::CAngularObservationMesh::getUntracedRays
void getUntracedRays(CSetOfLines::Ptr &res, double dist) const
Gets a set of lines containing the untraced rays, up to a specified distance, for displaying them.
Definition: CAngularObservationMesh.cpp:402
mrpt::opengl::CAngularObservationMesh::TDoubleRange::values
void values(std::vector< double > &vals) const
Gets a vector with every value in the range.
Definition: CAngularObservationMesh.cpp:336
mrpt::opengl::CAngularObservationMesh::validityMatrix
mrpt::math::CMatrixB validityMatrix
Scan validity matrix.
Definition: CAngularObservationMesh.h:321
CMatrixTemplate.h
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::initial
double initial
Definition: CAngularObservationMesh.h:72
mrpt::opengl::CAngularObservationMesh::FTrace1D::operator()
void operator()(double yaw)
Definition: CAngularObservationMesh.h:464
mrpt::obs::CObservation2DRangeScan::sensorPose
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
Definition: CObservation2DRangeScan.h:133
mrpt::sign
int sign(T x)
Returns the sign of X as "1" or "-1".
Definition: core/include/mrpt/core/bits_math.h:68
mrpt::obs::CObservation2DRangeScan::validRange
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< char > > validRange
It's false (=0) on no reflected rays, referenced to elements in scan.
Definition: CObservation2DRangeScan.h:119
mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::negToPos
bool negToPos
Definition: CAngularObservationMesh.h:86
y
GLenum GLint GLint y
Definition: glext.h:3538
mrpt::opengl::CAngularObservationMesh::trace2DSetOfRays
static void trace2DSetOfRays(const T &e, const mrpt::poses::CPose3D &initial, CAngularObservationMesh::Ptr &caom, const TDoubleRange &pitchs, const TDoubleRange &yaws)
2D ray tracing (will generate a 3D mesh).
Definition: CAngularObservationMesh.h:584
CObservation2DRangeScan.h
mrpt::opengl::CAngularObservationMesh::getPitchBounds
void getPitchBounds(double &initial, double &final) const
Gets the initial and final pitch bounds for this range.
Definition: CAngularObservationMesh.cpp:257
mrpt::opengl::CAngularObservationMesh::actualMesh
mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D > actualMesh
Mutable object with the mesh's points.
Definition: CAngularObservationMesh.h:319
a
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



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