MRPT  2.0.3
CHeightGridMap2D.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "maps-precomp.h" // Precomp header
11 
12 #include <mrpt/config/CConfigFileBase.h> // MRPT_LOAD_CONFIG_VAR()
13 #include <mrpt/img/color_maps.h>
15 #include <mrpt/opengl/CMesh.h>
17 #include <mrpt/poses/CPose3D.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  "mrpt::maps::CHeightGridMap2D,heightMap,dem", mrpt::maps::CHeightGridMap2D)
32 
34 
35  = default;
36 
38  const mrpt::config::CConfigFileBase& source,
39  const std::string& sectionNamePrefix)
40 {
41  // [<sectionNamePrefix>+"_creationOpts"]
42  const std::string sSectCreation =
43  sectionNamePrefix + string("_creationOpts");
44  MRPT_LOAD_CONFIG_VAR(min_x, double, source, sSectCreation);
45  MRPT_LOAD_CONFIG_VAR(max_x, double, source, sSectCreation);
46  MRPT_LOAD_CONFIG_VAR(min_y, double, source, sSectCreation);
47  MRPT_LOAD_CONFIG_VAR(max_y, double, source, sSectCreation);
48  MRPT_LOAD_CONFIG_VAR(resolution, double, source, sSectCreation);
50  sSectCreation, "mapType", mapType);
51 
52  insertionOpts.loadFromConfigFile(
53  source, sectionNamePrefix + string("_insertOpts"));
54 }
55 
57  std::ostream& out) const
58 {
59  LOADABLEOPTS_DUMP_VAR(min_x, double);
60  LOADABLEOPTS_DUMP_VAR(max_x, double);
61  LOADABLEOPTS_DUMP_VAR(min_y, double);
62  LOADABLEOPTS_DUMP_VAR(max_y, double);
63  LOADABLEOPTS_DUMP_VAR(resolution, double);
64  out << mrpt::format(
65  "MAP TYPE = %s\n",
67  CHeightGridMap2D::TMapRepresentation>::value2name(mapType)
68  .c_str());
69 
70  this->insertionOpts.dumpToTextStream(out);
71 }
72 
75 {
77  *dynamic_cast<const CHeightGridMap2D::TMapDefinition*>(&_def);
78  auto* obj = new CHeightGridMap2D(
79  def.mapType, def.min_x, def.max_x, def.min_y, def.max_y,
80  def.resolution);
81  obj->insertionOptions = def.insertionOpts;
82  return obj;
83 }
84 // =========== End of Map definition Block =========
85 
87 
89 
90 bool mrpt::global_settings::HEIGHTGRIDMAP_EXPORT3D_AS_MESH()
91 {
93 }
95 {
97 }
98 
99 /*---------------------------------------------------------------
100  Constructor
101  ---------------------------------------------------------------*/
103  TMapRepresentation mapType, double x_min, double x_max, double y_min,
104  double y_max, double resolution)
105  : CDynamicGrid<THeightGridmapCell>(x_min, x_max, y_min, y_max, resolution),
106  insertionOptions(),
107  m_mapType(mapType)
108 {
109 }
110 
111 /*---------------------------------------------------------------
112  clear
113  ---------------------------------------------------------------*/
115 /*---------------------------------------------------------------
116  isEmpty
117  ---------------------------------------------------------------*/
118 bool CHeightGridMap2D::isEmpty() const { return false; }
120  const double x, const double y, const double zz,
122 {
123  THeightGridmapCell* cell = cellByPos(x, y);
124  if (!cell)
125  return false; // Out of the map: Ignore if we've not resized before.
126 
127  const float z = d2f(zz);
130  {
131  cell->u += z;
132  cell->v += z * z;
133  if (!cell->w)
134  {
135  cell->h = z; // First observation
136  cell->w = 1;
137  }
138  else
139  {
140  float W = cell->w++; // W = N-1
141  cell->h = (cell->h * W + z) / cell->w;
142  if (W > 0)
143  cell->var = (cell->v - d2f(pow(cell->u, 2)) / cell->w) / W;
144  }
145  } // end if really inserted
146  return true;
147 }
148 
150  const CObservation& obs, const CPose3D* robotPose)
151 {
152  return dem_internal_insertObservation(obs, robotPose);
153 }
154 
155 /*---------------------------------------------------------------
156  computeObservationLikelihood
157  ---------------------------------------------------------------*/
159  [[maybe_unused]] const CObservation& obs,
160  [[maybe_unused]] const CPose3D& takenFrom)
161 {
162  THROW_EXCEPTION("Not implemented yet!");
163 }
164 
165 uint8_t CHeightGridMap2D::serializeGetVersion() const { return 3; }
167 {
169 
170  // To assure compatibility: The size of each cell:
171  auto n = static_cast<uint32_t>(sizeof(THeightGridmapCell));
172  out << n;
173 
174  // Save the map contents:
175  n = static_cast<uint32_t>(m_map.size());
176  out << n;
177  for (const auto& it : m_map)
178  out << it.h
179  << it.w; // This was removed in version 1: << it->history_Zs;
180 
181  // Save the insertion options:
182  out << uint8_t(m_mapType);
183 
186 
187  out << genericMapParams; // v2
188 }
189 
191  mrpt::serialization::CArchive& in, uint8_t version)
192 {
193  switch (version)
194  {
195  case 0:
196  case 1:
197  case 2:
198  case 3:
199  {
200  dyngridcommon_readFromStream(in, version < 3);
201  // To ensure compatibility: The size of each cell:
202  uint32_t n;
203  in >> n;
204  ASSERT_(n == static_cast<uint32_t>(sizeof(THeightGridmapCell)));
205 
206  // Save the map contents:
207  in >> n;
208  m_map.resize(n);
209  for (auto& it : m_map)
210  {
211  in >> it.h >> it.w;
212  // Data member in version 0:
213  if (version == 0)
214  {
215  std::multimap<mrpt::system::TTimeStamp, float> history_Zs;
216  in >> history_Zs; // Discarded now...
217  }
218  }
219 
220  // Insertion options:
221  uint8_t ty;
222  in >> ty;
224 
227 
228  if (version >= 2) in >> genericMapParams;
229  }
230  break;
231  default:
233  };
234 }
235 
237 
238  = default;
239 
241  std::ostream& out) const
242 {
243  out << "\n----------- [CHeightGridMap2D::TInsertionOptions] ------------ "
244  "\n\n";
245  out << mrpt::format(
246  "filterByHeight = %c\n",
247  filterByHeight ? 'y' : 'n');
248  out << mrpt::format(
249  "z_min = %f\n", z_min);
250  out << mrpt::format(
251  "z_max = %f\n", z_max);
252  out << mrpt::format(
253  "colormap = %s\n",
254  colorMap == cmJET ? "jet" : "grayscale");
255  out << "\n";
256 }
257 
258 /*---------------------------------------------------------------
259  loadFromConfigFile
260  ---------------------------------------------------------------*/
262  const mrpt::config::CConfigFileBase& iniFile, const std::string& section)
263 {
264  MRPT_LOAD_CONFIG_VAR(filterByHeight, bool, iniFile, section)
265  MRPT_LOAD_CONFIG_VAR(z_min, float, iniFile, section)
266  MRPT_LOAD_CONFIG_VAR(z_max, float, iniFile, section)
267  string aux = iniFile.read_string(section, "colorMap", "jet");
268 
269  if (strCmp(aux, "jet"))
270  colorMap = cmJET;
271  else if (strCmp(aux, "grayscale"))
272  colorMap = cmGRAYSCALE;
273 }
274 
275 /*---------------------------------------------------------------
276  saveMetricMapRepresentationToFile
277  ---------------------------------------------------------------*/
279  const std::string& filNamePrefix) const
280 {
281  // Text matrix:
282  saveToTextFile(filNamePrefix + std::string("_mean.txt"));
283 }
284 
285 /*---------------------------------------------------------------
286  getAs3DObject
287 ---------------------------------------------------------------*/
289  mrpt::opengl::CSetOfObjects::Ptr& outObj) const
290 {
292 
294  {
295  opengl::CMesh::Ptr mesh = std::make_shared<opengl::CMesh>();
296 
297  mesh->setGridLimits(m_x_min, m_x_max, m_y_min, m_y_max);
298 
299  mesh->setColor(0.4f, 0.4f, 0.4f);
300 
301  mesh->enableWireFrame(true);
302  mesh->enableColorFromZ(true, insertionOptions.colorMap /*cmJET*/);
303 
304  CMatrixFloat Z, mask;
305  /*mesh->getZ(Z);
306 
307  mesh->getMask(mask);*/
308 
310  mask.setSize(m_size_x, m_size_y);
311 
312  for (size_t x = 0; x < m_size_x; x++)
313  {
314  for (size_t y = 0; y < m_size_y; y++)
315  {
316  const THeightGridmapCell* c = cellByIndex(x, y);
317  ASSERTDEB_(c);
318  Z(x, y) = c->h;
319  mask(x, y) = c->w ? 1 : 0;
320  }
321  }
322  mesh->setZ(Z);
323  mesh->setMask(mask);
324 
325  outObj->insert(mesh);
326  }
327  else
328  {
329  // As points:
332  obj->setPointSize(2);
333 
334  // Find min/max:
335  float z_min, z_max;
336  float K;
337  if (this->getMinMaxHeight(z_min, z_max))
338  K = 1.0f / (z_max - z_min);
339  else
340  K = 1.0f;
341 
342  obj->reserve(m_size_x * m_size_y);
343  for (size_t x = 0; x < m_size_x; x++)
344  for (size_t y = 0; y < m_size_y; y++)
345  {
346  const THeightGridmapCell* c = cellByIndex(x, y);
347  ASSERTDEB_(c);
348  if (c->w)
349  {
350  float r, g, b;
351  const float col_idx = (c->h - z_min) * K;
352  colormap(
353  insertionOptions.colorMap, // cmJET, //cmGRAYSCALE,
354  col_idx, r, g, b);
355  obj->push_back(idx2x(x), idx2y(y), c->h, r, g, b);
356  }
357  }
358 
359  outObj->insert(obj);
360  }
361 }
362 
363 /** Return the number of cells with at least one height data inserted. */
365 {
366  switch (m_mapType)
367  {
368  case mrSimpleAverage:
369  {
370  size_t obsCells = 0;
371  const size_t N = m_map.size();
372  for (size_t i = 0; i < N; i++)
373  if (m_map[i].w) obsCells++;
374  return obsCells;
375  }
376  break;
377  default:
379  "countObservedCells() not implemented for this mapType (!?)");
380  };
381 }
382 
384 size_t CHeightGridMap2D::dem_get_size_x() const { return m_size_x; }
385 size_t CHeightGridMap2D::dem_get_size_y() const { return m_size_y; }
387  const size_t cx, const size_t cy, double& z_out) const
388 {
389  const THeightGridmapCell* cell = cellByIndex(cx, cy);
390  if (cell && cell->w)
391  {
392  z_out = cell->h;
393  return true;
394  }
395  else
396  return false;
397 }
399  const double x, const double y, double& z_out) const
400 {
401  const THeightGridmapCell* cell = cellByPos(x, y);
402  if (cell && cell->w)
403  {
404  z_out = cell->h;
405  return true;
406  }
407  else
408  {
409  return false;
410  }
411 }
413 {
414  // Nothing to do in this class: estimate is always up-to-date
415 }
416 
418  [[maybe_unused]] const mrpt::maps::CMetricMap* otherMap,
419  [[maybe_unused]] const mrpt::poses::CPose3D& otherMapPose,
420  [[maybe_unused]] const TMatchingRatioParams& params) const
421 {
422  return 0;
423 }
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:37
mrpt::maps::CHeightGridMap2D::TMapDefinition::min_x
double min_x
See CHeightGridMap2D::CHeightGridMap2D.
Definition: CHeightGridMap2D.h:167
mrpt::maps::CHeightGridMap2D::insertionOptions
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOptions
mrpt::maps::CHeightGridMap2D::TMapDefinition::resolution
double resolution
Definition: CHeightGridMap2D.h:167
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< mrpt::opengl ::CSetOfObjects > Ptr
Definition: CSetOfObjects.h:28
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:306
mrpt::maps::TMapGenericParams::enableSaveAs3DObject
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects
Definition: metric_map_types.h:84
mrpt::maps::CHeightGridMap2D::internal_clear
void internal_clear() override
Internal method called by clear()
Definition: CHeightGridMap2D.cpp:114
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:113
mrpt::maps::CHeightGridMap2D::TMapDefinition::dumpToTextStream_map_specific
void dumpToTextStream_map_specific(std::ostream &out) const override
Definition: CHeightGridMap2D.cpp:56
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:114
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:261
mrpt::math::CMatrixDynamic::setSize
void setSize(size_t row, size_t col, bool zeroNewElements=false)
Changes the size of matrix, maintaining the previous contents.
Definition: CMatrixDynamic.h:352
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
mrpt::opengl::CPointCloudColoured::Ptr
std::shared_ptr< mrpt::opengl ::CPointCloudColoured > Ptr
Definition: CPointCloudColoured.h:48
mrpt::maps::CHeightGridMap2D_Base::TPointInsertParams
Extra params for insertIndividualPoint()
Definition: CHeightGridMap2D_Base.h:40
color_maps.h
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
mrpt::maps::CHeightGridMap2D::TMapDefinition
Definition: CHeightGridMap2D.h:165
mrpt::maps::CHeightGridMap2D::dem_get_z_by_cell
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:386
mrpt::maps::CHeightGridMap2D::TMapDefinition::mapType
mrpt::maps::CHeightGridMap2D::TMapRepresentation mapType
The kind of map representation (see CHeightGridMap2D::CHeightGridMap2D)
Definition: CHeightGridMap2D.h:170
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:149
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:201
mrpt::maps::TMatchingRatioParams
Parameters for CMetricMap::compute3DMatchingRatio()
Definition: metric_map_types.h:64
mrpt::maps::CHeightGridMap2D::isEmpty
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
Definition: CHeightGridMap2D.cpp:118
stl_serialization.h
out
mrpt::vision::TStereoCalibResults out
Definition: chessboard_stereo_camera_calib_unittest.cpp:25
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: BaseAppDataSource.h:15
mrpt::maps::TMetricMapInitializer
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
Definition: TMetricMapInitializer.h:32
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_resolution
double m_resolution
Definition: CDynamicGrid.h:50
mrpt::maps::CMetricMap::genericMapParams
TMapGenericParams genericMapParams
Common params to all maps.
Definition: CMetricMap.h:274
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_y_max
double m_y_max
Definition: CDynamicGrid.h:50
mrpt::maps::CHeightGridMap2D::TMapDefinition::TMapDefinition
TMapDefinition()
THROW_EXCEPTION
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:67
ASSERT_
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:120
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:158
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:22
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_map
std::vector< THeightGridmapCell > m_map
The cells
Definition: CDynamicGrid.h:42
mrpt::opengl::CMesh::Ptr
std::shared_ptr< mrpt::opengl ::CMesh > Ptr
Definition: CMesh.h:40
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:27
mrpt::serialization::CArchive
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:54
mrpt::maps::CHeightGridMap2D::m_mapType
TMapRepresentation m_mapType
The map representation type of this map.
Definition: CHeightGridMap2D.h:154
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:110
mrpt::maps::THeightGridmapCell::var
float var
The current standard deviation of the height (in meters)
Definition: CHeightGridMap2D.h:32
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:278
CConfigFileBase.h
mrpt::maps::CMetricMap
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:52
mrpt::maps::CHeightGridMap2D
Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
Definition: CHeightGridMap2D.h:62
mrpt::img
Definition: CCanvas.h:16
mrpt::maps::CHeightGridMap2D::mrSimpleAverage
@ mrSimpleAverage
Definition: CHeightGridMap2D.h:84
mrpt::maps::CHeightGridMap2D::countObservedCells
size_t countObservedCells() const
Return the number of cells with at least one height data inserted.
Definition: CHeightGridMap2D.cpp:364
mrpt::opengl::CPointCloudColoured::Create
static Ptr Create(Args &&... args)
Definition: CPointCloudColoured.h:48
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:167
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
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:279
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:82
mrpt::d2f
float d2f(const double d)
shortcut for static_cast<float>(double)
Definition: core/include/mrpt/core/bits_math.h:189
mrpt::maps::THeightGridmapCell::h
float h
The current average height (in meters)
Definition: CHeightGridMap2D.h:30
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:417
mrpt::maps::CHeightGridMap2D::insertIndividualPoint
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:119
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:101
mrpt::config::CConfigFileBase::read_enum
ENUMTYPE read_enum(const std::string &section, const std::string &name, const ENUMTYPE &defaultValue, bool failIfNotFound=false) const
Reads an "enum" value, where the value in the config file can be either a numerical value or the symb...
Definition: config/CConfigFileBase.h:269
params
mrpt::vision::TStereoCalibParams params
Definition: chessboard_stereo_camera_calib_unittest.cpp:24
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:240
IMPLEMENTS_SERIALIZABLE
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
Definition: CSerializable.h:166
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
void dem_update_map() override
Ensure that all observations are reflected in the map estimate.
Definition: CHeightGridMap2D.cpp:412
mrpt::containers::CDynamicGrid< THeightGridmapCell >::dyngridcommon_writeToStream
void dyngridcommon_writeToStream(STREAM &out) const
Definition: CDynamicGrid.h:334
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_x_min
double m_x_min
Definition: CDynamicGrid.h:50
CPose3D.h
mrpt::img::cmGRAYSCALE
@ cmGRAYSCALE
Definition: color_maps.h:34
mrpt::maps::CHeightGridMap2D::dem_get_size_y
size_t dem_get_size_y() const override
Definition: CHeightGridMap2D.cpp:385
mrpt::maps::CHeightGridMap2D::internal_CreateFromMapDefinition
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
Definition: CHeightGridMap2D.cpp:73
mrpt::maps::CHeightGridMap2D::TMapDefinition::min_y
double min_y
Definition: CHeightGridMap2D.h:167
mrpt::containers::CDynamicGrid< THeightGridmapCell >::idx2y
double idx2y(int cy) const
Definition: CDynamicGrid.h:283
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:313
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:288
mrpt::containers::CDynamicGrid< THeightGridmapCell >::fill
void fill(const THeightGridmapCell &value)
Fills all the cells with the same value.
Definition: CDynamicGrid.h:109
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:222
mrpt::containers::CDynamicGrid< THeightGridmapCell >::dyngridcommon_readFromStream
void dyngridcommon_readFromStream(STREAM &in, bool cast_from_float=false)
Definition: CDynamicGrid.h:342
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:37
maps-precomp.h
mrpt::maps::THeightGridmapCell::u
float u
Auxiliary variable for storing the incremental mean value (in meters).
Definition: CHeightGridMap2D.h:35
HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value
bool HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value
Definition: CHeightGridMap2D.cpp:88
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:94
mrpt::maps::CHeightGridMap2D::dem_get_z
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:398
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:166
mrpt::maps::CHeightGridMap2D::TInsertionOptions::colorMap
mrpt::img::TColormap colorMap
Definition: CHeightGridMap2D.h:115
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:11
ASSERTDEB_
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: exceptions.h:190
mrpt::img::cmJET
@ cmJET
Definition: color_maps.h:35
mrpt::maps::CHeightGridMap2D::TInsertionOptions::TInsertionOptions
TInsertionOptions()
Default values loader.
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::maps
Definition: CBeacon.h:21
mrpt::maps::THeightGridmapCell::w
uint32_t w
[For mrSimpleAverage model] The accumulated weight: initially zero if un-observed,...
Definition: CHeightGridMap2D.h:40
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:102
CArchive.h
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:97
CMesh.h
mrpt::maps::CHeightGridMap2D::serializeGetVersion
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
Definition: CHeightGridMap2D.cpp:165
mrpt::maps::CHeightGridMap2D::dem_get_resolution
double dem_get_resolution() const override
Definition: CHeightGridMap2D.cpp:383
mrpt::maps::CHeightGridMap2D::TMapDefinition::max_y
double max_y
Definition: CHeightGridMap2D.h:167
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:190
mrpt::maps::CHeightGridMap2D::TInsertionOptions::z_max
float z_max
Definition: CHeightGridMap2D.h:113
mrpt::math::CMatrixDynamic
This template class provides the basic functionality for a general 2D any-size, resizable container o...
Definition: CMatrixDynamic.h:39
mrpt::maps::CHeightGridMap2D::dem_get_size_x
size_t dem_get_size_x() const override
Definition: CHeightGridMap2D.cpp:384
mrpt::format
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
mrpt::system
Definition: backtrace.h:14
mrpt::containers::CDynamicGrid< THeightGridmapCell >::m_y_min
double m_y_min
Definition: CDynamicGrid.h:50



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020