Main MRPT website > C++ reference for MRPT 1.4.0
maps/CReflectivityGridMap2D.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, 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#ifndef CReflectivityGridMap2D_H
11#define CReflectivityGridMap2D_H
12
13#include <mrpt/utils/CImage.h>
19#include <mrpt/obs/obs_frwds.h>
20
22
23namespace mrpt
24{
25 namespace maps
26 {
28
29 /** A 2D grid map representing the reflectivity of the environment (for example, measured with an IR proximity sensor).
30 *
31 * Important implemented features are:
32 * - Insertion of mrpt::obs::CObservationReflectivity observations.
33 * - Probability estimation of observations. See base class.
34 * - Rendering as 3D object: a 2D textured plane.
35 * - Automatic resizing of the map limits when inserting observations close to the border.
36 *
37 * Each cell contains the up-to-date average height from measured falling in that cell. Algorithms that can be used:
38 * - mrSimpleAverage: Each cell only stores the current average value.
39 * \ingroup mrpt_maps_grp
40 */
42 public CMetricMap,
43 public utils::CDynamicGrid<int8_t>,
45 {
46 // This must be added to any CSerializable derived class:
48
49 protected:
50 static CLogOddsGridMapLUT<cell_t> m_logodd_lut; //!< Lookup tables for log-odds
51
52 public:
53
54 /** Calls the base CMetricMap::clear
55 * Declared here to avoid ambiguity between the two clear() in both base classes.
56 */
57 inline void clear() { CMetricMap::clear(); }
58
59 float cell2float(const int8_t& c) const MRPT_OVERRIDE
60 {
61 return m_logodd_lut.l2p(c);
62 }
63
64 /** Constructor */
65 CReflectivityGridMap2D(double x_min = -2, double x_max = 2, double y_min = -2, double y_max = 2,double resolution = 0.1);
66
67 /** Returns true if the map is empty/no observation has been inserted. */
68 bool isEmpty() const MRPT_OVERRIDE;
69
70
71 /** Parameters related with inserting observations into the map.
72 */
73 struct MAPS_IMPEXP TInsertionOptions : public utils::CLoadableOptions
74 {
75 /** Default values loader */
77
78 void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source,const std::string &section) MRPT_OVERRIDE; // See base docs
79 void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE; // See base docs
80 } insertionOptions;
81
82 /** See docs in base class: in this class this always returns 0 */
83 float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams &params) const MRPT_OVERRIDE;
84
85 void saveMetricMapRepresentationToFile(const std::string &filNamePrefix ) const MRPT_OVERRIDE;
86
88
89 /** Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if forceRGB is true) */
90 void getAsImage( utils::CImage &img, bool verticalFlip = false, bool forceRGB=false) const;
91
92 protected:
93
94 // See docs in base class
96 bool internal_insertObservation( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose = NULL ) MRPT_OVERRIDE;
97 double internal_computeObservationLikelihood( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom ) MRPT_OVERRIDE;
98
100 double min_x,max_x,min_y,max_y,resolution; //!< See CReflectivityGridMap2DOptions::CReflectivityGridMap2DOptions
103 };
105
106
107 } // End of namespace
108
109
110} // End of namespace
111
112#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
#define MAP_DEFINITION_START(_CLASS_NAME_, _LINKAGE_)
Add a MAP_DEFINITION_START() ... MAP_DEFINITION_END() block inside the declaration of each metric map...
Declares a virtual base class for all metric maps storage classes.
void clear()
Erase all the contents of the map.
A 2D grid map representing the reflectivity of the environment (for example, measured with an IR prox...
void getAsImage(utils::CImage &img, bool verticalFlip=false, bool forceRGB=false) const
Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if ...
float cell2float(const int8_t &c) const MRPT_OVERRIDE
The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a n...
void clear()
Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both bas...
static CLogOddsGridMapLUT< cell_t > m_logodd_lut
Lookup tables for log-odds.
CReflectivityGridMap2D(double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double resolution=0.1)
Constructor
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D object representing the map.
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams &params) const MRPT_OVERRIDE
See docs in base class: in this class this always returns 0.
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const MRPT_OVERRIDE
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
bool isEmpty() const MRPT_OVERRIDE
Returns true if the map is empty/no observation has been inserted.
void internal_clear() MRPT_OVERRIDE
Internal method called by clear()
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition CPose3D.h:73
This class allows loading and storing values and vectors of different types from a configuration text...
A class for storing images as grayscale or RGB bitmaps.
Definition CImage.h:102
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition CStream.h:39
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition mrpt_macros.h:28
struct OPENGL_IMPEXP CSetOfObjectsPtr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
signed char int8_t
Definition pstdint.h:158
A generic provider of log-odds grid-map maintainance functions.
One static instance of this struct should exist in any class implementing CLogOddsGridMap2D to hold t...
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0,...
Parameters related with inserting observations into the map.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
Parameters for CMetricMap::compute3DMatchingRatio()



Page generated by Doxygen 1.9.7 for MRPT 1.4.0 SVN: at Tue Jun 13 14:27:49 UTC 2023