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