MRPT  2.0.4
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-2020, 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.1f);
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(
54  const mrpt::config::CConfigFileBase& source,
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 */
62  std::string gasSensorLabel;
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 */
70  std::string windSensorLabel;
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(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
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::std_windNoise_phi
float std_windNoise_phi
Frequency for simulating advection (only used.
Definition: CGasConcentrationGridMap2D.h:78
mrpt::maps::CGasConcentrationGridMap2D::getAs3DObject
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
Definition: CGasConcentrationGridMap2D.cpp:547
mrpt::maps::CGasConcentrationGridMap2D::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: CGasConcentrationGridMap2D.cpp:489
mrpt::maps::CGasConcentrationGridMap2D
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.
Definition: CGasConcentrationGridMap2D.h:32
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< mrpt::opengl ::CSetOfObjects > Ptr
Definition: CSetOfObjects.h:28
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions
Parameters related with inserting observations into the map:
Definition: CGasConcentrationGridMap2D.h:47
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::useWindInformation
bool useWindInformation
Definition: CGasConcentrationGridMap2D.h:73
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:152
CObservationGasSensors.h
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::std_r
float std_r
Definition: CGasConcentrationGridMap2D.h:124
mrpt::maps::CRandomFieldGridMap2D::TInsertionOptionsCommon
Parameters common to any derived class.
Definition: CRandomFieldGridMap2D.h:242
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::table
std::vector< std::vector< std::vector< TGaussianCell > > > * table
Definition: CGasConcentrationGridMap2D.h:134
mrpt::maps::CGasConcentrationGridMap2D::LUT
TGaussianWindTable LUT
Definition: CGasConcentrationGridMap2D.h:137
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::enose_id
uint16_t enose_id
id for the enose used to generate this map (must be < gasGrid_count)
Definition: CGasConcentrationGridMap2D.h:65
out
mrpt::vision::TStereoCalibResults out
Definition: chessboard_stereo_camera_calib_unittest.cpp:25
mrpt::maps::CGasConcentrationGridMap2D::getWindAs3DObject
void getWindAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &windObj) const
Returns the 3D object representing the wind grid information.
Definition: CGasConcentrationGridMap2D.cpp:572
mrpt::maps::CGasConcentrationGridMap2D::CGasConcentrationGridMap2D
CGasConcentrationGridMap2D(TMapRepresentation mapType=mrAchim, float x_min=-2, float x_max=2, float y_min=-2, float y_max=2, float resolution=0.1f)
Constructor.
mrpt::maps::CGasConcentrationGridMap2D::windGrid_module
mrpt::containers::CDynamicGrid< double > windGrid_module
Gridmaps of the wind Direction/Module.
Definition: CGasConcentrationGridMap2D.h:167
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::std_phi
float std_phi
Definition: CGasConcentrationGridMap2D.h:123
mrpt::maps::CGasConcentrationGridMap2D::getCommonInsertOptions
CRandomFieldGridMap2D::TInsertionOptionsCommon * getCommonInsertOptions() override
Get the part of the options common to all CRandomFieldGridMap2D classes.
Definition: CGasConcentrationGridMap2D.h:142
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CGasConcentrationGridMap2D.cpp:447
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::r_count
unsigned int r_count
Definition: CGasConcentrationGridMap2D.h:132
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::phi_count
unsigned int phi_count
Definition: CGasConcentrationGridMap2D.h:129
mrpt::maps::CGasConcentrationGridMap2D::TGaussianCell
Definition: CGasConcentrationGridMap2D.h:111
mrpt::maps::CGasConcentrationGridMap2D::increaseUncertainty
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...
Definition: CGasConcentrationGridMap2D.cpp:637
mrpt::maps::CGasConcentrationGridMap2D::internal_computeObservationLikelihood
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
Definition: CGasConcentrationGridMap2D.cpp:283
mrpt::maps::CGasConcentrationGridMap2D::internal_insertObservation
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
Definition: CGasConcentrationGridMap2D.cpp:172
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::std_windNoise_mod
float std_windNoise_mod
Definition: CGasConcentrationGridMap2D.h:79
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::windSensorLabel
std::string windSensorLabel
The label of the WindSenor used to simulate advection.
Definition: CGasConcentrationGridMap2D.h:70
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::advectionFreq
float advectionFreq
Indicates if wind information must be used.
Definition: CGasConcentrationGridMap2D.h:76
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::resolution
float resolution
Definition: CGasConcentrationGridMap2D.h:122
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::phi_inc
float phi_inc
Definition: CGasConcentrationGridMap2D.h:128
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::maps::CGasConcentrationGridMap2D::load_Gaussian_Wind_Grid_From_File
bool load_Gaussian_Wind_Grid_From_File()
Definition: CGasConcentrationGridMap2D.cpp:1377
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::maps::CRandomFieldGridMap2D::TMapRepresentation
TMapRepresentation
The type of map representation to be used, see CRandomFieldGridMap2D for a discussion.
Definition: CRandomFieldGridMap2D.h:175
mrpt::maps::CRandomFieldGridMap2D::mrKernelDM
@ mrKernelDM
Gaussian kernel-based estimator (see discussion in mrpt::maps::CRandomFieldGridMap2D)
Definition: CRandomFieldGridMap2D.h:179
mrpt::maps::CGasConcentrationGridMap2D::save_Gaussian_Wind_Grid_To_File
bool save_Gaussian_Wind_Grid_To_File()
Definition: CGasConcentrationGridMap2D.cpp:1316
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:26
mrpt::system::TTimeStamp
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
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable
Definition: CGasConcentrationGridMap2D.h:119
mrpt::maps::CGasConcentrationGridMap2D::TMapDefinition::insertionOpts
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOpts
Observations insertion options.
Definition: CGasConcentrationGridMap2D.h:180
mrpt::maps::CGasConcentrationGridMap2D::TGaussianCell::cx
int cx
Definition: CGasConcentrationGridMap2D.h:113
mrpt::maps::CGasConcentrationGridMap2D::insertionOptions
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOptions
MAP_DEFINITION_START
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
Definition: TMetricMapTypesRegistry.h:57
mrpt::containers::CDynamicGrid< double >
MAP_DEFINITION_END
#define MAP_DEFINITION_END(_CLASS_NAME_)
Definition: TMetricMapTypesRegistry.h:67
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::gasSensorType
uint16_t gasSensorType
The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors,...
Definition: CGasConcentrationGridMap2D.h:68
mrpt::maps::CGasConcentrationGridMap2D::internal_clear
void internal_clear() override
Internal method called by clear()
Definition: CGasConcentrationGridMap2D.cpp:134
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::r_inc
float r_inc
Definition: CGasConcentrationGridMap2D.h:130
mrpt::maps::CRandomFieldGridMap2D
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
Definition: CRandomFieldGridMap2D.h:152
mrpt::maps::CGasConcentrationGridMap2D::TGaussianCell::cy
int cy
Definition: CGasConcentrationGridMap2D.h:114
mrpt::maps::CGasConcentrationGridMap2D::windGrid_direction
mrpt::containers::CDynamicGrid< double > windGrid_direction
Definition: CGasConcentrationGridMap2D.h:167
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
mrpt::maps::CRandomFieldGridMap2D::mrAchim
@ mrAchim
Another alias for "mrKernelDM", for backwards compatibility (see discussion in mrpt::maps::CRandomFie...
Definition: CRandomFieldGridMap2D.h:182
mrpt::maps::CGasConcentrationGridMap2D::TGaussianWindTable::max_r
float max_r
Definition: CGasConcentrationGridMap2D.h:131
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::default_wind_direction
float default_wind_direction
The std to consider on.
Definition: CGasConcentrationGridMap2D.h:82
mrpt::maps::CGasConcentrationGridMap2D::timeLastSimulated
mrpt::system::TTimeStamp timeLastSimulated
The timestamp of the last time the advection simulation was executed.
Definition: CGasConcentrationGridMap2D.h:170
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::gasSensorLabel
std::string gasSensorLabel
The label of the CObservationGasSensor used to generate the map.
Definition: CGasConcentrationGridMap2D.h:62
mrpt::maps
Definition: CBeacon.h:21
mrpt::maps::CGasConcentrationGridMap2D::~CGasConcentrationGridMap2D
~CGasConcentrationGridMap2D() override
Destructor.
mrpt::maps::CGasConcentrationGridMap2D::TGaussianCell::value
float value
Definition: CGasConcentrationGridMap2D.h:115
CRandomFieldGridMap2D.h
mrpt::maps::CGasConcentrationGridMap2D::build_Gaussian_Wind_Grid
bool build_Gaussian_Wind_Grid()
Builds a LookUp table with the values of the Gaussian Weights result of the wind advection for a spec...
Definition: CGasConcentrationGridMap2D.cpp:872
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::TInsertionOptions
TInsertionOptions()
Default values loader.
Definition: CGasConcentrationGridMap2D.cpp:437
mrpt::maps::CGasConcentrationGridMap2D::simulateAdvection
bool simulateAdvection(double STD_increase_value)
Implements the transition model of the gasConcentration map using the information of the wind maps
Definition: CGasConcentrationGridMap2D.cpp:671
mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions::default_wind_speed
float default_wind_speed
Definition: CGasConcentrationGridMap2D.h:83



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 17:54:30 UTC 2020