Main MRPT website > C++ reference for MRPT 1.5.7
maps/CGasConcentrationGridMap2D.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 CGasConcentrationGridMap2D_H
11 #define CGasConcentrationGridMap2D_H
12 
15 
16 #include <mrpt/maps/link_pragmas.h>
17 
18 namespace mrpt
19 {
20 namespace maps
21 {
22  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CGasConcentrationGridMap2D , CRandomFieldGridMap2D, MAPS_IMPEXP )
23 
24  /** CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.
25  *
26  * There are a number of methods available to build the gas grid-map, depending on the value of
27  * "TMapRepresentation maptype" passed in the constructor (see base class mrpt::maps::CRandomFieldGridMap2D).
28  *
29  * Update the map with insertIndividualReading() or insertObservation()
30  *
31  * \sa mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CMetricMap, mrpt::utils::CDynamicGrid, The application icp-slam, mrpt::maps::CMultiMetricMap
32  * \ingroup mrpt_maps_grp
33  */
35  {
36  // This must be added to any CSerializable derived class:
38  public:
39 
40  /** Constructor
41  */
43  TMapRepresentation mapType = mrAchim,
44  float x_min = -2,
45  float x_max = 2,
46  float y_min = -2,
47  float y_max = 2,
48  float resolution = 0.1
49  );
50 
51  /** Destructor */
52  virtual ~CGasConcentrationGridMap2D();
53 
54  /** Parameters related with inserting observations into the map:
55  */
59  {
60  TInsertionOptions(); //!< Default values loader
61 
62  void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source,const std::string &section) MRPT_OVERRIDE; // See base docs
63  void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE; // See base docs
64 
65  /** @name For all mapping methods
66  @{ */
67  std::string gasSensorLabel; //!< The label of the CObservationGasSensor used to generate the map
68  uint16_t enose_id; //!< id for the enose used to generate this map (must be < gasGrid_count)
69  uint16_t gasSensorType; //!< The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
70  std::string windSensorLabel; //!< The label of the WindSenor used to simulate advection
71 
72  //[Advection Options]
73  bool useWindInformation; //! Indicates if wind information must be used to simulate Advection
74  float advectionFreq; //! Frequency for simulating advection (only used to transform wind speed to distance)
75  float std_windNoise_phi, std_windNoise_mod; //! The std to consider on wind information measurements
76  float default_wind_direction, default_wind_speed; //! The default value for the wind information
77 
78  /** @} */
79 
80  } insertionOptions;
81 
82  /** Returns a 3D object representing the map */
83  virtual void getAs3DObject( mrpt::opengl::CSetOfObjectsPtr &outObj ) const MRPT_OVERRIDE;
84 
85  /** Returns two 3D objects representing the mean and variance maps */
86  virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &meanObj, mrpt::opengl::CSetOfObjectsPtr &varObj ) const MRPT_OVERRIDE;
87 
88  /** Returns the 3D object representing the wind grid information */
89  void getWindAs3DObject( mrpt::opengl::CSetOfObjectsPtr &windObj) const;
90 
91  /** Increase the kf_std of all cells from the m_map
92  * This mehod is usually called by the main_map to simulate loss of confidence in measurements when time passes */
93  virtual void increaseUncertainty(const double STD_increase_value);
94 
95  /** Implements the transition model of the gasConcentration map using the information of the wind maps */
96  bool simulateAdvection(const double &STD_increase_value);
97 
98  // Params for the estimation of the gaussian volume in a cell.
100  {
101  int cx; //x-index of the cell
102  int cy; //y-index of the cell
103  float value; //volume approximation
104  };
105 
106  //Params for the estimation of the wind effect on each cell of the grid
108  {
109  //Fixed params
110  float resolution; //Cell_resolution. To be read from config-file
111  float std_phi; //to be read from config-file
112  float std_r; //to be read from config-file
113 
114  //unsigned int subcell_count; //subcell_count x subcell_count subcells
115  //float subcell_res;
116  float phi_inc; //rad
117  unsigned int phi_count;
118  float r_inc; //m
119  float max_r; //maximum distance (m)
120  unsigned int r_count;
121 
122  std::vector< std::vector< std::vector<TGaussianCell> > > *table;
123  }LUT;
124 
125  protected:
126 
127  /** Get the part of the options common to all CRandomFieldGridMap2D classes */
129  return &insertionOptions;
130  }
131 
132  // See docs in base class
133  void internal_clear() MRPT_OVERRIDE;
134  bool internal_insertObservation( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose = NULL ) MRPT_OVERRIDE;
135  double internal_computeObservationLikelihood( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom ) MRPT_OVERRIDE;
136 
137  /** Builds a LookUp table with the values of the Gaussian Weights result of the wind advection
138  * for a specific std_windNoise_phi value.
139  */
140  bool build_Gaussian_Wind_Grid();
141 
142  bool save_Gaussian_Wind_Grid_To_File();
143  bool load_Gaussian_Wind_Grid_From_File();
144 
145  /** Gridmaps of the wind Direction/Module */
146  mrpt::utils::CDynamicGrid<double> windGrid_module, windGrid_direction;
147 
148  /** The timestamp of the last time the advection simulation was executed */
149  mrpt::system::TTimeStamp timeLastSimulated;
150 
152  float min_x,max_x,min_y,max_y,resolution; //!< See CGasConcentrationGridMap2D::CGasConcentrationGridMap2D
153  mrpt::maps::CGasConcentrationGridMap2D::TMapRepresentation mapType; //!< The kind of map representation (see CGasConcentrationGridMap2D::CGasConcentrationGridMap2D)
154  mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOpts; //!< Observations insertion options
156 
157  };
159 
160  } // End of namespace
161 
162 } // End of namespace
163 
164 #endif
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
std::string gasSensorLabel
The label of the CObservationGasSensor used to generate the map.
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
unsigned __int16 uint16_t
Definition: rptypes.h:46
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
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.
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:38
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
float advectionFreq
Indicates if wind information must be used to simulate Advection.
uint16_t gasSensorType
The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
std::vector< std::vector< std::vector< TGaussianCell > > > * table
GLsizei const GLchar ** string
Definition: glext.h:3919
Parameters related with inserting observations into the map:
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...
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
std::string windSensorLabel
The label of the WindSenor used to simulate advection.
GLsizei GLsizei GLchar * source
Definition: glext.h:3908
virtual CRandomFieldGridMap2D::TInsertionOptionsCommon * getCommonInsertOptions() MRPT_OVERRIDE
Get the part of the options common to all CRandomFieldGridMap2D classes.
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area. ...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define MAP_DEFINITION_START(_CLASS_NAME_, _LINKAGE_)
Add a MAP_DEFINITION_START() ...
float std_windNoise_phi
Frequency for simulating advection (only used to transform wind speed to distance) ...
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.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019