Main MRPT website > C++ reference for MRPT 1.9.9
CHeightGridMap2D.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "maps-precomp.h" // Precomp header
11 
13 #include <mrpt/config/CConfigFileBase.h> // MRPT_LOAD_CONFIG_VAR()
14 #include <mrpt/poses/CPose3D.h>
16 #include <mrpt/opengl/CMesh.h>
18 #include <mrpt/img/color_maps.h>
20 
21 using namespace mrpt::maps;
22 using namespace mrpt::obs;
23 using namespace mrpt::poses;
24 using namespace mrpt::img;
25 using namespace mrpt::math;
26 using namespace mrpt::system;
27 using namespace std;
28 
29 // =========== Begin of Map definition ============
31  "CHeightGridMap2D,heightMap,dem", mrpt::maps::CHeightGridMap2D)
32 
34  : min_x(-2),
35  max_x(2),
36  min_y(-2),
37  max_y(2),
38  resolution(0.10f),
39  mapType(CHeightGridMap2D::mrSimpleAverage)
40 {
41 }
42 
45  const std::string& sectionNamePrefix)
46 {
47  // [<sectionNamePrefix>+"_creationOpts"]
48  const std::string sSectCreation =
49  sectionNamePrefix + string("_creationOpts");
50  MRPT_LOAD_CONFIG_VAR(min_x, double, source, sSectCreation);
51  MRPT_LOAD_CONFIG_VAR(max_x, double, source, sSectCreation);
52  MRPT_LOAD_CONFIG_VAR(min_y, double, source, sSectCreation);
53  MRPT_LOAD_CONFIG_VAR(max_y, double, source, sSectCreation);
54  MRPT_LOAD_CONFIG_VAR(resolution, double, source, sSectCreation);
55  mapType = source.read_enum<CHeightGridMap2D::TMapRepresentation>(
56  sSectCreation, "mapType", mapType);
57 
58  insertionOpts.loadFromConfigFile(
59  source, sectionNamePrefix + string("_insertOpts"));
60 }
61 
63  std::ostream& out) const
64 {
65  LOADABLEOPTS_DUMP_VAR(min_x, double);
66  LOADABLEOPTS_DUMP_VAR(max_x, double);
67  LOADABLEOPTS_DUMP_VAR(min_y, double);
68  LOADABLEOPTS_DUMP_VAR(max_y, double);
69  LOADABLEOPTS_DUMP_VAR(resolution, double);
70  out << mrpt::format(
71  "MAP TYPE = %s\n",
73  CHeightGridMap2D::TMapRepresentation>::value2name(mapType)
74  .c_str());
75 
76  this->insertionOpts.dumpToTextStream(out);
77 }
78 
81 {
83  *dynamic_cast<const CHeightGridMap2D::TMapDefinition*>(&_def);
85  def.mapType, def.min_x, def.max_x, def.min_y, def.max_y,
86  def.resolution);
87  obj->insertionOptions = def.insertionOpts;
88  return obj;
89 }
90 // =========== End of Map definition Block =========
91 
93 
95 
96 bool mrpt::global_settings::HEIGHTGRIDMAP_EXPORT3D_AS_MESH()
97 {
99 }
101 {
103 }
104 
105 /*---------------------------------------------------------------
106  Constructor
107  ---------------------------------------------------------------*/
109  TMapRepresentation mapType, double x_min, double x_max, double y_min,
110  double y_max, double resolution)
111  : CDynamicGrid<THeightGridmapCell>(x_min, x_max, y_min, y_max, resolution),
112  insertionOptions(),
113  m_mapType(mapType)
114 {
115 }
116 
117 /*---------------------------------------------------------------
118  clear
119  ---------------------------------------------------------------*/
121 /*---------------------------------------------------------------
122  isEmpty
123  ---------------------------------------------------------------*/
124 bool CHeightGridMap2D::isEmpty() const { return false; }
126  const double x, const double y, const double z,
128 {
129  THeightGridmapCell* cell = cellByPos(x, y);
130  if (!cell)
131  return false; // Out of the map: Ignore if we've not resized before.
132 
135  {
136  cell->u += z;
137  cell->v += z * z;
138  if (!cell->w)
139  {
140  cell->h = z; // First observation
141  cell->w = 1;
142  }
143  else
144  {
145  float W = cell->w++; // W = N-1
146  cell->h = (cell->h * W + z) / cell->w;
147  if (W > 0)
148  cell->var = 1 / (W) * (cell->v - pow(cell->u, 2) / cell->w);
149  }
150  } // end if really inserted
151  return true;
152 }
153 
155  const CObservation* obs, const CPose3D* robotPose)
156 {
157  return dem_internal_insertObservation(obs, robotPose);
158 }
159 
160 /*---------------------------------------------------------------
161  computeObservationLikelihood
162  ---------------------------------------------------------------*/
164  const CObservation* obs, const CPose3D& takenFrom)
165 {
166  MRPT_UNUSED_PARAM(obs);
167  MRPT_UNUSED_PARAM(takenFrom);
168 
169  THROW_EXCEPTION("Not implemented yet!");
170 }
171 
174 {
176 
177  // To assure compatibility: The size of each cell:
178  uint32_t n = static_cast<uint32_t>(sizeof(THeightGridmapCell));
179  out << n;
180 
181  // Save the map contents:
182  n = static_cast<uint32_t>(m_map.size());
183  out << n;
185  it != m_map.end(); ++it)
186  out << it->h
187  << it->w; // This was removed in version 1: << it->history_Zs;
188 
189  // Save the insertion options:
190  out << uint8_t(m_mapType);
191 
194 
195  out << genericMapParams; // v2
196 }
197 
200 {
201  switch (version)
202  {
203  case 0:
204  case 1:
205  case 2:
206  case 3:
207  {
208  dyngridcommon_readFromStream(in, version < 3);
209  // To ensure compatibility: The size of each cell:
210  uint32_t n;
211  in >> n;
212  ASSERT_(n == static_cast<uint32_t>(sizeof(THeightGridmapCell)));
213 
214  // Save the map contents:
215  in >> n;
216  m_map.resize(n);
218  it != m_map.end(); ++it)
219  {
220  in >> it->h >> it->w;
221  // Data member in version 0:
222  if (version == 0)
223  {
224  std::multimap<mrpt::system::TTimeStamp, float> history_Zs;
225  in >> history_Zs; // Discarded now...
226  }
227  }
228 
229  // Insertion options:
230  uint8_t ty;
231  in >> ty;
233 
236 
237  if (version >= 2) in >> genericMapParams;
238  }
239  break;
240  default:
242  };
243 }
244 
246  : filterByHeight(false), z_min(-0.5), z_max(0.5), colorMap(cmJET)
247 {
248 }
249 
251  std::ostream& out) const
252 {
253  out << mrpt::format(
254  "\n----------- [CHeightGridMap2D::TInsertionOptions] ------------ "
255  "\n\n");
256  out << mrpt::format(
257  "filterByHeight = %c\n",
258  filterByHeight ? 'y' : 'n');
259  out << mrpt::format(
260  "z_min = %f\n", z_min);
261  out << mrpt::format(
262  "z_max = %f\n", z_max);
263  out << mrpt::format(
264  "colormap = %s\n",
265  colorMap == cmJET ? "jet" : "grayscale");
266  out << mrpt::format("\n");
267 }
268 
269 /*---------------------------------------------------------------
270  loadFromConfigFile
271  ---------------------------------------------------------------*/
273  const mrpt::config::CConfigFileBase& iniFile, const std::string& section)
274 {
275  MRPT_LOAD_CONFIG_VAR(filterByHeight, bool, iniFile, section)
276  MRPT_LOAD_CONFIG_VAR(z_min, float, iniFile, section)
277  MRPT_LOAD_CONFIG_VAR(z_max, float, iniFile, section)
278  string aux = iniFile.read_string(section, "colorMap", "jet");
279 
280  if (strCmp(aux, "jet"))
281  colorMap = cmJET;
282  else if (strCmp(aux, "grayscale"))
283  colorMap = cmGRAYSCALE;
284 }
285 
286 /*---------------------------------------------------------------
287  saveMetricMapRepresentationToFile
288  ---------------------------------------------------------------*/
290  const std::string& filNamePrefix) const
291 {
292  // Text matrix:
293  saveToTextFile(filNamePrefix + std::string("_mean.txt"));
294 }
295 
296 /*---------------------------------------------------------------
297  getAs3DObject
298 ---------------------------------------------------------------*/
300  mrpt::opengl::CSetOfObjects::Ptr& outObj) const
301 {
303 
305  {
306  opengl::CMesh::Ptr mesh = mrpt::make_aligned_shared<opengl::CMesh>();
307 
308  mesh->setGridLimits(m_x_min, m_x_max, m_y_min, m_y_max);
309 
310  mesh->setColor(0.4, 0.4, 0.4);
311 
312  mesh->enableWireFrame(true);
313  mesh->enableColorFromZ(true, insertionOptions.colorMap /*cmJET*/);
314 
315  CMatrixFloat Z, mask;
316  /*mesh->getZ(Z);
317 
318  mesh->getMask(mask);*/
319 
320  Z.setSize(m_size_x, m_size_y);
321  mask.setSize(m_size_x, m_size_y);
322 
323  for (size_t x = 0; x < m_size_x; x++)
324  {
325  for (size_t y = 0; y < m_size_y; y++)
326  {
327  const THeightGridmapCell* c = cellByIndex(x, y);
328  ASSERTDEB_(c);
329  Z.set_unsafe(x, y, c->h);
330  mask.set_unsafe(x, y, c->w ? 1 : 0);
331  }
332  }
333  mesh->setZ(Z);
334  mesh->setMask(mask);
335 
336  outObj->insert(mesh);
337  }
338  else
339  {
340  // As points:
342  mrpt::make_aligned_shared<mrpt::opengl::CPointCloudColoured>();
343  obj->setPointSize(2);
344 
345  // Find min/max:
346  float z_min, z_max;
347  float K;
348  if (this->getMinMaxHeight(z_min, z_max))
349  K = 1.0f / (z_max - z_min);
350  else
351  K = 1.0f;
352 
353  obj->reserve(m_size_x * m_size_y);
354  for (size_t x = 0; x < m_size_x; x++)
355  for (size_t y = 0; y < m_size_y; y++)
356  {
357  const THeightGridmapCell* c = cellByIndex(x, y);
358  ASSERTDEB_(c);
359  if (c->w)
360  {
361  float r, g, b;
362  const float col_idx = (c->h - z_min) * K;
363  colormap(
364  insertionOptions.colorMap, // cmJET, //cmGRAYSCALE,
365  col_idx, r, g, b);
366  obj->push_back(idx2x(x), idx2y(y), c->h, r, g, b);
367  }
368  }
369 
370  outObj->insert(obj);
371  }
372 }
373 
374 /** Return the number of cells with at least one height data inserted. */
376 {
377  switch (m_mapType)
378  {
379  case mrSimpleAverage:
380  {
381  size_t obsCells = 0;
382  const size_t N = m_map.size();
383  for (size_t i = 0; i < N; i++)
384  if (m_map[i].w) obsCells++;
385  return obsCells;
386  }
387  break;
388  default:
390  "countObservedCells() not implemented for this mapType (!?)")
391  };
392 }
393 
395 size_t CHeightGridMap2D::dem_get_size_x() const { return m_size_x; }
396 size_t CHeightGridMap2D::dem_get_size_y() const { return m_size_y; }
398  const size_t cx, const size_t cy, double& z_out) const
399 {
400  const THeightGridmapCell* cell = cellByIndex(cx, cy);
401  if (cell && cell->w)
402  {
403  z_out = cell->h;
404  return true;
405  }
406  else
407  return false;
408 }
410  const double x, const double y, double& z_out) const
411 {
412  const THeightGridmapCell* cell = cellByPos(x, y);
413  if (cell && cell->w)
414  {
415  z_out = cell->h;
416  return true;
417  }
418  else
419  {
420  return false;
421  }
422 }
424 {
425  // Nothing to do in this class: estimate is always up-to-date
426 }
427 
429  const mrpt::maps::CMetricMap* otherMap,
430  const mrpt::poses::CPose3D& otherMapPose,
431  const TMatchingRatioParams& params) const
432 {
433  MRPT_UNUSED_PARAM(otherMap);
434  MRPT_UNUSED_PARAM(otherMapPose);
436  return 0;
437 }
n
GLenum GLsizei n
Definition: glext.h:5074
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_size_y
size_t m_size_y
Definition: CDynamicGrid.h:51
mrpt::maps::THeightGridmapCell::v
float v
Auxiliary (in meters)
Definition: CHeightGridMap2D.h:38
const_iterator
const Scalar * const_iterator
Definition: eigen_plugins.h:27
mrpt::maps::CHeightGridMap2D::TMapDefinition::min_x
double min_x
See CHeightGridMap2D::CHeightGridMap2D.
Definition: CHeightGridMap2D.h:168
mrpt::maps::CHeightGridMap2D::insertionOptions
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOptions
mrpt::maps::CHeightGridMap2D::TMapDefinition::resolution
double resolution
Definition: CHeightGridMap2D.h:168
MRPT_LOAD_CONFIG_VAR
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
Definition: config/CConfigFileBase.h:282
mrpt::maps::TMapGenericParams::enableSaveAs3DObject
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects
Definition: metric_map_types.h:95
mrpt::maps::CHeightGridMap2D::internal_clear
void internal_clear() override
Internal method called by clear()
Definition: CHeightGridMap2D.cpp:120
mrpt::maps::CHeightGridMap2D::TInsertionOptions::z_min
float z_min
Only when filterByHeight is true: coordinates are always RELATIVE to the robot for this filter.
Definition: CHeightGridMap2D.h:114
mrpt::maps::CHeightGridMap2D::TMapDefinition::dumpToTextStream_map_specific
void dumpToTextStream_map_specific(std::ostream &out) const override
Definition: CHeightGridMap2D.cpp:62
mrpt::img::colormap
void colormap(const TColormap &color_map, const float color_index, float &r, float &g, float &b)
Transform a float number in the range [0,1] into RGB components.
Definition: color_maps.cpp:113
mrpt::maps::CHeightGridMap2D::TInsertionOptions::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: CHeightGridMap2D.cpp:272
mrpt::system::strCmp
bool strCmp(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case sensitive)
Definition: string_utils.cpp:299
c
const GLubyte * c
Definition: glext.h:6313
mrpt::maps::CHeightGridMap2D_Base::TPointInsertParams
Extra params for insertIndividualPoint()
Definition: CHeightGridMap2D_Base.h:42
color_maps.h
mrpt::maps::CHeightGridMap2D::internal_insertObservation
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
Definition: CHeightGridMap2D.cpp:154
CPointCloudColoured.h
MAP_DEFINITION_REGISTER
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
Definition: TMetricMapTypesRegistry.h:91
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::maps::CHeightGridMap2D::TMapDefinition
Definition: CHeightGridMap2D.h:166
mrpt::maps::CHeightGridMap2D::dem_get_z_by_cell
virtual bool dem_get_z_by_cell(const size_t cx, const size_t cy, double &z_out) const override
Get cell 'z' by (cx,cy) cell indices.
Definition: CHeightGridMap2D.cpp:397
mrpt::maps::CHeightGridMap2D::TMapDefinition::mapType
mrpt::maps::CHeightGridMap2D::TMapRepresentation mapType
The kind of map representation (see CHeightGridMap2D::CHeightGridMap2D)
Definition: CHeightGridMap2D.h:171
MRPT_UNUSED_PARAM
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
Definition: common.h:186
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_x_max
double m_x_max
Definition: CDynamicGrid.h:50
mrpt::containers::CDynamicGrid< THeightGridmapCell >::cellByPos
THeightGridmapCell * cellByPos(double x, double y)
Returns a pointer to the contents of a cell given by its coordinates, or nullptr if it is out of the ...
Definition: CDynamicGrid.h:211
mrpt::maps::TMatchingRatioParams
Parameters for CMetricMap::compute3DMatchingRatio()
Definition: metric_map_types.h:75
mrpt::maps::CHeightGridMap2D::isEmpty
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
Definition: CHeightGridMap2D.cpp:124
stl_serialization.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
g
GLubyte g
Definition: glext.h:6279
w
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
mrpt::maps::TMetricMapInitializer
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
Definition: TMetricMapInitializer.h:34
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_resolution
double m_resolution
Definition: CDynamicGrid.h:50
uint8_t
unsigned char uint8_t
Definition: rptypes.h:41
mrpt::maps::CMetricMap::genericMapParams
TMapGenericParams genericMapParams
Common params to all maps.
Definition: CMetricMap.h:282
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_y_max
double m_y_max
Definition: CDynamicGrid.h:50
THROW_EXCEPTION
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:41
ASSERT_
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:25
mrpt::opengl::CPointCloudColoured::Ptr
std::shared_ptr< CPointCloudColoured > Ptr
Definition: CPointCloudColoured.h:49
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_map
std::vector< THeightGridmapCell > m_map
The cells
Definition: CDynamicGrid.h:42
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::maps::THeightGridmapCell
The contents of each cell in a CHeightGridMap2D map.
Definition: CHeightGridMap2D.h:28
ty
GLbyte ty
Definition: glext.h:6092
mrpt::serialization::CArchive
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::maps::CHeightGridMap2D::m_mapType
TMapRepresentation m_mapType
The map representation type of this map.
Definition: CHeightGridMap2D.h:155
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_size_x
size_t m_size_x
Definition: CDynamicGrid.h:51
mrpt::maps::CHeightGridMap2D::TInsertionOptions::filterByHeight
bool filterByHeight
Whether to perform filtering by z-coordinate (default=false): coordinates are always RELATIVE to the ...
Definition: CHeightGridMap2D.h:111
mrpt::math::CMatrixTemplateNumeric
A matrix of dynamic size.
Definition: CMatrixTemplateNumeric.h:37
mrpt::maps::THeightGridmapCell::var
float var
The current standard deviation of the height (in meters)
Definition: CHeightGridMap2D.h:33
mrpt::maps::CHeightGridMap2D::saveMetricMapRepresentationToFile
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
Definition: CHeightGridMap2D.cpp:289
r
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
CConfigFileBase.h
mrpt::maps::CMetricMap
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:56
mrpt::maps::CHeightGridMap2D
Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
Definition: CHeightGridMap2D.h:63
mrpt::img
Definition: CCanvas.h:17
mrpt::maps::CHeightGridMap2D::mrSimpleAverage
@ mrSimpleAverage
Definition: CHeightGridMap2D.h:85
mrpt::maps::CHeightGridMap2D::countObservedCells
size_t countObservedCells() const
Return the number of cells with at least one height data inserted.
Definition: CHeightGridMap2D.cpp:375
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::maps::CHeightGridMap2D::TMapDefinition::max_x
double max_x
Definition: CHeightGridMap2D.h:168
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
b
GLubyte GLubyte b
Definition: glext.h:6279
iniFile
string iniFile(myDataDir+string("benchmark-options.ini"))
mrpt::containers::CDynamicGrid< THeightGridmapCell >::idx2x
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
Definition: CDynamicGrid.h:289
mrpt::typemeta::TEnumType
A helper class that can convert an enum value into its textual representation, and viceversa.
Definition: config/CConfigFileBase.h:24
mrpt::maps::CHeightGridMap2D::TMapRepresentation
TMapRepresentation
The type of map representation to be used.
Definition: CHeightGridMap2D.h:83
mrpt::maps::THeightGridmapCell::h
float h
The current average height (in meters)
Definition: CHeightGridMap2D.h:31
mrpt::maps::CHeightGridMap2D::compute3DMatchingRatio
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams &params) const override
See docs in base class: in this class it always returns 0.
Definition: CHeightGridMap2D.cpp:428
mask
GLenum GLint GLuint mask
Definition: glext.h:4050
mrpt::maps::CHeightGridMap2D::insertIndividualPoint
virtual bool insertIndividualPoint(const double x, const double y, const double z, const CHeightGridMap2D_Base::TPointInsertParams &params=CHeightGridMap2D_Base::TPointInsertParams()) override
Update the DEM with one new point.
Definition: CHeightGridMap2D.cpp:125
LOADABLEOPTS_DUMP_VAR
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
Definition: config/CLoadableOptions.h:103
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:30
mrpt::maps::CHeightGridMap2D::TInsertionOptions::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CHeightGridMap2D.cpp:250
IMPLEMENTS_SERIALIZABLE
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Definition: CSerializable.h:114
mrpt::maps::CHeightGridMap2D_Base::getMinMaxHeight
bool getMinMaxHeight(float &z_min, float &z_max) const
Computes the minimum and maximum height in the grid.
Definition: CHeightGridMap2D_Base.cpp:28
mrpt::maps::CHeightGridMap2D::dem_update_map
virtual void dem_update_map() override
Ensure that all observations are reflected in the map estimate.
Definition: CHeightGridMap2D.cpp:423
mrpt::containers::CDynamicGrid< THeightGridmapCell >::dyngridcommon_writeToStream
void dyngridcommon_writeToStream(STREAM &out) const
Definition: CDynamicGrid.h:343
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_x_min
double m_x_min
Definition: CDynamicGrid.h:50
CPose3D.h
mrpt::maps::CHeightGridMap2D_Base::dem_internal_insertObservation
bool dem_internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr)
Internal method called by internal_insertObservation()
Definition: CHeightGridMap2D_Base.cpp:128
mrpt::img::cmGRAYSCALE
@ cmGRAYSCALE
Undefined colormap [New in MRPT 2.0].
Definition: color_maps.h:34
mrpt::maps::CHeightGridMap2D::dem_get_size_y
virtual size_t dem_get_size_y() const override
Definition: CHeightGridMap2D.cpp:396
mrpt::maps::CHeightGridMap2D::internal_CreateFromMapDefinition
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
Definition: CHeightGridMap2D.cpp:79
mrpt::maps::CHeightGridMap2D::TMapDefinition::min_y
double min_y
Definition: CHeightGridMap2D.h:168
mrpt::containers::CDynamicGrid< THeightGridmapCell >::idx2y
double idx2y(int cy) const
Definition: CDynamicGrid.h:293
mrpt::containers::CDynamicGrid< THeightGridmapCell >::saveToTextFile
bool saveToTextFile(const std::string &fileName) const
Saves a float representation of the grid (via "cell2float()") to a text file.
Definition: CDynamicGrid.h:323
mrpt::maps::CHeightGridMap2D::getAs3DObject
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map: by default, it will be a mrpt::opengl::CMesh object,...
Definition: CHeightGridMap2D.cpp:299
mrpt::containers::CDynamicGrid< THeightGridmapCell >::fill
void fill(const THeightGridmapCell &value)
Fills all the cells with the same value.
Definition: CDynamicGrid.h:117
CHeightGridMap2D.h
mrpt::containers::CDynamicGrid< THeightGridmapCell >::cellByIndex
THeightGridmapCell * cellByIndex(unsigned int cx, unsigned int cy)
Returns a pointer to the contents of a cell given by its cell indexes, or nullptr if it is out of the...
Definition: CDynamicGrid.h:232
mrpt::containers::CDynamicGrid< THeightGridmapCell >::dyngridcommon_readFromStream
void dyngridcommon_readFromStream(STREAM &in, bool cast_from_float=false)
Definition: CDynamicGrid.h:351
mrpt::maps::CHeightGridMap2D::TMapDefinition::loadFromConfigFile_map_specific
void loadFromConfigFile_map_specific(const mrpt::config::CConfigFileBase &source, const std::string &sectionNamePrefix) override
Load all map-specific params.
Definition: CHeightGridMap2D.cpp:43
mrpt::maps::CHeightGridMap2D::internal_computeObservationLikelihood
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
Definition: CHeightGridMap2D.cpp:163
maps-precomp.h
mrpt::maps::THeightGridmapCell::u
float u
Auxiliary variable for storing the incremental mean value (in meters).
Definition: CHeightGridMap2D.h:36
value
GLsizei const GLfloat * value
Definition: glext.h:4117
HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value
bool HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value
Definition: CHeightGridMap2D.cpp:94
mrpt::global_settings::HEIGHTGRIDMAP_EXPORT3D_AS_MESH
void HEIGHTGRIDMAP_EXPORT3D_AS_MESH(bool value)
If set to true (default), mrpt::maps::CHeightGridMap2D will be exported as a opengl::CMesh,...
Definition: CHeightGridMap2D.cpp:100
mrpt::maps::CHeightGridMap2D::dem_get_z
virtual bool dem_get_z(const double x, const double y, double &z_out) const override
Get cell 'z' (x,y) by metric coordinates.
Definition: CHeightGridMap2D.cpp:409
mrpt::maps::CHeightGridMap2D::serializeTo
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Definition: CHeightGridMap2D.cpp:173
mrpt::maps::CHeightGridMap2D::TInsertionOptions::colorMap
mrpt::img::TColormap colorMap
Definition: CHeightGridMap2D.h:116
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:13
z
GLdouble GLdouble z
Definition: glext.h:3872
in
GLuint in
Definition: glext.h:7274
ASSERTDEB_
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: exceptions.h:205
mrpt::img::cmJET
@ cmJET
Definition: color_maps.h:35
mrpt::maps::CHeightGridMap2D::TInsertionOptions::TInsertionOptions
TInsertionOptions()
Default values loader.
Definition: CHeightGridMap2D.cpp:245
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::maps
Definition: CBeacon.h:24
iterator
Scalar * iterator
Definition: eigen_plugins.h:26
mrpt::maps::THeightGridmapCell::w
uint32_t w
[For mrSimpleAverage model] The accumulated weight: initially zero if un-observed,...
Definition: CHeightGridMap2D.h:41
mrpt::maps::CHeightGridMap2D::CHeightGridMap2D
CHeightGridMap2D(TMapRepresentation mapType=mrSimpleAverage, double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double resolution=0.1)
Constructor.
Definition: CHeightGridMap2D.cpp:108
CArchive.h
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
CMesh.h
mrpt::maps::CHeightGridMap2D::serializeGetVersion
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
Definition: CHeightGridMap2D.cpp:172
mrpt::maps::CHeightGridMap2D::dem_get_resolution
virtual double dem_get_resolution() const override
Definition: CHeightGridMap2D.cpp:394
mrpt::opengl::CMesh::Ptr
std::shared_ptr< CMesh > Ptr
Definition: CMesh.h:41
mrpt::maps::CHeightGridMap2D::TMapDefinition::max_y
double max_y
Definition: CHeightGridMap2D.h:168
mrpt::maps::CHeightGridMap2D::TMapDefinition::insertionOpts
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOpts
Definition: CHeightGridMap2D.h:172
mrpt::maps::CHeightGridMap2D::serializeFrom
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Definition: CHeightGridMap2D.cpp:198
mrpt::maps::CHeightGridMap2D::TInsertionOptions::z_max
float z_max
Definition: CHeightGridMap2D.h:114
y
GLenum GLint GLint y
Definition: glext.h:3538
uint32_t
unsigned __int32 uint32_t
Definition: rptypes.h:47
x
GLenum GLint x
Definition: glext.h:3538
mrpt::maps::CHeightGridMap2D::dem_get_size_x
virtual size_t dem_get_size_x() const override
Definition: CHeightGridMap2D.cpp:395
mrpt::system
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Definition: math_frwds.h:25
params
GLenum const GLfloat * params
Definition: glext.h:3534
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_y_min
double m_y_min
Definition: CDynamicGrid.h:50



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