51 sectionNamePrefix +
string(
"_creationOpts");
58 sSectCreation,
"mapType", mapType);
60 insertionOpts.loadFromConfigFile(
61 source, sectionNamePrefix +
string(
"_insertOpts"));
78 this->insertionOpts.dumpToTextStream(out);
112 double y_max,
double resolution)
128 const double x,
const double y,
const double z,
148 cell->
h = (cell->
h * W +
z) / cell->
w;
150 cell->
var = 1 / (W) * (cell->
v - pow(cell->
u, 2) / cell->
w);
194 it !=
m_map.end(); ++it)
230 it !=
m_map.end(); ++it)
232 in >> it->h >> it->w;
236 std::multimap<mrpt::system::TTimeStamp, float> history_Zs;
261 : filterByHeight(false), z_min(-0.5), z_max(0.5), colorMap(
cmJET)
272 "\n----------- [CHeightGridMap2D::TInsertionOptions] ------------ " 275 "filterByHeight = %c\n",
276 filterByHeight ?
'y' :
'n');
277 out.
printf(
"z_min = %f\n", z_min);
278 out.
printf(
"z_max = %f\n", z_max);
281 colorMap ==
cmJET ?
"jet" :
"grayscale");
294 string aux = iniFile.
read_string(section,
"colorMap",
"jet");
298 else if (
strCmp(aux,
"grayscale"))
326 mesh->setColor(0.4, 0.4, 0.4);
328 mesh->enableWireFrame(
true);
345 Z.set_unsafe(
x,
y,
c->h);
346 mask.set_unsafe(
x,
y,
c->w ? 1 : 0);
352 outObj->insert(mesh);
358 mrpt::make_aligned_shared<mrpt::opengl::CPointCloudColoured>();
359 obj->setPointSize(2);
365 K = 1.0f / (z_max - z_min);
378 const float col_idx = (
c->h - z_min) * K;
398 const size_t N =
m_map.size();
399 for (
size_t i = 0; i < N; i++)
400 if (
m_map[i].
w) obsCells++;
406 "countObservedCells() not implemented for this mapType (!?)")
414 const size_t cx,
const size_t cy,
double& z_out)
const 426 const double x,
const double y,
double& z_out)
const Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
void dumpToTextStream_map_specific(mrpt::utils::CStream &out) const override
float var
The current standard deviation of the height (in meters)
float h
The current average height (in meters)
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
Parameters for CMetricMap::compute3DMatchingRatio()
Extra params for insertIndividualPoint()
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
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.
virtual void dem_update_map() override
Ensure that all observations are reflected in the map estimate.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects ...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
TMapRepresentation
The type of map representation to be used.
#define THROW_EXCEPTION(msg)
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const override
See docs in base class: in this class it always returns 0.
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
The contents of each cell in a CHeightGridMap2D map.
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.
virtual bool dem_get_z(const double x, const double y, double &z_out) const override
Get cell 'z' (x,y) by metric coordinates.
bool strCmp(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case sensitive)
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
TMapGenericParams genericMapParams
Common params to all maps.
const Scalar * const_iterator
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.
uint32_t w
[For mrSimpleAverage model] The accumulated weight: initially zero if un-observed, increased by one for each observation
void loadFromConfigFile_map_specific(const mrpt::utils::CConfigFileBase &source, const std::string §ionNamePrefix) override
Load all map-specific params.
float v
Auxiliary (in meters)
void fill(const THeightGridmapCell &value)
Fills all the cells with the same value.
GLsizei GLsizei GLuint * obj
GLubyte GLubyte GLubyte GLubyte w
This class allows loading and storing values and vectors of different types from a configuration text...
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 ...
double idx2y(int cy) const
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOptions
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual size_t dem_get_size_x() const override
This base provides a set of functions for maths stuff.
virtual bool insertIndividualPoint(const double x, const double y, const double z, const CHeightGridMap2D_Base::TPointInsertParams ¶ms=CHeightGridMap2D_Base::TPointInsertParams()) override
Update the DEM with one new point.
mrpt::utils::TColormap colorMap
float z_min
Only when filterByHeight is true: coordinates are always RELATIVE to the robot for this filter...
A 2D grid of dynamic size which stores any kind of data at each cell.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
A helper class that can convert an enum value into its textual representation, and viceversa...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
TInsertionOptions()
Default values loader.
std::vector< THeightGridmapCell > m_map
The cells.
bool dem_internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr)
Internal method called by internal_insertObservation()
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
std::shared_ptr< CSetOfObjects > Ptr
This namespace contains representation of robot actions and observations.
virtual double dem_get_resolution() const override
float u
Auxiliary variable for storing the incremental mean value (in meters).
GLsizei const GLchar ** string
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...
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
mrpt::maps::CHeightGridMap2D::TMapRepresentation mapType
The kind of map representation (see CHeightGridMap2D::CHeightGridMap2D)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
std::shared_ptr< CMesh > Ptr
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
GLdouble GLdouble GLdouble r
virtual size_t dem_get_size_y() const override
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
Declares a virtual base class for all metric maps storage classes.
bool filterByHeight
Whether to perform filtering by z-coordinate (default=false): coordinates are always RELATIVE to the ...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
bool saveToTextFile(const std::string &fileName) const
Saves a float representation of the grid (via "cell2float()") to a text file.
void internal_clear() override
Internal method called by clear()
GLsizei GLsizei GLchar * source
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...
A matrix of dynamic size.
void dyngridcommon_writeToStream(mrpt::utils::CStream &out) const
TMapRepresentation m_mapType
The map representation type of this map.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
GLsizei const GLfloat * value
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOpts
#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...
double min_x
See CHeightGridMap2D::CHeightGridMap2D.
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
unsigned __int32 uint32_t
size_t countObservedCells() const
Return the number of cells with at least one height data inserted.
void dyngridcommon_readFromStream(mrpt::utils::CStream &in, bool cast_from_float=false)
bool getMinMaxHeight(float &z_min, float &z_max) const
Computes the minimum and maximum height in the grid.
std::shared_ptr< CPointCloudColoured > Ptr
GLenum const GLfloat * params
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
void HEIGHTGRIDMAP_EXPORT3D_AS_MESH(bool value)
If set to true (default), mrpt::maps::CHeightGridMap2D will be exported as a opengl::CMesh, otherwise, as a opengl::CPointCloudColoured Affects to:
bool HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value