MRPT  1.9.9
CReflectivityGridMap2D.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
14 #include <mrpt/img/CImage.h>
16 #include <mrpt/maps/CMetricMap.h>
17 #include <mrpt/obs/obs_frwds.h>
19 
20 namespace mrpt::maps
21 {
22 /** A 2D grid map representing the reflectivity of the environment (for example,
23  *measured with an IR proximity sensor).
24  *
25  * Important implemented features are:
26  * - Insertion of mrpt::obs::CObservationReflectivity observations.
27  * - Probability estimation of observations. See base class.
28  * - Rendering as 3D object: a 2D textured plane.
29  * - Automatic resizing of the map limits when inserting observations close
30  *to
31  *the border.
32  *
33  * Each cell contains the up-to-date average height from measured falling in
34  *that cell. Algorithms that can be used:
35  * - mrSimpleAverage: Each cell only stores the current average value.
36  * \ingroup mrpt_maps_grp
37  */
39  public mrpt::containers::CDynamicGrid<int8_t>,
40  public CLogOddsGridMap2D<int8_t>
41 {
43 
44  protected:
45  /** Lookup tables for log-odds */
47 
48  public:
49  /** Calls the base CMetricMap::clear
50  * Declared here to avoid ambiguity between the two clear() in both base
51  * classes.
52  */
53  inline void clear() { CMetricMap::clear(); }
54  float cell2float(const int8_t& c) const override
55  {
56  return m_logodd_lut.l2p(c);
57  }
58 
59  /** Constructor */
61  double x_min = -2, double x_max = 2, double y_min = -2,
62  double y_max = 2, double resolution = 0.1);
63 
64  /** Returns true if the map is empty/no observation has been inserted. */
65  bool isEmpty() const override;
66 
67  /** Parameters related with inserting observations into the map.
68  */
70  {
71  /** Default values loader */
73 
74  void loadFromConfigFile(
76  const std::string& section) override; // See base docs
77  void dumpToTextStream(
78  std::ostream& out) const override; // See base docs
79 
80  int16_t channel{-1}; //!< The reflectivity channel for this map. If
81  //! channel=-1, then any channel will be accepted.
82  //! Otherwise, the map will ignore
83  //! CObservationReflectivity instances with a differing
84  //! channel. (Default=-1)
86 
87  /** See docs in base class: in this class this always returns 0 */
89  const mrpt::maps::CMetricMap* otherMap,
90  const mrpt::poses::CPose3D& otherMapPose,
91  const TMatchingRatioParams& params) const override;
92 
94  const std::string& filNamePrefix) const override;
95 
96  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
97 
98  /** Returns the grid as a 8-bit graylevel image, where each pixel is a cell
99  * (output image is RGB only if forceRGB is true) */
100  void getAsImage(
101  mrpt::img::CImage& img, bool verticalFlip = false,
102  bool forceRGB = false) const;
103 
104  protected:
105  // See docs in base class
106  void internal_clear() override;
108  const mrpt::obs::CObservation& obs,
109  const mrpt::poses::CPose3D* robotPose = nullptr) override;
111  const mrpt::obs::CObservation& obs,
112  const mrpt::poses::CPose3D& takenFrom) override;
113 
115  /** See CReflectivityGridMap2DOptions::CReflectivityGridMap2DOptions */
116  double min_x{-10.0f}, max_x{10.0f}, min_y{-10.0f}, max_y{10.0f},
117  resolution{0.10f};
120 };
121 
122 } // namespace mrpt::maps
void clear()
Erase all the contents of the map.
Definition: CMetricMap.cpp:30
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
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
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:43
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:46
const GLubyte * c
Definition: glext.h:6406
GLint GLvoid * img
Definition: glext.h:3769
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.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
GLsizei const GLchar ** string
Definition: glext.h:4116
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions insertionOptions
#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:52
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
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:4097
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.
mrpt::maps::CReflectivityGridMap2D::TInsertionOptions insertionOpts
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:3538
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:147



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 928d0abbd Sun Oct 13 02:28:49 2019 +0200 at dom oct 13 02:30:11 CEST 2019