Main MRPT website > C++ reference for MRPT 1.9.9
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-2018, 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/img/CImage.h>
17 #include <mrpt/maps/CMetricMap.h>
19 #include <mrpt/obs/obs_frwds.h>
20 
21 namespace mrpt
22 {
23 namespace maps
24 {
25 /** A 2D grid map representing the reflectivity of the environment (for example,
26  *measured with an IR proximity sensor).
27  *
28  * Important implemented features are:
29  * - Insertion of mrpt::obs::CObservationReflectivity observations.
30  * - Probability estimation of observations. See base class.
31  * - Rendering as 3D object: a 2D textured plane.
32  * - Automatic resizing of the map limits when inserting observations close
33  *to
34  *the border.
35  *
36  * Each cell contains the up-to-date average height from measured falling in
37  *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 mrpt::containers::CDynamicGrid<int8_t>,
43  public CLogOddsGridMap2D<int8_t>
44 {
46 
47  protected:
48  /** Lookup tables for log-odds */
50 
51  public:
52  /** Calls the base CMetricMap::clear
53  * Declared here to avoid ambiguity between the two clear() in both base
54  * classes.
55  */
56  inline void clear() { CMetricMap::clear(); }
57  float cell2float(const int8_t& c) const override
58  {
59  return m_logodd_lut.l2p(c);
60  }
61 
62  /** Constructor */
64  double x_min = -2, double x_max = 2, double y_min = -2,
65  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 override;
69 
70  /** Parameters related with inserting observations into the map.
71  */
73  {
74  /** Default values loader */
76 
77  void loadFromConfigFile(
79  const std::string& section) override; // See base docs
80  void dumpToTextStream(
81  std::ostream& out) const override; // See base docs
82 
83  int16_t channel; //!< The reflectivity channel for this map. If
84  //! channel=-1, then any channel will be accepted.
85  //! Otherwise, the map will ignore
86  //! CObservationReflectivity instances with a differing
87  //! channel. (Default=-1)
89 
90  /** See docs in base class: in this class this always returns 0 */
92  const mrpt::maps::CMetricMap* otherMap,
93  const mrpt::poses::CPose3D& otherMapPose,
94  const TMatchingRatioParams& params) const override;
95 
97  const std::string& filNamePrefix) const override;
98 
99  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
100 
101  /** Returns the grid as a 8-bit graylevel image, where each pixel is a cell
102  * (output image is RGB only if forceRGB is true) */
103  void getAsImage(
104  mrpt::img::CImage& img, bool verticalFlip = false,
105  bool forceRGB = false) const;
106 
107  protected:
108  // See docs in base class
109  void internal_clear() override;
111  const mrpt::obs::CObservation* obs,
112  const mrpt::poses::CPose3D* robotPose = nullptr) override;
114  const mrpt::obs::CObservation* obs,
115  const mrpt::poses::CPose3D& takenFrom) override;
116 
118  /** See CReflectivityGridMap2DOptions::CReflectivityGridMap2DOptions */
119  double min_x, max_x, min_y, max_y, resolution;
122 };
123 
124 } // End of namespace
125 
126 } // End of namespace
127 
128 #endif
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions
Parameters related with inserting observations into the map.
Definition: CReflectivityGridMap2D.h:72
mrpt::maps::CReflectivityGridMap2D::internal_insertObservation
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
Definition: CReflectivityGridMap2D.cpp:114
mrpt::maps::CReflectivityGridMap2D::isEmpty
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
Definition: CReflectivityGridMap2D.cpp:110
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions::channel
int16_t channel
The reflectivity channel for this map.
Definition: CReflectivityGridMap2D.h:83
mrpt::maps::CLogOddsGridMapLUT::l2p
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0,...
Definition: CLogOddsGridMap2D.h:220
c
const GLubyte * c
Definition: glext.h:6313
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CReflectivityGridMap2D.cpp:283
CLogOddsGridMap2D.h
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions::TInsertionOptions
TInsertionOptions()
Default values loader.
Definition: CReflectivityGridMap2D.cpp:282
mrpt::maps::TMatchingRatioParams
Parameters for CMetricMap::compute3DMatchingRatio()
Definition: metric_map_types.h:75
mrpt::maps::CReflectivityGridMap2D::internal_computeObservationLikelihood
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
Definition: CReflectivityGridMap2D.cpp:193
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::maps::CReflectivityGridMap2D::CReflectivityGridMap2D
CReflectivityGridMap2D(double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double resolution=0.1)
Constructor
Definition: CReflectivityGridMap2D.cpp:95
int8_t
signed char int8_t
Definition: rptypes.h:40
CMetricMap.h
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::maps::CLogOddsGridMap2D
A generic provider of log-odds grid-map maintainance functions.
Definition: CLogOddsGridMap2D.h:55
mrpt::maps::CLogOddsGridMapLUT< cell_t >
mrpt::maps::CMetricMap
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:56
int16_t
__int16 int16_t
Definition: rptypes.h:43
CDynamicGrid.h
mrpt::maps::CReflectivityGridMap2D::clear
void clear()
Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both bas...
Definition: CReflectivityGridMap2D.h:56
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::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
obs_frwds.h
mrpt::maps::CReflectivityGridMap2D::m_logodd_lut
static CLogOddsGridMapLUT< cell_t > m_logodd_lut
Lookup tables for log-odds.
Definition: CReflectivityGridMap2D.h:49
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:30
mrpt::maps::CReflectivityGridMap2D::getAsImage
void getAsImage(mrpt::img::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 ...
Definition: CReflectivityGridMap2D.cpp:319
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
MAP_DEFINITION_START
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
Definition: TMetricMapTypesRegistry.h:57
mrpt::maps::CReflectivityGridMap2D::cell2float
float cell2float(const int8_t &c) const override
The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a n...
Definition: CReflectivityGridMap2D.h:57
CLoadableOptions.h
mrpt::maps::CReflectivityGridMap2D::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: CReflectivityGridMap2D.cpp:298
mrpt::containers::CDynamicGrid
A 2D grid of dynamic size which stores any kind of data at each cell.
Definition: CDynamicGrid.h:38
MAP_DEFINITION_END
#define MAP_DEFINITION_END(_CLASS_NAME_)
Definition: TMetricMapTypesRegistry.h:67
img
GLint GLvoid * img
Definition: glext.h:3763
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::maps::CReflectivityGridMap2D
A 2D grid map representing the reflectivity of the environment (for example, measured with an IR prox...
Definition: CReflectivityGridMap2D.h:41
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
string
GLsizei const GLchar ** string
Definition: glext.h:4101
CImage.h
mrpt::maps::CReflectivityGridMap2D::insertionOptions
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions insertionOptions
mrpt::maps::CMetricMap::clear
void clear()
Erase all the contents of the map.
Definition: CMetricMap.cpp:31
CSerializable.h
mrpt::maps::CReflectivityGridMap2D::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 this always returns 0.
Definition: CReflectivityGridMap2D.cpp:404
mrpt::maps::CReflectivityGridMap2D::internal_clear
void internal_clear() override
Internal method called by clear()
Definition: CReflectivityGridMap2D.cpp:106
params
GLenum const GLfloat * params
Definition: glext.h:3534
mrpt::maps::CReflectivityGridMap2D::saveMetricMapRepresentationToFile
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
Definition: CReflectivityGridMap2D.cpp:309
mrpt::maps::CReflectivityGridMap2D::getAs3DObject
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
Definition: CReflectivityGridMap2D.cpp:364



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST