56 insertionOpts.loadFromConfigFile(
source, sectionNamePrefix+
string(
"_insertOpts") );
68 this->insertionOpts.dumpToTextStream(out);
90 double x_min,
double x_max,
91 double y_min,
double y_max,
118 if(!cell)
return false;
120 if (!insertionOptions.filterByHeight || (
z>=insertionOptions.z_min &&
z<=insertionOptions.z_max ) )
132 cell->
h = (cell->
h*W +
z)/cell->
w;
134 cell->
var = 1/(W) * (cell->
v - pow(cell->
u,2)/cell->
w);
142 return dem_internal_insertObservation(obs,robotPose);
167 dyngridcommon_writeToStream(out);
177 out << it->h << it->w;
182 out << insertionOptions.filterByHeight
183 << insertionOptions.z_min
184 << insertionOptions.z_max;
186 out << genericMapParams;
202 dyngridcommon_readFromStream(
in,
version<3);
213 in >> it->h >> it->w;
217 std::multimap<mrpt::system::TTimeStamp,float> history_Zs;
227 in >> insertionOptions.filterByHeight
228 >> insertionOptions.z_min
229 >> insertionOptions.z_max;
232 in >> genericMapParams;
246 filterByHeight ( false ),
258 out.
printf(
"\n----------- [CHeightGridMap2D::TInsertionOptions] ------------ \n\n");
259 out.
printf(
"filterByHeight = %c\n", filterByHeight ?
'y':
'n');
260 out.
printf(
"z_min = %f\n", z_min);
261 out.
printf(
"z_max = %f\n", z_max);
262 out.
printf(
"colormap = %s\n", colorMap ==
cmJET ?
"jet" :
"grayscale");
276 string aux = iniFile.
read_string(section,
"colorMap",
"jet");
280 else if(
strCmp(aux,
"grayscale") )
307 mesh->setColor(0.4, 0.4, 0.4 );
309 mesh->enableWireFrame(
true);
326 Z.set_unsafe(
x,
y,
c->h );
327 mask.set_unsafe(
x,
y,
c->w ? 1:0 );
333 outObj->insert( mesh );
339 obj->setPointSize(2);
345 K = 1.0f/(z_max-z_min);
357 const float col_idx = (
c->h-z_min)*K;
365 outObj->insert(
obj );
377 const size_t N =
m_map.size();
378 for (
size_t i=0;i<N;i++)
384 default:
THROW_EXCEPTION(
"countObservedCells() not implemented for this mapType (!?)")
399 if (cell && cell->
w) {
407 if (cell && cell->
w) {
Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
void loadFromConfigFile_map_specific(const mrpt::utils::CConfigFileBase &source, const std::string §ionNamePrefix)
Load all map-specific params.
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.
EIGEN_STRONG_INLINE void fill(const Scalar v)
virtual double dem_get_resolution() const MRPT_OVERRIDE
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 ...
TMapRepresentation
The type of map representation to be used.
#define THROW_EXCEPTION(msg)
virtual bool insertIndividualPoint(const double x, const double y, const double z, const CHeightGridMap2D_Base::TPointInsertParams ¶ms=CHeightGridMap2D_Base::TPointInsertParams()) MRPT_OVERRIDE
Update the DEM with one new point.
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
void internal_clear() MRPT_OVERRIDE
Internal method called by clear()
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
The contents of each cell in a CHeightGridMap2D map.
void dumpToTextStream_map_specific(mrpt::utils::CStream &out) const
bool BASE_IMPEXP 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 saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const MRPT_OVERRIDE
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
void BASE_IMPEXP 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
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
float v
Auxiliary (in meters)
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 NULL if it is out of the map...
double idx2y(int cy) const
MAPS_IMPEXP bool HEIGHTGRIDMAP_EXPORT3D_AS_MESH
If set to true (default), mrpt::maps::CHeightGridMap2D will be exported as a opengl::CMesh, otherwise, as a opengl::CPointCloudColoured Affects to:
virtual void dem_update_map() MRPT_OVERRIDE
Ensure that all observations are reflected in the map estimate.
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOptions
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
mrpt::utils::TColormap colorMap
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.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
A helper class that can convert an enum value into its textual representation, and viceversa...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
Internal method called by insertObservation()
TInsertionOptions()
Default values loader.
std::vector< THeightGridmapCell > m_map
The cells.
virtual size_t dem_get_size_y() const MRPT_OVERRIDE
This namespace contains representation of robot actions and observations.
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D object representing the map: by default, it will be a mrpt::opengl::CMesh object...
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 NULL if it is out of the ma...
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
bool isEmpty() const MRPT_OVERRIDE
Returns true if the map is empty/no observation has been inserted.
virtual size_t dem_get_size_x() const MRPT_OVERRIDE
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)
#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...
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const MRPT_OVERRIDE
See docs in base class: in this class it always returns 0.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual bool dem_get_z(const double x, const double y, double &z_out) const MRPT_OVERRIDE
Get cell 'z' (x,y) by metric coordinates.
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) MRPT_OVERRIDE
Internal method called by computeObservationLikelihood()
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
GLdouble GLdouble GLdouble r
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
Declares a virtual base class for all metric maps storage classes.
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 readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
GLsizei GLsizei GLchar * source
A matrix of dynamic size.
TMapRepresentation m_mapType
The map representation type of this map.
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOpts
unsigned __int32 uint32_t
size_t countObservedCells() const
Return the number of cells with at least one height data inserted.
bool getMinMaxHeight(float &z_min, float &z_max) const
Computes the minimum and maximum height in the grid.
double resolution
See CHeightGridMap2D::CHeightGridMap2D.
GLenum const GLfloat * params
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
virtual bool dem_get_z_by_cell(const size_t cx, const size_t cy, double &z_out) const MRPT_OVERRIDE
Get cell 'z' by (cx,cy) cell indices.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
static CPointCloudColouredPtr Create()