Main MRPT website > C++ reference for MRPT 1.5.6
CObservation2DRangeScan.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 "obs-precomp.h" // Precompiled headers
11 
13 #include <mrpt/poses/CPosePDF.h>
14 #include <mrpt/utils/CStream.h>
15 #include <mrpt/math/CMatrix.h>
16 #include <mrpt/math/wrap2pi.h>
17 #if MRPT_HAS_MATLAB
18 # include <mexplus.h>
19 #endif
20 
21 using namespace std;
22 using namespace mrpt::obs;
23 using namespace mrpt::utils;
24 using namespace mrpt::poses;
25 using namespace mrpt::math;
26 
27 // This must be added to any CSerializable class implementation file.
29 
30 /*---------------------------------------------------------------
31  Constructor
32  ---------------------------------------------------------------*/
34  m_scan(),
35  m_intensity(),
36  m_validRange(),
37  m_has_intensity(false),
38  scan( m_scan ), // proxy ctor
39  intensity( m_intensity ), // proxy ctor
40  validRange( m_validRange ), // proxy ctor
41  aperture( M_PIf ),
42  rightToLeft( true ),
43  maxRange( 80.0f ),
44  sensorPose(),
45  stdError( 0.01f ),
46  beamAperture(0),
47  deltaPitch(0),
48  m_cachedMap()
49 {
50 }
51 
52 CObservation2DRangeScan::CObservation2DRangeScan(const CObservation2DRangeScan &o ) :
53  scan( m_scan ), // proxy ctor
54  intensity( m_intensity ), // proxy ctor
55  validRange( m_validRange ) // proxy ctor
56 {
57  *this = o; // rely on compiler-generated copy op + the custom = operator in proxies.
58  // Ensure that padding at the end is kept (useful for SSE ops)
59  this->m_scan.reserve(o.m_scan.capacity());
60 }
61 
62 /*---------------------------------------------------------------
63  Destructor
64  ---------------------------------------------------------------*/
66 {
67 }
68 
69 /*---------------------------------------------------------------
70  Implements the writing to a CStream capability of CSerializable objects
71  ---------------------------------------------------------------*/
73 {
74  if (version)
75  *version = 7;
76  else
77  {
78  // The data
79  out << aperture << rightToLeft << maxRange << sensorPose;
80  uint32_t N = scan.size();
81  out << N;
82  ASSERT_(validRange.size() == scan.size() );
83  if (N)
84  {
85  out.WriteBufferFixEndianness( &m_scan[0], N );
86  out.WriteBuffer( &m_validRange[0],sizeof(m_validRange[0])*N );
87  }
88  out << stdError;
89  out << timestamp;
90  out << beamAperture;
91 
92  out << sensorLabel;
93 
94  out << deltaPitch;
95 
96  out << hasIntensity();
97  if(hasIntensity())
99  }
100 }
101 
102 /*---------------------------------------------------------------
103  Filter out invalid points by a minimum distance, a maximum angle and a certain distance at the end (z-coordinate of the lasers must be provided)
104  ---------------------------------------------------------------*/
105 void CObservation2DRangeScan::truncateByDistanceAndAngle(float min_distance, float max_angle, float min_height, float max_height, float h )
106 {
107  // FILTER OUT INVALID POINTS!!
110  CPose3D pose;
111  unsigned int k;
112  unsigned int nPts = scan.size();
113 
114  for( itScan = m_scan.begin(), itValid = m_validRange.begin(), k = 0;
115  itScan != m_scan.end();
116  itScan++, itValid++, k++ )
117  {
118  float ang = fabs(k*aperture/nPts - aperture*0.5);
119  float x = (*itScan)*cos(ang);
120 
121  if( min_height != 0 || max_height != 0 )
122  {
123  ASSERT_( max_height > min_height );
124  if( *itScan < min_distance || ang > max_angle || x > h - min_height || x < h - max_height )
125  *itValid = false;
126  } // end if
127  else
128  if( *itScan < min_distance || ang > max_angle )
129  *itValid = false;
130  }
131 }
132 
133 /*---------------------------------------------------------------
134  Implements the reading from a CStream capability of CSerializable objects
135  ---------------------------------------------------------------*/
137 {
138  switch(version)
139  {
140  case 0:
141  case 1:
142  case 2:
143  case 3:
144  {
145  CMatrix covSensorPose;
146  in >> aperture >> rightToLeft >> maxRange >> sensorPose >> covSensorPose;
147  uint32_t N,i;
148 
149  in >> N;
150 
151  this->resizeScan(N);
152  if (N)
153  in.ReadBufferFixEndianness( &m_scan[0], N);
154 
155  if (version>=1)
156  { // Load validRange:
157  if (N)
158  in.ReadBuffer( &m_validRange[0], sizeof(m_validRange[0])*N );
159  }
160  else
161  {
162  // validRange: Default values: If distance is not maxRange
163  for (i=0;i<N;i++)
164  m_validRange[i]= scan[i] < maxRange;
165  }
166 
167  if (version>=2)
168  {
169  in >> stdError;
170  }
171  else
172  {
173  stdError = 0.01f;
174  }
175 
176  if (version>=3)
177  {
178  in >> timestamp;
179  }
180 
181  // Default values for newer versions:
182  beamAperture = DEG2RAD(0.25f);
183 
184  deltaPitch = 0;
185  sensorLabel = "";
186 
187  } break;
188 
189  case 4:
190  case 5:
191  case 6:
192  case 7:
193  {
194  uint32_t N;
195 
196  CMatrix covSensorPose;
198 
199  if (version<6) // covSensorPose was removed in version 6
200  in >> covSensorPose;
201 
202  in >> N;
203  this->resizeScan(N);
204  if (N)
205  {
206  in.ReadBufferFixEndianness( &m_scan[0], N);
207  in.ReadBuffer( &m_validRange[0], sizeof(m_validRange[0])*N );
208  }
209  in >> stdError;
210  in.ReadBufferFixEndianness( &timestamp, 1);
211  in >> beamAperture;
212 
213  if (version>=5)
214  {
215  in >> sensorLabel;
216  in >> deltaPitch;
217  }
218  else
219  {
220  sensorLabel = "";
221  deltaPitch = 0;
222  }
223  if (version>=7)
224  {
225  bool hasIntensity;
226  in >> hasIntensity;
228  if (hasIntensity && N) {
229  in.ReadBufferFixEndianness( &m_intensity[0], N);
230  }
231  }
232  } break;
233  default:
235  };
236 
237  m_cachedMap.clear();
238 }
239 
240 /*---------------------------------------------------------------
241  Implements the writing to a mxArray for Matlab
242  ---------------------------------------------------------------*/
243 #if MRPT_HAS_MATLAB
244 // Add to implement mexplus::from template specialization
246 
248 {
249  const char* fields[] = {"class", // Data common to any MRPT class
250  "ts","sensorLabel", // Data common to any observation
251  "scan","validRange","intensity" // Received raw data
252  "aperture","rightToLeft","maxRange", // Scan plane geometry and properties
253  "stdError","beamAperture","deltaPitch", // Ray properties
254  "pose", // Sensor pose
255  "map"}; // Points map
256  mexplus::MxArray obs_struct( mexplus::MxArray::Struct(sizeof(fields)/sizeof(fields[0]),fields) );
257 
258  obs_struct.set("class", this->GetRuntimeClass()->className);
259 
260  obs_struct.set("ts", this->timestamp);
261  obs_struct.set("sensorLabel", this->sensorLabel);
262 
263  obs_struct.set("scan", this->m_scan);
264  // TODO: "validRange should be a vector<bool> for Matlab instead of vector<char>" ==> JLBC: It cannot be done like that since serializing "bool" is not cross-platform safe, while "char" is...
265  obs_struct.set("validRange", this->m_validRange);
266  obs_struct.set("intensity", this->m_intensity);
267  obs_struct.set("aperture", this->aperture);
268  obs_struct.set("rightToLeft", this->rightToLeft);
269  obs_struct.set("maxRange", this->maxRange);
270  obs_struct.set("stdError", this->stdError);
271  obs_struct.set("beamAperture", this->beamAperture);
272  obs_struct.set("deltaPitch", this->deltaPitch);
273  obs_struct.set("pose", this->sensorPose);
274  // TODO: obs_struct.set("map", ...)
275  return obs_struct.release();
276 }
277 #endif
278 
279 /*---------------------------------------------------------------
280  isPlanarScan
281  ---------------------------------------------------------------*/
282 bool CObservation2DRangeScan::isPlanarScan( const double tolerance ) const
283 {
284  return sensorPose.isHorizontal(tolerance);
285 }
286 
288 {
289  return m_has_intensity;
290 }
291 void CObservation2DRangeScan::setScanHasIntensity(bool setHasIntensityFlag)
292 {
293  m_has_intensity = setHasIntensityFlag;
294 }
295 
296 
297 /*---------------------------------------------------------------
298  filterByExclusionAreas
299  ---------------------------------------------------------------*/
301 {
302  if (areas.empty()) return;
303 
304  MRPT_START
305 
306  double Ang, dA;
307  size_t sizeRangeScan = scan.size();
308 
310 
311  if (!sizeRangeScan) return;
312 
313  if (rightToLeft)
314  {
315  Ang = - 0.5 * aperture;
316  dA = aperture / (sizeRangeScan-1);
317  }
318  else
319  {
320  Ang = + 0.5 * aperture;
321  dA = - aperture / (sizeRangeScan-1);
322  }
323 
326 
327  for (scan_it=m_scan.begin(), valid_it=m_validRange.begin(); scan_it!=m_scan.end(); scan_it++, valid_it++)
328  {
329  if (! *valid_it)
330  {
331  Ang+=dA;
332  continue; // Already it's invalid
333  }
334 
335  // Compute point in 2D, local to the laser center:
336  const double Lx = *scan_it * cos( Ang );
337  const double Ly = *scan_it * sin( Ang );
338  Ang+=dA;
339 
340  // To real 3D pose:
341  double Gx,Gy,Gz;
342  this->sensorPose.composePoint(Lx,Ly,0, Gx,Gy,Gz);
343 
344  // Filter by X,Y:
345  for (TListExclusionAreasWithRanges::const_iterator i=areas.begin();i!=areas.end();++i)
346  {
347  if ( i->first.PointIntoPolygon(Gx,Gy) &&
348  (Gz>=i->second.first && Gz<=i->second.second) )
349  {
350  *valid_it = false;
351  break; // Go for next point
352  }
353  } // for each area
354  } // for each point
355 
356  MRPT_END
357 }
358 
359 /*---------------------------------------------------------------
360  filterByExclusionAreas
361  ---------------------------------------------------------------*/
362 void CObservation2DRangeScan::filterByExclusionAreas( const std::vector<mrpt::math::CPolygon> &areas )
363 {
364  if (areas.empty()) return;
365 
367  for (size_t i=0;i<areas.size();i++)
368  {
369  TListExclusionAreasWithRanges::value_type dat;
370  dat.first = areas[i];
371  dat.second.first = -std::numeric_limits<double>::max();
372  dat.second.second = std::numeric_limits<double>::max();
373 
374  lst.push_back(dat);
375  }
377 }
378 
379 /*---------------------------------------------------------------
380  filterByExclusionAngles
381  ---------------------------------------------------------------*/
382 void CObservation2DRangeScan::filterByExclusionAngles( const std::vector<std::pair<double,double> > &angles )
383 {
384  if (angles.empty()) return;
385 
386  MRPT_START
387 
388  double Ang, dA;
389  const size_t sizeRangeScan = scan.size();
390 
392 
393  if (!sizeRangeScan) return;
394 
395  if (rightToLeft)
396  {
397  Ang = - 0.5 * aperture;
398  dA = aperture / (sizeRangeScan-1);
399  }
400  else
401  {
402  Ang = + 0.5 * aperture;
403  dA = - aperture / (sizeRangeScan-1);
404  }
405 
406  // For each forbiden angle range:
407  for (vector<pair<double,double> >::const_iterator itA=angles.begin();itA!=angles.end();++itA)
408  {
409  int ap_idx_ini = mrpt::math::wrapTo2Pi(itA->first-Ang) / dA; // The signs are all right! ;-)
410  int ap_idx_end = mrpt::math::wrapTo2Pi(itA->second-Ang) / dA;
411 
412  if (ap_idx_ini<0) ap_idx_ini=0;
413  if (ap_idx_end<0) ap_idx_end=0;
414 
415  if (ap_idx_ini>(int)sizeRangeScan) ap_idx_ini=sizeRangeScan-1;
416  if (ap_idx_end>(int)sizeRangeScan) ap_idx_end=sizeRangeScan-1;
417 
418  const size_t idx_ini = ap_idx_ini;
419  const size_t idx_end = ap_idx_end;
420 
421  if (idx_end>=idx_ini)
422  {
423  for (size_t i=idx_ini;i<=idx_end;i++)
424  m_validRange[i]=false;
425  }
426  else
427  {
428  for (size_t i=0;i<idx_end;i++)
429  m_validRange[i]=false;
430 
431  for (size_t i=idx_ini;i<sizeRangeScan;i++)
432  m_validRange[i]=false;
433  }
434  }
435 
436  MRPT_END
437 }
438 
439 namespace mrpt
440 {
441  namespace obs
442  {
443  // Tricky way to call to a library that depends on us, a sort of "run-time" linking:
444  // ptr_internal_build_points_map_from_scan2D is a functor in "mrpt-obs", set by "mrpt-maps" at its startup.
445  void OBS_IMPEXP (*ptr_internal_build_points_map_from_scan2D)(const mrpt::obs::CObservation2DRangeScan &obs, mrpt::maps::CMetricMapPtr &out_map, const void *insertOps) = NULL;
446  }
447 }
448 
449 /*---------------------------------------------------------------
450  internal_buildAuxPointsMap
451  ---------------------------------------------------------------*/
453 {
455  throw std::runtime_error("[CObservation2DRangeScan::buildAuxPointsMap] ERROR: This function needs linking against mrpt-maps.\n");
456 
457  (*ptr_internal_build_points_map_from_scan2D)(*this,m_cachedMap, options);
458 }
459 
460 /** Fill out a T2DScanProperties structure with the parameters of this scan */
462 {
463  p.nRays = this->scan.size();
464  p.aperture = this->aperture;
465  p.rightToLeft = this->rightToLeft;
466 }
467 
469 {
470  if (a.nRays != b.nRays) return a.nRays<b.nRays;
471  if (a.aperture != b.aperture) return a.aperture < b.aperture;
472  if (a.rightToLeft != b.rightToLeft) return a.rightToLeft;
473  return false;
474 }
475 
476 
478 {
480  o << "Homogeneous matrix for the sensor's 3D pose, relative to robot base:\n";
482 
483  o << format("Samples direction: %s\n", (rightToLeft) ? "Right->Left" : "Left->Right");
484  o << format("Points in the scan: %u\n", (unsigned)scan.size());
485  o << format("Estimated sensor 'sigma': %f\n", stdError );
486  o << format("Increment in pitch during the scan: %f deg\n", RAD2DEG( deltaPitch ));
487 
488  size_t i,inval = 0;
489  for (i=0;i<scan.size();i++) if (!validRange[i]) inval++;
490  o << format("Invalid points in the scan: %u\n", (unsigned)inval);
491 
492  o << format("Sensor maximum range: %.02f m\n", maxRange );
493  o << format("Sensor field-of-view (\"aperture\"): %.01f deg\n", RAD2DEG(aperture) );
494 
495  o << "Raw scan values: [";
496  for (i=0;i<scan.size();i++) o << format("%.03f ", scan[i] );
497  o << "]\n";
498 
499  o << "Raw valid-scan values: [";
500  for (i=0;i<validRange.size();i++) o << format("%u ", validRange[i] ? 1:0 );
501  o << "]\n\n";
502 
503  if(hasIntensity()){
504  o << "Raw intensity values: [";
505  for (i=0;i<m_intensity.size();i++) o << format("%d ", m_intensity[i]);
506  o << "]\n\n";
507  }
508 
509 }
510 
511 float CObservation2DRangeScan::getScanRange(const size_t i) const
512 {
513  ASSERT_BELOW_(i,m_scan.size());
514  return m_scan[i];
515 }
516 
517 void CObservation2DRangeScan::setScanRange(const size_t i, const float val)
518 {
519  ASSERT_BELOW_(i,m_scan.size());
520  m_scan[i] = val;
521 }
522 
524 {
525  ASSERT_BELOW_(i,m_intensity.size());
526  return m_intensity[i];
527 }
528 void CObservation2DRangeScan::setScanIntensity(const size_t i, const int val)
529 {
530  ASSERT_BELOW_(i,m_intensity.size());
531  m_intensity[i] = val;
532 }
533 
535 {
536  ASSERT_BELOW_(i,m_validRange.size());
537  return m_validRange[i] != 0;
538 }
539 void CObservation2DRangeScan::setScanRangeValidity(const size_t i, const bool val)
540 {
541  ASSERT_BELOW_(i,m_validRange.size());
542  m_validRange[i] = val ? 1:0;
543 }
544 
546 {
547  const size_t capacity = mrpt::utils::length2length4N(len);
548  m_scan.reserve(capacity);
549  m_intensity.reserve(capacity);
550  m_validRange.reserve(capacity);
551 
552  m_scan.resize(len);
553  m_intensity.resize(len);
554  m_validRange.resize(len);
555 }
556 
557 void CObservation2DRangeScan::resizeScanAndAssign(const size_t len, const float rangeVal, const bool rangeValidity, const int32_t rangeIntensity)
558 {
559  const size_t capacity = mrpt::utils::length2length4N(len);
560  m_scan.reserve(capacity);
561  m_intensity.reserve(capacity);
562  m_validRange.reserve(capacity);
563 
564  m_scan.assign(len, rangeVal);
565  m_validRange.assign(len, rangeValidity);
566  m_intensity.assign(len, rangeIntensity);
567 }
568 
570 {
571  return m_scan.size();
572 }
573 
574 void CObservation2DRangeScan::loadFromVectors(size_t nRays, const float *scanRanges, const char *scanValidity )
575 {
576  ASSERT_(scanRanges);
577  ASSERT_(scanValidity);
578  resizeScan(nRays);
579  for (size_t i=0;i<nRays;i++) {
580  m_scan[i] = scanRanges[i];
581  m_validRange[i] = scanValidity[i];
582  }
583 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const
Returns information about the class of an object in runtime.
void OBS_IMPEXP(* ptr_internal_build_points_map_from_scan2D)(const mrpt::obs::CObservation2DRangeScan &obs, mrpt::maps::CMetricMapPtr &out_map, const void *insertOps)
float beamAperture
The aperture of each beam, in radians, used to insert "thick" rays in the occupancy grid...
bool isHorizontal(const double tolerance=0) const
Return true if the 6D pose represents a Z axis almost exactly vertical (upwards or downwards)...
Definition: CPose3D.cpp:633
void getScanProperties(T2DScanProperties &p) const
Fill out a T2DScanProperties structure with the parameters of this scan.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void setScanRange(const size_t i, const float val)
std::vector< std::pair< mrpt::math::CPolygon, std::pair< double, double > > > TListExclusionAreasWithRanges
Used in filterByExclusionAreas.
#define ASSERT_BELOW_(__A, __B)
Scalar * iterator
Definition: eigen_plugins.h:23
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
Definition: CStream.cpp:67
bool OBS_IMPEXP operator<(const T2DScanProperties &a, const T2DScanProperties &b)
Order operator, so T2DScanProperties can appear in associative STL containers.
void setScanHasIntensity(bool setHasIntensityFlag)
Marks this scan as having or not intensity data.
STL namespace.
const Scalar * const_iterator
Definition: eigen_plugins.h:24
float stdError
The "sigma" error of the device in meters, used while inserting the scan in an occupancy grid...
void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
int32_t getScanIntensity(const size_t i) const
GLenum GLsizei len
Definition: glext.h:4349
size_t getScanSize() const
Get number of scan rays.
std::vector< char > m_validRange
It&#39;s false (=0) on no reflected rays, referenced to elements in scan.
float maxRange
The maximum range allowed by the device, in meters (e.g. 80m, 50m,...)
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
Definition: CStream.h:139
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=NULL, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
Definition: CPose3D.cpp:427
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
T length2length4N(T len)
Returns the smaller number >=len such that it&#39;s a multiple of 4.
#define M_PIf
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
#define MRPT_END
mrpt::math::CMatrixDouble44 getHomogeneousMatrixVal() const
Definition: CPose3D.h:173
bool isPlanarScan(const double tolerance=0) const
Return true if the laser scanner is "horizontal", so it has an absolute value of "pitch" and "roll" l...
Auxiliary struct that holds all the relevant geometry information about a 2D scan.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void setScanIntensity(const size_t i, const int val)
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
Definition: wrap2pi.h:40
std::vector< int32_t > m_intensity
The intensity values of the scan. If available, must have same length than validRange.
This namespace contains representation of robot actions and observations.
int val
Definition: mrpt_jpeglib.h:953
mrpt::utils::ContainerReadOnlyProxyAccessor< std::vector< char > > validRange
It&#39;s false (=0) on no reflected rays, referenced to elements in scan.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:21
GLubyte GLubyte b
Definition: glext.h:5575
#define IMPLEMENTS_MEXPLUS_FROM(complete_type)
bool m_has_intensity
Whether the intensity values are present or not. If not, space is saved during serialization.
int version
Definition: mrpt_jpeglib.h:898
#define DEG2RAD
void resizeScanAndAssign(const size_t len, const float rangeVal, const bool rangeValidity, const int32_t rangeIntensity=0)
Resizes all data vectors to allocate a given number of scan rays and assign default values...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
void filterByExclusionAngles(const std::vector< std::pair< double, double > > &angles)
Mark as invalid the ranges in any of a given set of "forbiden angle ranges", given as pairs<min_angle...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
#define MRPT_START
__int32 int32_t
Definition: rptypes.h:48
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
#define RAD2DEG
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. Where available, this should contain the accurate satellite-based time...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
virtual mxArray * writeToMatlab() const
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.
Definition: CSerializable.h:79
void truncateByDistanceAndAngle(float min_distance, float max_angle, float min_height=0, float max_height=0, float h=0)
A general method to truncate the scan by defining a minimum valid distance and a maximum valid angle ...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
Declares a class that represents any robot&#39;s observation.
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
double deltaPitch
If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...
GLuint in
Definition: glext.h:6301
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
#define ASSERT_(f)
std::vector< float > m_scan
The range values of the scan, in meters. Must have same length than validRange.
void loadFromVectors(size_t nRays, const float *scanRanges, const char *scanValidity)
void internal_buildAuxPointsMap(const void *options=NULL) const
Internal method, used from buildAuxPointsMap()
mrpt::maps::CMetricMapPtr m_cachedMap
A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap().
bool hasIntensity() const
Return true if scan has intensity.
GLenum GLint x
Definition: glext.h:3516
mrpt::utils::ContainerReadOnlyProxyAccessor< std::vector< float > > scan
The range values of the scan, in meters. Must have same length than validRange.
void filterByExclusionAreas(const TListExclusionAreas &areas)
Mark as invalid sensed points that fall within any of a set of "exclusion areas", given in coordinate...
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:30
bool rightToLeft
Angles storage order: true=counterclockwise; false=clockwise.
unsigned __int32 uint32_t
Definition: rptypes.h:49
GLubyte GLubyte GLubyte a
Definition: glext.h:5575
GLfloat GLfloat p
Definition: glext.h:5587
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling) ...
Definition: CSerializable.h:17
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
void setScanRangeValidity(const size_t i, const bool val)
bool getScanRangeValidity(const size_t i) const



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019