Main MRPT website > C++ reference
MRPT logo
CGasConcentrationGridMap2D.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef CGasConcentrationGridMap2D_H
30 #define CGasConcentrationGridMap2D_H
31 
34 
35 #include <mrpt/maps/link_pragmas.h>
36 
37 namespace mrpt
38 {
39 namespace slam
40 {
41  using namespace mrpt::utils;
42  using namespace mrpt::poses;
43  using namespace mrpt::math;
44 
46 
47  typedef TRandomFieldCell TGasConcentrationCell; //!< Defined for backward compatibility only (mrpt <0.9.5)
48 
49  /** CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.
50  *
51  * There are a number of methods available to build the gas grid-map, depending on the value of
52  * "TMapRepresentation maptype" passed in the constructor (see base class mrpt::slam::CRandomFieldGridMap2D).
53  *
54  * \sa mrpt::slam::CRandomFieldGridMap2D, mrpt::slam::CMetricMap, mrpt::utils::CDynamicGrid, The application icp-slam, mrpt::slam::CMultiMetricMap
55  * \ingroup mrpt_maps_grp
56  */
58  {
59  // This must be added to any CSerializable derived class:
61  public:
62 
63  /** Constructor
64  */
66  TMapRepresentation mapType = mrAchim,
67  float x_min = -2,
68  float x_max = 2,
69  float y_min = -2,
70  float y_max = 2,
71  float resolution = 0.1
72  );
73 
74  /** Destructor */
75  virtual ~CGasConcentrationGridMap2D();
76 
77  /** Computes the likelihood that a given observation was taken from a given pose in the world being modeled with this map.
78  *
79  * \param takenFrom The robot's pose the observation is supposed to be taken from.
80  * \param obs The observation.
81  * \return This method returns a likelihood in the range [0,1].
82  *
83  * \sa Used in particle filter algorithms, see: CMultiMetricMapPDF::update
84  */
85  virtual double computeObservationLikelihood( const CObservation *obs, const CPose3D &takenFrom );
86 
87 
88  /** Parameters related with inserting observations into the map:
89  */
91  public utils::CLoadableOptions,
93  {
94  TInsertionOptions(); //!< Default values loader
95 
96  /** See utils::CLoadableOptions */
97  void loadFromConfigFile(
98  const mrpt::utils::CConfigFileBase &source,
99  const std::string &section);
100 
101  void dumpToTextStream(CStream &out) const; //!< See utils::CLoadableOptions
102 
103  /** @name For all mapping methods
104  @{ */
105  std::string sensorLabel; //!< The label of the CObservationGasSensor used to generate the map
106  uint16_t enose_id; //!< id for the enose used to generate this map (must be < gasGrid_count)
107  uint16_t sensorType; //!< The sensor type for the gas concentration map (0x0000 ->mean of all installed sensors, 0x2600, 0x6810, ...)
108 
109  /** @} */
110 
111  } insertionOptions;
112 
113 
114  /** Returns an image just as described in \a saveAsBitmapFile */
115  virtual void getAsBitmapFile(mrpt::utils::CImage &out_img) const;
116 
117  /** The implementation in this class just calls all the corresponding method of the contained metric maps.
118  */
119  virtual void saveMetricMapRepresentationToFile(
120  const std::string &filNamePrefix
121  ) const;
122 
123  /** Save a matlab ".m" file which represents as 3D surfaces the mean and a given confidence level for the concentration of each cell.
124  * This method can only be called in a KF map model.
125  */
126  virtual void saveAsMatlab3DGraph(const std::string &filName) const;
127 
128  /** Returns a 3D object representing the map.
129  */
130  virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &outObj ) const;
131 
132  /** Returns two 3D objects representing the mean and variance maps.
133  */
134  virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &meanObj, mrpt::opengl::CSetOfObjectsPtr &varObj ) const;
135 
136  /** Center the map on the given location keeping the actual dimensions.
137  * This mehod is usually called by the mobile map.
138  * \param reference_map The main map over which the mobile map works
139  * \param centerPose The 3D pose on the reference_map over which center the mobile map
140  */
141  virtual void centerMapAtLocation( CGasConcentrationGridMap2D &reference_map,const CPose3D &centerPose );
142 
143  /** Updates the main_map with the information of the mobile_map
144  * This mehod is usually called by the main_map, after a insertObservation in the mobile_map.
145  */
146  virtual void updateFromMobileMap(const CGasConcentrationGridMap2D &mobile_map);
147  /** Increase the kf_std of all cells from the m_map
148  * This mehod is usually called by the main_map to simulate loss of confidence in measurements when time passes
149  */
150  virtual void increaseMapCells_STD(const double memory_relative_strenght);
151  /** Map center Pose2D in the main_map reference system
152  * Only applies for the case of mrMobile mapTypes
153  */
154  mrpt::poses::TPose2D mapCenterPose;
155 
156  protected:
157 
158  /** Get the part of the options common to all CRandomFieldGridMap2D classes */
160  return &insertionOptions;
161  }
162 
163  /** Erase all the contents of the map */
164  virtual void internal_clear();
165 
166  /** Insert the observation information into this map. This method must be implemented
167  * in derived classes.
168  * \param obs The observation
169  * \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)
170  *
171  * \sa CObservation::insertObservationInto
172  */
173  virtual bool internal_insertObservation( const CObservation *obs, const CPose3D *robotPose = NULL );
174 
175 
176  };
177 
178  } // End of namespace
179 
180 } // End of namespace
181 
182 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013