Go to the documentation of this file.
39 const std::string& sectionNamePrefix)
42 const std::string sSectCreation =
43 sectionNamePrefix + string(
"_creationOpts");
50 sSectCreation,
"mapType", mapType);
52 insertionOpts.loadFromConfigFile(
53 source, sectionNamePrefix +
string(
"_insertOpts"));
57 std::ostream&
out)
const
70 this->insertionOpts.dumpToTextStream(
out);
104 double y_max,
double resolution)
120 const double x,
const double y,
const double zz,
127 const float z =
d2f(zz);
141 cell->
h = (cell->
h * W + z) / cell->
w;
143 cell->
var = (cell->
v -
d2f(pow(cell->
u, 2)) / cell->
w) / W;
160 [[maybe_unused]]
const CPose3D& takenFrom)
175 n =
static_cast<uint32_t
>(
m_map.size());
177 for (
const auto& it :
m_map)
209 for (
auto& it :
m_map)
215 std::multimap<mrpt::system::TTimeStamp, float> history_Zs;
241 std::ostream&
out)
const
243 out <<
"\n----------- [CHeightGridMap2D::TInsertionOptions] ------------ "
246 "filterByHeight = %c\n",
249 "z_min = %f\n",
z_min);
251 "z_max = %f\n",
z_max);
267 string aux =
iniFile.read_string(section,
"colorMap",
"jet");
271 else if (
strCmp(aux,
"grayscale"))
279 const std::string& filNamePrefix)
const
299 mesh->setColor(0.4f, 0.4f, 0.4f);
301 mesh->enableWireFrame(
true);
312 for (
size_t x = 0; x <
m_size_x; x++)
314 for (
size_t y = 0; y <
m_size_y; y++)
319 mask(x, y) = c->
w ? 1 : 0;
325 outObj->insert(mesh);
332 obj->setPointSize(2);
338 K = 1.0f / (z_max - z_min);
343 for (
size_t x = 0; x <
m_size_x; x++)
344 for (
size_t y = 0; y <
m_size_y; y++)
351 const float col_idx = (c->
h - z_min) * K;
371 const size_t N =
m_map.size();
372 for (
size_t i = 0; i < N; i++)
373 if (
m_map[i].w) obsCells++;
379 "countObservedCells() not implemented for this mapType (!?)");
387 const size_t cx,
const size_t cy,
double& z_out)
const
399 const double x,
const double y,
double& z_out)
const
float v
Auxiliary (in meters)
double min_x
See CHeightGridMap2D::CHeightGridMap2D.
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOptions
std::shared_ptr< mrpt::opengl ::CSetOfObjects > Ptr
#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...
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects
void internal_clear() override
Internal method called by clear()
float z_min
Only when filterByHeight is true: coordinates are always RELATIVE to the robot for this filter.
void dumpToTextStream_map_specific(std::ostream &out) const override
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.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
void setSize(size_t row, size_t col, bool zeroNewElements=false)
Changes the size of matrix, maintaining the previous contents.
bool strCmp(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case sensitive)
std::shared_ptr< mrpt::opengl ::CPointCloudColoured > Ptr
Extra params for insertIndividualPoint()
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
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.
mrpt::maps::CHeightGridMap2D::TMapRepresentation mapType
The kind of map representation (see CHeightGridMap2D::CHeightGridMap2D)
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
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 ...
Parameters for CMetricMap::compute3DMatchingRatio()
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
mrpt::vision::TStereoCalibResults out
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
TMapGenericParams genericMapParams
Common params to all maps.
#define THROW_EXCEPTION(msg)
#define ASSERT_(f)
Defines an assertion mechanism.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::vector< THeightGridmapCell > m_map
The cells
std::shared_ptr< mrpt::opengl ::CMesh > Ptr
This namespace contains representation of robot actions and observations.
The contents of each cell in a CHeightGridMap2D map.
Virtual base class for "archives": classes abstracting I/O streams.
TMapRepresentation m_mapType
The map representation type of this map.
bool filterByHeight
Whether to perform filtering by z-coordinate (default=false): coordinates are always RELATIVE to the ...
float var
The current standard deviation of the height (in meters)
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
Declares a virtual base class for all metric maps storage classes.
Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
size_t countObservedCells() const
Return the number of cells with at least one height data inserted.
static Ptr Create(Args &&... args)
This class allows loading and storing values and vectors of different types from a configuration text...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
string iniFile(myDataDir+string("benchmark-options.ini"))
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
TMapRepresentation
The type of map representation to be used.
float d2f(const double d)
shortcut for static_cast<float>(double)
float h
The current average height (in meters)
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 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.
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
ENUMTYPE read_enum(const std::string §ion, 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...
mrpt::vision::TStereoCalibParams params
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
bool getMinMaxHeight(float &z_min, float &z_max) const
Computes the minimum and maximum height in the grid.
void dem_update_map() override
Ensure that all observations are reflected in the map estimate.
void dyngridcommon_writeToStream(STREAM &out) const
size_t dem_get_size_y() const override
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
double idx2y(int cy) const
bool saveToTextFile(const std::string &fileName) const
Saves a float representation of the grid (via "cell2float()") to a text file.
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,...
void fill(const THeightGridmapCell &value)
Fills all the cells with the same value.
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...
void dyngridcommon_readFromStream(STREAM &in, bool cast_from_float=false)
void loadFromConfigFile_map_specific(const mrpt::config::CConfigFileBase &source, const std::string §ionNamePrefix) override
Load all map-specific params.
float u
Auxiliary variable for storing the incremental mean value (in meters).
bool HEIGHTGRIDMAP_EXPORT3D_AS_MESH_value
void HEIGHTGRIDMAP_EXPORT3D_AS_MESH(bool value)
If set to true (default), mrpt::maps::CHeightGridMap2D will be exported as a opengl::CMesh,...
bool dem_get_z(const double x, const double y, double &z_out) const override
Get cell 'z' (x,y) by metric coordinates.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
mrpt::img::TColormap colorMap
Declares a class that represents any robot's observation.
This base provides a set of functions for maths stuff.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
TInsertionOptions()
Default values loader.
bool dem_internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr)
Internal method called by internal_insertObservation()
uint32_t w
[For mrSimpleAverage model] The accumulated weight: initially zero if un-observed,...
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.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
double dem_get_resolution() const override
mrpt::maps::CHeightGridMap2D::TInsertionOptions insertionOpts
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
This template class provides the basic functionality for a general 2D any-size, resizable container o...
size_t dem_get_size_x() const override
std::string std::string format(std::string_view fmt, ARGS &&... args)
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 15:15:43 UTC 2020 | |