Main MRPT website > C++ reference for MRPT 1.3.2
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-2015, 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  typedef TRandomFieldCell TGasConcentrationCell; //!< Defined for backward compatibility only (mrpt <0.9.5)
25 
26  /** CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.
27  *
28  * There are a number of methods available to build the gas grid-map, depending on the value of
29  * "TMapRepresentation maptype" passed in the constructor (see base class mrpt::maps::CRandomFieldGridMap2D).
30  *
31  * Update the map with insertIndividualReading() or insertObservation()
32  *
33  * \sa mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CMetricMap, mrpt::utils::CDynamicGrid, The application icp-slam, mrpt::maps::CMultiMetricMap
34  * \ingroup mrpt_maps_grp
35  */
37  {
38  // This must be added to any CSerializable derived class:
40  public:
41 
42  /** Constructor
43  */
45  TMapRepresentation mapType = mrAchim,
46  float x_min = -2,
47  float x_max = 2,
48  float y_min = -2,
49  float y_max = 2,
50  float resolution = 0.1
51  );
52 
53  /** Destructor */
54  virtual ~CGasConcentrationGridMap2D();
55 
56  /** Parameters related with inserting observations into the map:
57  */
59  public utils::CLoadableOptions,
60  public TInsertionOptionsCommon
61  {
62  TInsertionOptions(); //!< Default values loader
63 
64  /** See utils::CLoadableOptions */
65  void loadFromConfigFile(
66  const mrpt::utils::CConfigFileBase &source,
67  const std::string &section);
68 
69  void dumpToTextStream(mrpt::utils::CStream &out) const; //!< See utils::CLoadableOptions
70 
71  /** @name For all mapping methods
72  @{ */
73  std::string gasSensorLabel; //!< The label of the CObservationGasSensor used to generate the map
74  uint16_t enose_id; //!< id for the enose used to generate this map (must be < gasGrid_count)
75  uint16_t gasSensorType; //!< The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
76  std::string windSensorLabel; //!< The label of the WindSenor used to simulate advection
77 
78  //[Advection Options]
79  bool useWindInformation; //! Indicates if wind information must be used to simulate Advection
80  float advectionFreq; //! Frequency for simulating advection (only used to transform wind speed to distance)
81  float std_windNoise_phi, std_windNoise_mod; //! The std to consider on wind information measurements
82  float default_wind_direction, default_wind_speed; //! The default value for the wind information
83 
84  /** @} */
85 
86  } insertionOptions;
87 
88 
89  /** Returns an image just as described in \a saveAsBitmapFile */
90  virtual void getAsBitmapFile(mrpt::utils::CImage &out_img) const;
91 
92  /** The implementation in this class just calls all the corresponding method of the contained metric maps.
93  */
94  virtual void saveMetricMapRepresentationToFile(
95  const std::string &filNamePrefix
96  ) const;
97 
98  /** Save a matlab ".m" file which represents as 3D surfaces the mean and a given confidence level for the concentration of each cell.
99  * This method can only be called in a KF map model.
100  */
101  virtual void saveAsMatlab3DGraph(const std::string &filName) const;
102 
103  /** Returns a 3D object representing the map.
104  */
105  virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &outObj ) const;
106 
107  /** Returns two 3D objects representing the mean and variance maps.
108  */
109  virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &meanObj, mrpt::opengl::CSetOfObjectsPtr &varObj ) const;
110 
111  /** Returns the 3D object representing the wind grid information
112  */
113  void getWindAs3DObject( mrpt::opengl::CSetOfObjectsPtr &windObj) const;
114 
115  /** Increase the kf_std of all cells from the m_map
116  * This mehod is usually called by the main_map to simulate loss of confidence in measurements when time passes
117  */
118  virtual void increaseUncertainty(const double STD_increase_value);
119 
120  /** Implements the transition model of the gasConcentration map using the information of the wind maps.
121  */
122  bool simulateAdvection(const double &STD_increase_value);
123 
124 
125  // Params for the estimation of the gaussian volume in a cell.
127  {
128  int cx; //x-index of the cell
129  int cy; //y-index of the cell
130  float value; //volume approximation
131  };
132 
133  //Params for the estimation of the wind effect on each cell of the grid
135  {
136  //Fixed params
137  float resolution; //Cell_resolution. To be read from config-file
138  float std_phi; //to be read from config-file
139  float std_r; //to be read from config-file
140 
141  //unsigned int subcell_count; //subcell_count x subcell_count subcells
142  //float subcell_res;
143  float phi_inc; //rad
144  unsigned int phi_count;
145  float r_inc; //m
146  float max_r; //maximum distance (m)
147  unsigned int r_count;
148 
149  std::vector< std::vector< std::vector<TGaussianCell> > > *table;
150  }LUT;
151 
152  protected:
153 
154  /** Get the part of the options common to all CRandomFieldGridMap2D classes */
156  return &insertionOptions;
157  }
158 
159  // See docs in base class
160  void internal_clear() MRPT_OVERRIDE;
161  bool internal_insertObservation( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose = NULL ) MRPT_OVERRIDE;
162  double internal_computeObservationLikelihood( const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom ) MRPT_OVERRIDE;
163 
164  /** Builds a LookUp table with the values of the Gaussian Weights result of the wind advection
165  * for a specific std_windNoise_phi value.
166  */
167  bool build_Gaussian_Wind_Grid();
168 
169  bool save_Gaussian_Wind_Grid_To_File();
170  bool load_Gaussian_Wind_Grid_From_File();
171 
172  /** Gridmaps of the wind Direction/Module */
174 
175  /** The timestamp of the last time the advection simulation was executed */
177 
179  float min_x,max_x,min_y,max_y,resolution; //!< See CGasConcentrationGridMap2D::CGasConcentrationGridMap2D
180  mrpt::maps::CGasConcentrationGridMap2D::TMapRepresentation mapType; //!< The kind of map representation (see CGasConcentrationGridMap2D::CGasConcentrationGridMap2D)
181  mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOpts; //!< Observations insertion options
183 
184  };
185  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CGasConcentrationGridMap2D , CRandomFieldGridMap2D, MAPS_IMPEXP )
186 
187  } // End of namespace
188 
189 } // End of namespace
190 
191 #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_)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
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.
The contents of each cell in a CRandomFieldGridMap2D map.
uint16_t gasSensorType
The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
mrpt::utils::CDynamicGrid< double > windGrid_module
Gridmaps of the wind Direction/Module.
std::vector< std::vector< std::vector< TGaussianCell > > > * table
virtual CRandomFieldGridMap2D::TInsertionOptionsCommon * getCommonInsertOptions()
Get the part of the options common to all CRandomFieldGridMap2D classes.
Parameters related with inserting observations into the map:
mrpt::system::TTimeStamp timeLastSimulated
The timestamp of the last time the advection simulation was executed.
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...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
Declares a class that represents any robot&#39;s observation.
std::string windSensorLabel
The label of the WindSenor used to simulate advection.
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) ...



Page generated by Doxygen 1.8.11 for MRPT 1.3.2 SVN: at Wed May 25 02:34:21 UTC 2016