MRPT  1.9.9
CGasConcentrationGridMap2D.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 
15 namespace mrpt::maps
16 {
17 /** CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D
18  * area.
19  *
20  * There are a number of methods available to build the gas grid-map,
21  * depending on the value of
22  * "TMapRepresentation maptype" passed in the constructor (see base class
23  * mrpt::maps::CRandomFieldGridMap2D).
24  *
25  * Update the map with insertIndividualReading() or insertObservation()
26  *
27  * \sa mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CMetricMap,
28  * mrpt::containers::CDynamicGrid, The application icp-slam,
29  * mrpt::maps::CMultiMetricMap
30  * \ingroup mrpt_maps_grp
31  */
33 {
35  public:
36  /** Constructor
37  */
39  TMapRepresentation mapType = mrAchim, float x_min = -2, float x_max = 2,
40  float y_min = -2, float y_max = 2, float resolution = 0.1);
41 
42  /** Destructor */
43  ~CGasConcentrationGridMap2D() override;
44 
45  /** Parameters related with inserting observations into the map:
46  */
48  public TInsertionOptionsCommon
49  {
50  /** Default values loader */
52 
53  void loadFromConfigFile(
55  const std::string& section) override; // See base docs
56  void dumpToTextStream(
57  std::ostream& out) const override; // See base docs
58 
59  /** @name For all mapping methods
60  @{ */
61  /** The label of the CObservationGasSensor used to generate the map */
63  /** id for the enose used to generate this map (must be < gasGrid_count)
64  */
65  uint16_t enose_id{0};
66  /** The sensor type for the gas concentration map (0x0000 ->mean of all
67  * installed sensors, 0x2600, 0x6810, ...) */
68  uint16_t gasSensorType{0x0000};
69  /** The label of the WindSenor used to simulate advection */
71 
72  //[Advection Options]
74  false}; //! Indicates if wind information must be used
75  //! to simulate Advection
76  float advectionFreq; //! Frequency for simulating advection (only used
77  //! to transform wind speed to distance)
78  float std_windNoise_phi{0.2f},
79  std_windNoise_mod{0.2f}; //! The std to consider on
80  //! wind information
81  //! measurements
84  1.0f}; //! The default value for the wind information
85 
86  /** @} */
87 
89 
90  /** Returns a 3D object representing the map */
91  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
92 
93  /** Returns two 3D objects representing the mean and variance maps */
94  void getAs3DObject(
96  mrpt::opengl::CSetOfObjects::Ptr& varObj) const override;
97 
98  /** Returns the 3D object representing the wind grid information */
100 
101  /** Increase the kf_std of all cells from the m_map
102  * This mehod is usually called by the main_map to simulate loss of
103  *confidence in measurements when time passes */
104  virtual void increaseUncertainty(const double STD_increase_value);
105 
106  /** Implements the transition model of the gasConcentration map using the
107  * information of the wind maps */
108  bool simulateAdvection(const double& STD_increase_value);
109 
110  // Params for the estimation of the gaussian volume in a cell.
112  {
113  int cx = 0; // x-index of the cell
114  int cy = 0; // y-index of the cell
115  float value = 0; // volume approximation
116  };
117 
118  // Params for the estimation of the wind effect on each cell of the grid
120  {
121  // Fixed params
122  float resolution = 0; // Cell_resolution. To be read from config-file
123  float std_phi = 0; // to be read from config-file
124  float std_r = 0; // to be read from config-file
125 
126  // unsigned int subcell_count; //subcell_count x subcell_count subcells
127  // float subcell_res;
128  float phi_inc = 0; // rad
129  unsigned int phi_count = 0;
130  float r_inc = 0; // m
131  float max_r = 0; // maximum distance (m)
132  unsigned int r_count = 0;
133 
134  std::vector<std::vector<std::vector<TGaussianCell>>>* table;
135  };
136 
138 
139  protected:
140  /** Get the part of the options common to all CRandomFieldGridMap2D classes
141  */
143  override
144  {
145  return &insertionOptions;
146  }
147 
148  // See docs in base class
149  void internal_clear() override;
151  const mrpt::obs::CObservation& obs,
152  const mrpt::poses::CPose3D* robotPose = nullptr) override;
154  const mrpt::obs::CObservation& obs,
155  const mrpt::poses::CPose3D& takenFrom) override;
156 
157  /** Builds a LookUp table with the values of the Gaussian Weights result of
158  * the wind advection
159  * for a specific std_windNoise_phi value.
160  */
162 
165 
166  /** Gridmaps of the wind Direction/Module */
168 
169  /** The timestamp of the last time the advection simulation was executed */
171 
173  /** See CGasConcentrationGridMap2D::CGasConcentrationGridMap2D */
174  float min_x{-2}, max_x{2}, min_y{-2}, max_y{2}, resolution{0.10f};
175  /** The kind of map representation (see
176  * CGasConcentrationGridMap2D::CGasConcentrationGridMap2D) */
179  /** Observations insertion options */
182 };
183 
184 } // namespace mrpt::maps
void internal_clear() override
Internal method called by clear()
Gaussian kernel-based estimator (see discussion in mrpt::maps::CRandomFieldGridMap2D) ...
std::string gasSensorLabel
The label of the CObservationGasSensor used to generate the map.
void getWindAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &windObj) const
Returns the 3D object representing the wind grid information.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
~CGasConcentrationGridMap2D() override
Destructor.
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
uint16_t enose_id
id for the enose used to generate this map (must be < gasGrid_count)
TMapRepresentation
The type of map representation to be used, see CRandomFieldGridMap2D for a discussion.
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
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.
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOpts
Observations insertion options.
Another alias for "mrKernelDM", for backwards compatibility (see discussion in mrpt::maps::CRandomFie...
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:40
This class allows loading and storing values and vectors of different types from a configuration text...
CGasConcentrationGridMap2D(TMapRepresentation mapType=mrAchim, float x_min=-2, float x_max=2, float y_min=-2, float y_max=2, float resolution=0.1)
Constructor.
float advectionFreq
Indicates if wind information must be used.
uint16_t gasSensorType
The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
bool simulateAdvection(const double &STD_increase_value)
Implements the transition model of the gasConcentration map using the information of the wind maps...
GLsizei const GLchar ** string
Definition: glext.h:4116
std::vector< std::vector< std::vector< TGaussianCell > > > * table
mrpt::containers::CDynamicGrid< double > windGrid_module
Gridmaps of the wind Direction/Module.
Parameters related with inserting observations into the map:
mrpt::system::TTimeStamp timeLastSimulated
The timestamp of the last time the advection simulation was executed.
CRandomFieldGridMap2D::TInsertionOptionsCommon * getCommonInsertOptions() override
Get the part of the options common to all CRandomFieldGridMap2D classes.
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::vision::TStereoCalibResults out
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
std::string windSensorLabel
The label of the WindSenor used to simulate advection.
bool build_Gaussian_Wind_Grid()
Builds a LookUp table with the values of the Gaussian Weights result of the wind advection for a spec...
GLsizei GLsizei GLchar * source
Definition: glext.h:4097
virtual void increaseUncertainty(const double STD_increase_value)
Increase the kf_std of all cells from the m_map This mehod is usually called by the main_map to simul...
mrpt::containers::CDynamicGrid< double > windGrid_direction
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
GLsizei const GLfloat * value
Definition: glext.h:4134
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area. ...
#define MAP_DEFINITION_END(_CLASS_NAME_)
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.
float std_windNoise_phi
Frequency for simulating advection (only used.
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOptions



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 4363012a5 Tue Nov 19 10:55:26 2019 +0100 at mar nov 19 11:00:13 CET 2019