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::maps
22 {
23 /** A 2D grid map representing the reflectivity of the environment (for example,
24  *measured with an IR proximity sensor).
25  *
26  * Important implemented features are:
27  * - Insertion of mrpt::obs::CObservationReflectivity observations.
28  * - Probability estimation of observations. See base class.
29  * - Rendering as 3D object: a 2D textured plane.
30  * - Automatic resizing of the map limits when inserting observations close
31  *to
32  *the border.
33  *
34  * Each cell contains the up-to-date average height from measured falling in
35  *that cell. Algorithms that can be used:
36  * - mrSimpleAverage: Each cell only stores the current average value.
37  * \ingroup mrpt_maps_grp
38  */
40  public mrpt::containers::CDynamicGrid<int8_t>,
41  public CLogOddsGridMap2D<int8_t>
42 {
44 
45  protected:
46  /** Lookup tables for log-odds */
48 
49  public:
50  /** Calls the base CMetricMap::clear
51  * Declared here to avoid ambiguity between the two clear() in both base
52  * classes.
53  */
54  inline void clear() { CMetricMap::clear(); }
55  float cell2float(const int8_t& c) const override
56  {
57  return m_logodd_lut.l2p(c);
58  }
59 
60  /** Constructor */
62  double x_min = -2, double x_max = 2, double y_min = -2,
63  double y_max = 2, double resolution = 0.1);
64 
65  /** Returns true if the map is empty/no observation has been inserted. */
66  bool isEmpty() const override;
67 
68  /** Parameters related with inserting observations into the map.
69  */
71  {
72  /** Default values loader */
74 
75  void loadFromConfigFile(
77  const std::string& section) override; // See base docs
78  void dumpToTextStream(
79  std::ostream& out) const override; // See base docs
80 
81  int16_t channel; //!< The reflectivity channel for this map. If
82  //! channel=-1, then any channel will be accepted.
83  //! Otherwise, the map will ignore
84  //! CObservationReflectivity instances with a differing
85  //! channel. (Default=-1)
87 
88  /** See docs in base class: in this class this always returns 0 */
90  const mrpt::maps::CMetricMap* otherMap,
91  const mrpt::poses::CPose3D& otherMapPose,
92  const TMatchingRatioParams& params) const override;
93 
95  const std::string& filNamePrefix) const override;
96 
97  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
98 
99  /** Returns the grid as a 8-bit graylevel image, where each pixel is a cell
100  * (output image is RGB only if forceRGB is true) */
101  void getAsImage(
102  mrpt::img::CImage& img, bool verticalFlip = false,
103  bool forceRGB = false) const;
104 
105  protected:
106  // See docs in base class
107  void internal_clear() override;
109  const mrpt::obs::CObservation* obs,
110  const mrpt::poses::CPose3D* robotPose = nullptr) override;
112  const mrpt::obs::CObservation* obs,
113  const mrpt::poses::CPose3D& takenFrom) override;
114 
116  /** See CReflectivityGridMap2DOptions::CReflectivityGridMap2DOptions */
117  double min_x, max_x, min_y, max_y, resolution;
120 };
121 
122 }
123 #endif
124 
125 
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.
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
A 2D grid of dynamic size which stores any kind of data at each cell.
Definition: CDynamicGrid.h:38
CReflectivityGridMap2D(double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double resolution=0.1)
Constructor.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
#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...
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...
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.
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
GLsizei const GLchar ** string
Definition: glext.h:4101
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...
Parameters related with inserting observations into the map.
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:54
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
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.
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()
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 ...
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0...
#define MAP_DEFINITION_END(_CLASS_NAME_)
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...
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020