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-2017, 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>
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 utils::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  mrpt::utils::CStream& 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  utils::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
void clear()
Erase all the contents of the map.
Definition: CMetricMap.cpp:31
Parameters for CMetricMap::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.
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
CReflectivityGridMap2D(double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double resolution=0.1)
Constructor.
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
signed char int8_t
Definition: rptypes.h:40
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
A 2D grid map representing the reflectivity of the environment (for example, measured with an IR prox...
This class allows loading and storing values and vectors of different types from a configuration text...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
A 2D grid of dynamic size which stores any kind of data at each cell.
Definition: CDynamicGrid.h:40
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
__int16 int16_t
Definition: rptypes.h:43
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
const GLubyte * c
Definition: glext.h:6313
GLint GLvoid * img
Definition: glext.h:3763
void clear()
Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both bas...
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:32
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
GLsizei const GLchar ** string
Definition: glext.h:4101
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.
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions insertionOptions
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
Parameters related with inserting observations into the map.
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:55
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
void internal_clear() override
Internal method called by clear()
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
int16_t channel
The reflectivity channel for this map.
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 ...
A generic provider of log-odds grid-map maintainance functions.
static CLogOddsGridMapLUT< cell_t > m_logodd_lut
Lookup tables for log-odds.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0...
GLenum const GLfloat * params
Definition: glext.h:3534
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...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019