00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CMultiMetricMap_H 00029 #define CMultiMetricMap_H 00030 00031 #include <mrpt/slam/COccupancyGridMap2D.h> 00032 #include <mrpt/slam/CGasConcentrationGridMap2D.h> 00033 #include <mrpt/slam/CWirelessPowerGridMap2D.h> 00034 #include <mrpt/slam/CHeightGridMap2D.h> 00035 #include <mrpt/slam/CReflectivityGridMap2D.h> 00036 #include <mrpt/slam/CSimplePointsMap.h> 00037 #include <mrpt/slam/CColouredPointsMap.h> 00038 #include <mrpt/slam/CWeightedPointsMap.h> 00039 #include <mrpt/slam/CLandmarksMap.h> 00040 #include <mrpt/slam/CBeaconMap.h> 00041 #include <mrpt/slam/CMetricMap.h> 00042 #include <mrpt/utils/CSerializable.h> 00043 #include <mrpt/utils/CLoadableOptions.h> 00044 #include <mrpt/utils/TEnumType.h> 00045 00046 #include <mrpt/slam/link_pragmas.h> 00047 00048 namespace mrpt 00049 { 00050 namespace slam 00051 { 00052 class TSetOfMetricMapInitializers; 00053 00054 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CMultiMetricMap , CMetricMap, SLAM_IMPEXP ) 00055 00056 /** This class stores any customizable set of metric maps. 00057 * The internal metric maps can be accessed directly by the user. 00058 * If some kind of map is not desired, it can be just ignored, but if this fact is specified in the 00059 * "CMultiMetricMap::mapsUsage" member some methods (as the observation insertion) will be more 00060 * efficient since it will be invoked on desired maps only.<br><br> 00061 * <b>Currently these metric maps are supported for being kept internally:</b>: 00062 * - mrpt::slam::CPointsMap: For laser 2D range scans, and posibly for IR ranges,... (It keeps the full 3D structure of scans) 00063 * - mrpt::slam::COccupancyGridMap2D: Exclusively for 2D, <b>horizontal</b> laser range scans, at different altitudes. 00064 * - mrpt::slam::CLandmarksMap: For visual landmarks,etc... 00065 * - mrpt::slam::CGasConcentrationGridMap2D: For gas concentration maps. 00066 * - mrpt::slam::CWirelessPowerGridMap2D: For wifi power maps. 00067 * - mrpt::slam::CBeaconMap: For range-only SLAM. 00068 * - mrpt::slam::CHeightGridMap2D: For maps of height for each (x,y) location. 00069 * - mrpt::slam::CReflectivityGridMap2D: For maps of "reflectivity" for each (x,y) location. 00070 * - mrpt::slam::CColouredPointsMap: For point map with color. 00071 * - mrpt::slam::CWeightedPointsMap: For point map with weights (capable of "fusing"). 00072 * 00073 * See CMultiMetricMap::setListOfMaps() for the method for initializing this class, and also 00074 * see TSetOfMetricMapInitializers::loadFromConfigFile for a template of ".ini"-like configuration 00075 * file that can be used to define what maps to create and all their parameters. 00076 * 00077 * \sa CMetricMap \ingroup mrpt_slam_grp 00078 */ 00079 class SLAM_IMPEXP CMultiMetricMap : public CMetricMap 00080 { 00081 // This must be added to any CSerializable derived class: 00082 DEFINE_SERIALIZABLE( CMultiMetricMap ) 00083 00084 protected: 00085 /** Deletes all maps and clears the internal lists of maps. 00086 */ 00087 void deleteAllMaps(); 00088 00089 /** Clear all elements of the map. 00090 */ 00091 virtual void internal_clear(); 00092 00093 /** Insert the observation information into this map (see options) 00094 * \param obs The observation 00095 * \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) 00096 * 00097 * \sa CObservation::insertObservationInto 00098 */ 00099 virtual bool internal_insertObservation( const CObservation *obs, const CPose3D *robotPose = NULL ); 00100 00101 public: 00102 typedef std::pair<CPoint3D,unsigned int> TPairIdBeacon; 00103 00104 /** Returns true if the map is empty/no observation has been inserted. 00105 */ 00106 bool isEmpty() const; 00107 00108 /** Some options for this class: 00109 */ 00110 struct SLAM_IMPEXP TOptions : public utils::CLoadableOptions 00111 { 00112 TOptions() : likelihoodMapSelection(mapFuseAll), 00113 enableInsertion_pointsMap(true), 00114 enableInsertion_landmarksMap(true), 00115 enableInsertion_gridMaps(true), 00116 enableInsertion_gasGridMaps(true), 00117 enableInsertion_wifiGridMaps(true), 00118 enableInsertion_beaconMap(true), 00119 enableInsertion_heightMaps(true), 00120 enableInsertion_reflectivityMaps(true), 00121 enableInsertion_colourPointsMaps(true), 00122 enableInsertion_weightedPointsMaps(true) 00123 { 00124 } 00125 00126 /** Load parameters from configuration source 00127 */ 00128 void loadFromConfigFile( 00129 const mrpt::utils::CConfigFileBase &source, 00130 const std::string §ion); 00131 00132 /** This method must display clearly all the contents of the structure in textual form, sending it to a CStream. 00133 */ 00134 void dumpToTextStream(CStream &out) const; 00135 00136 /** This selects the map to be used when computing the likelihood of an observation. 00137 * This enum has a corresponding mrpt::utils::TEnumType<> specialization. 00138 * \sa computeObservationLikelihood 00139 */ 00140 enum TMapSelectionForLikelihood 00141 { 00142 mapFuseAll = -1, 00143 mapGrid = 0, 00144 mapPoints, 00145 mapLandmarks, 00146 mapGasGrid, 00147 mapWifiGrid, 00148 mapBeacon, 00149 mapHeight, 00150 mapColourPoints, 00151 mapReflectivity, 00152 mapWeightedPoints 00153 } likelihoodMapSelection; 00154 00155 bool enableInsertion_pointsMap; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00156 bool enableInsertion_landmarksMap; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00157 bool enableInsertion_gridMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00158 bool enableInsertion_gasGridMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00159 bool enableInsertion_wifiGridMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00160 bool enableInsertion_beaconMap; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00161 bool enableInsertion_heightMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00162 bool enableInsertion_reflectivityMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00163 bool enableInsertion_colourPointsMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00164 bool enableInsertion_weightedPointsMaps; //!< Default = true (set to false to avoid "insertObservation" to update a given map) 00165 00166 } options; 00167 00168 00169 /** @name Internal lists of maps 00170 @{ */ 00171 // Note: A variable number of maps may exist, depending on the initialization from TSetOfMetricMapInitializers. 00172 // Not used maps are "NULL" or empty smart pointers. 00173 00174 std::deque<CSimplePointsMapPtr> m_pointsMaps; 00175 std::deque<COccupancyGridMap2DPtr> m_gridMaps; 00176 std::deque<CGasConcentrationGridMap2DPtr> m_gasGridMaps; 00177 std::deque<CWirelessPowerGridMap2DPtr> m_wifiGridMaps; 00178 std::deque<CHeightGridMap2DPtr> m_heightMaps; 00179 std::deque<CReflectivityGridMap2DPtr> m_reflectivityMaps; 00180 CColouredPointsMapPtr m_colourPointsMap; 00181 CWeightedPointsMapPtr m_weightedPointsMap; 00182 CLandmarksMapPtr m_landmarksMap; 00183 CBeaconMapPtr m_beaconMap; 00184 00185 /** @} */ 00186 00187 /** Constructor. 00188 * \param initializers One internal map will be created for each entry in this "TSetOfMetricMapInitializers" struct, and each map will be initialized with the corresponding options. 00189 * \param opts If provided (not NULL), the member "options" will be initialized with those values. 00190 * If initializers is NULL, no internal map will be created. 00191 */ 00192 CMultiMetricMap( 00193 const mrpt::slam::TSetOfMetricMapInitializers *initializers = NULL, 00194 const TOptions *opts = NULL ); 00195 00196 /** Sets the list of internal map according to the passed list of map initializers (Current maps' content will be deleted!) 00197 */ 00198 void setListOfMaps( const mrpt::slam::TSetOfMetricMapInitializers *initializers ); 00199 00200 /** Copy constructor */ 00201 CMultiMetricMap(const mrpt::slam::CMultiMetricMap &other ); 00202 00203 /** Copy operator from "other" object. 00204 */ 00205 mrpt::slam::CMultiMetricMap &operator = ( const mrpt::slam::CMultiMetricMap &other ); 00206 00207 /** Destructor. 00208 */ 00209 virtual ~CMultiMetricMap( ); 00210 00211 00212 /** Computes the likelihood that a given observation was taken from a given pose in the world being modeled with this map. 00213 * 00214 * \param takenFrom The robot's pose the observation is supposed to be taken from. 00215 * \param obs The observation. 00216 * \return This method returns a likelihood in the range [0,1]. 00217 * 00218 * \sa likelihoodMapSelection, Used in particle filter algorithms, see: CMultiMetricMapPDF::update 00219 */ 00220 double computeObservationLikelihood( const CObservation *obs, const CPose3D &takenFrom ); 00221 00222 /** Returns the ratio of points in a map which are new to the point map while falling into yet static cells of gridmap. 00223 * \param points The set of points to check. 00224 * \param takenFrom The pose for the reference system of points, in global coordinates of this hybrid map. 00225 */ 00226 float getNewStaticPointsRatio( 00227 CPointsMap *points, 00228 CPose2D &takenFrom ); 00229 00230 /** See the definition in the base class: In this class calls to this method are passed to the inner point map. 00231 * 00232 * \sa computeMatching3DWith 00233 */ 00234 void computeMatchingWith2D( 00235 const CMetricMap *otherMap, 00236 const CPose2D &otherMapPose, 00237 float maxDistForCorrespondence, 00238 float maxAngularDistForCorrespondence, 00239 const CPose2D &angularDistPivotPoint, 00240 TMatchingPairList &correspondences, 00241 float &correspondencesRatio, 00242 float *sumSqrDist = NULL, 00243 bool onlyKeepTheClosest = false, 00244 bool onlyUniqueRobust = false, 00245 const size_t decimation_other_map_points = 1, 00246 const size_t offset_other_map_points = 0 ) const; 00247 00248 /** Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose" 00249 * In the case of a multi-metric map, this returns the average between the maps. This method always return 0 for grid maps. 00250 * \param otherMap [IN] The other map to compute the matching with. 00251 * \param otherMapPose [IN] The 6D pose of the other map as seen from "this". 00252 * \param minDistForCorr [IN] The minimum distance between 2 non-probabilistic map elements for counting them as a correspondence. 00253 * \param minMahaDistForCorr [IN] The minimum Mahalanobis distance between 2 probabilistic map elements for counting them as a correspondence. 00254 * 00255 * \return The matching ratio [0,1] 00256 * \sa computeMatchingWith2D 00257 */ 00258 float compute3DMatchingRatio( 00259 const CMetricMap *otherMap, 00260 const CPose3D &otherMapPose, 00261 float minDistForCorr = 0.10f, 00262 float minMahaDistForCorr = 2.0f 00263 ) const; 00264 00265 /** The implementation in this class just calls all the corresponding method of the contained metric maps. 00266 */ 00267 void saveMetricMapRepresentationToFile( 00268 const std::string &filNamePrefix 00269 ) const; 00270 00271 /** This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation". 00272 * This method should normally do nothing, but in some cases can be used to free auxiliary cached variables. 00273 */ 00274 void auxParticleFilterCleanUp(); 00275 00276 /** Returns a 3D object representing the map. 00277 */ 00278 void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &outObj ) const; 00279 00280 /** Returns true if this map is able to compute a sensible likelihood function for this observation (i.e. an occupancy grid map cannot with an image). 00281 * \param obs The observation. 00282 * \sa computeObservationLikelihood 00283 */ 00284 bool canComputeObservationLikelihood( const CObservation *obs ); 00285 00286 /** Returns true if this map is able to compute a sensible likelihood function for this observation (i.e. an occupancy grid map cannot with an image). 00287 * \param obs The observation. 00288 * \sa computeObservationLikelihood 00289 */ 00290 inline bool canComputeObservationLikelihood( const CObservationPtr &obs ) { return canComputeObservationLikelihood(obs.pointer()); } 00291 00292 /** If the map is a simple point map or it's a multi-metric map that contains EXACTLY one simple point map, return it. 00293 * Otherwise, return NULL 00294 */ 00295 virtual const CSimplePointsMap * getAsSimplePointsMap() const; 00296 virtual CSimplePointsMap * getAsSimplePointsMap(); 00297 00298 /** An auxiliary variable that can be used freely by the users (this will be copied to other maps using the copy constructor, copy operator, streaming,etc) The default value is 0. 00299 */ 00300 unsigned int m_ID; 00301 00302 }; // End of class def. 00303 00304 /** Each structure of this kind will determine the kind (and initial configuration) of one map to be build into a CMultiMetricMap object. 00305 * See "mrpt::slam::TSetOfMetricMapInitializers::loadFromConfigFile" as an easy way of initialize this object. 00306 * \sa TSetOfMetricMapInitializers, CMultiMetricMap::CMultiMetricMap 00307 */ 00308 struct SLAM_IMPEXP TMetricMapInitializer 00309 { 00310 /** Initialization (sets 'metricMapClassType' to NULL, an invalid value -> it must be set correctly before use!) 00311 */ 00312 TMetricMapInitializer(); 00313 00314 /** Set this to CLASS_ID(< class >) where < class > is any CMetricMap derived class. 00315 */ 00316 TRuntimeClassIdPtr metricMapClassType; 00317 00318 /** This value will be copied to the member with the same value in the map, see mrpt::slam::CMetricMap::m_disableSaveAs3DObject 00319 */ 00320 bool m_disableSaveAs3DObject; 00321 00322 /** Specific options for grid maps (mrpt::slam::COccupancyGridMap2D) 00323 */ 00324 struct SLAM_IMPEXP TOccGridMap2DOptions 00325 { 00326 TOccGridMap2DOptions(); //!< Default values loader 00327 00328 float min_x,max_x,min_y,max_y,resolution; //!< See COccupancyGridMap2D::COccupancyGridMap2D 00329 COccupancyGridMap2D::TInsertionOptions insertionOpts; //!< Customizable initial options. 00330 COccupancyGridMap2D::TLikelihoodOptions likelihoodOpts; //!< Customizable initial options. 00331 00332 } occupancyGridMap2D_options; 00333 00334 /** Specific options for point maps (mrpt::slam::CPointsMap) 00335 */ 00336 struct SLAM_IMPEXP CPointsMapOptions 00337 { 00338 CPointsMapOptions(); //!< Default values loader 00339 CPointsMap::TInsertionOptions insertionOpts; //!< Customizable initial options for loading the class' own defaults. 00340 CPointsMap::TLikelihoodOptions likelihoodOpts; //!< //!< Customizable initial likelihood options 00341 } pointsMapOptions_options; 00342 00343 /** Specific options for gas grid maps (mrpt::slam::CGasConcentrationGridMap2D) 00344 */ 00345 struct SLAM_IMPEXP CGasConcentrationGridMap2DOptions 00346 { 00347 CGasConcentrationGridMap2DOptions(); //!< Default values loader 00348 00349 float min_x,max_x,min_y,max_y,resolution; //!< See CGasConcentrationGridMap2D::CGasConcentrationGridMap2D 00350 CGasConcentrationGridMap2D::TMapRepresentation mapType; //!< The kind of map representation (see CGasConcentrationGridMap2D::CGasConcentrationGridMap2D) 00351 CGasConcentrationGridMap2D::TInsertionOptions insertionOpts; //!< Customizable initial options. 00352 00353 } gasGridMap_options; 00354 00355 /** Specific options for wifi grid maps (mrpt::slam::CWirelessPowerGridMap2D) 00356 */ 00357 struct SLAM_IMPEXP CWirelessPowerGridMap2DOptions 00358 { 00359 CWirelessPowerGridMap2DOptions(); //!< Default values loader 00360 00361 float min_x,max_x,min_y,max_y,resolution; //!< See CWirelessPowerGridMap2D::CWirelessPowerGridMap2D 00362 CWirelessPowerGridMap2D::TMapRepresentation mapType; //!< The kind of map representation (see CWirelessPowerGridMap2D::CWirelessPowerGridMap2D) 00363 CWirelessPowerGridMap2D::TInsertionOptions insertionOpts; //!< Customizable initial options. 00364 00365 } wifiGridMap_options; 00366 00367 /** Specific options for landmarks maps (mrpt::slam::CLandmarksMap) 00368 */ 00369 struct SLAM_IMPEXP CLandmarksMapOptions 00370 { 00371 CLandmarksMapOptions(); //!< Default values loader 00372 00373 std::deque<CMultiMetricMap::TPairIdBeacon> initialBeacons; //!< Initial contents of the map, especified by a set of 3D Beacons with associated IDs 00374 CLandmarksMap::TInsertionOptions insertionOpts; //!< Customizable initial options. 00375 CLandmarksMap::TLikelihoodOptions likelihoodOpts; //!< Customizable initial options. 00376 00377 } landmarksMap_options; 00378 00379 00380 /** Specific options for landmarks maps (mrpt::slam::CBeaconMap) 00381 */ 00382 struct SLAM_IMPEXP CBeaconMapOptions 00383 { 00384 CBeaconMapOptions(); //!< Default values loader 00385 00386 CBeaconMap::TLikelihoodOptions likelihoodOpts; //!< Customizable initial options. 00387 CBeaconMap::TInsertionOptions insertionOpts; //!< Customizable initial options. 00388 00389 } beaconMap_options; 00390 00391 /** Specific options for height grid maps (mrpt::slam::CHeightGridMap2D) 00392 */ 00393 struct SLAM_IMPEXP CHeightGridMap2DOptions 00394 { 00395 CHeightGridMap2DOptions(); //!< Default values loader 00396 00397 float min_x,max_x,min_y,max_y,resolution; //!< See CHeightGridMap2D::CHeightGridMap2D 00398 CHeightGridMap2D::TMapRepresentation mapType; //!< The kind of map representation (see CHeightGridMap2D::CHeightGridMap2D) 00399 CHeightGridMap2D::TInsertionOptions insertionOpts; //!< Customizable initial options. 00400 } heightMap_options; 00401 00402 /** Specific options for height grid maps (mrpt::slam::CReflectivityGridMap2D) 00403 */ 00404 struct SLAM_IMPEXP CReflectivityGridMap2DOptions 00405 { 00406 CReflectivityGridMap2DOptions(); //!< Default values loader 00407 00408 float min_x,max_x,min_y,max_y,resolution; //!< See CReflectivityGridMap2DOptions::CReflectivityGridMap2DOptions 00409 CReflectivityGridMap2D::TInsertionOptions insertionOpts; //!< Customizable initial options. 00410 } reflectivityMap_options; 00411 00412 /** Specific options for coloured point maps (mrpt::slam::CPointsMap) 00413 */ 00414 struct SLAM_IMPEXP CColouredPointsMapOptions 00415 { 00416 CColouredPointsMapOptions(); //!< Default values loader 00417 CPointsMap::TInsertionOptions insertionOpts; //!< Customizable initial options for loading the class' own defaults. 00418 CPointsMap::TLikelihoodOptions likelihoodOpts; //!< //!< Customizable initial likelihood options 00419 CColouredPointsMap::TColourOptions colourOpts; //!< Customizable initial options for loading the class' own defaults. */ 00420 } colouredPointsMapOptions_options; 00421 00422 /** Specific options for coloured point maps (mrpt::slam::CPointsMap) 00423 */ 00424 struct SLAM_IMPEXP CWeightedPointsMapOptions 00425 { 00426 CWeightedPointsMapOptions(); //!< Default values loader 00427 CPointsMap::TInsertionOptions insertionOpts; //!< Customizable initial options for loading the class' own defaults. 00428 CPointsMap::TLikelihoodOptions likelihoodOpts; //!< //!< Customizable initial likelihood options 00429 } weightedPointsMapOptions_options; 00430 }; 00431 00432 /** A set of TMetricMapInitializer structures, passed to the constructor CMultiMetricMap::CMultiMetricMap 00433 * See the comments for TSetOfMetricMapInitializers::loadFromConfigFile, and "CMultiMetricMap::setListOfMaps" for 00434 * effectively creating the list of desired maps. 00435 * \sa CMultiMetricMap::CMultiMetricMap, utils::CLoadableOptions 00436 */ 00437 class SLAM_IMPEXP TSetOfMetricMapInitializers : public utils::CLoadableOptions 00438 { 00439 protected: 00440 std::deque<TMetricMapInitializer> m_list; 00441 00442 public: 00443 size_t size() const { return m_list.size(); } 00444 void push_back( const TMetricMapInitializer &o ) { m_list.push_back(o); } 00445 00446 typedef std::deque<TMetricMapInitializer>::iterator iterator; 00447 typedef std::deque<TMetricMapInitializer>::const_iterator const_iterator; 00448 00449 iterator begin() { return m_list.begin(); } 00450 const_iterator begin() const { return m_list.begin(); } 00451 00452 iterator end() { return m_list.end(); } 00453 const_iterator end() const { return m_list.end(); } 00454 00455 void clear() { m_list.clear(); } 00456 00457 00458 TSetOfMetricMapInitializers() : m_list(), options() 00459 {} 00460 00461 00462 /** This options will be loaded when creating the set of maps in CMultiMetricMap (See CMultiMetricMap::TOptions) 00463 */ 00464 CMultiMetricMap::TOptions options; 00465 00466 /** Loads the configuration for the set of internal maps from a textual definition in an INI-like file. 00467 * The format of the ini file is defined in utils::CConfigFile. The list of maps and their options 00468 * will be loaded from a handle of sections: 00469 * 00470 * \code 00471 * [<sectionName>] 00472 * // Creation of maps: 00473 * occupancyGrid_count=<Number of mrpt::slam::COccupancyGridMap2D maps> 00474 * gasGrid_count=<Number of mrpt::slam::CGasConcentrationGridMap2D maps> 00475 * wifiGrid_count=<Number of mrpt::slam::CWirelessPowerGridMap2D maps> 00476 * landmarksMap_count=<0 or 1, for creating a mrpt::slam::CLandmarksMap map> 00477 * beaconMap_count=<0 or 1, for creating a mrpt::slam::CBeaconMap map> 00478 * pointsMap_count=<Number of mrpt::slam::CSimplePointsMap map> 00479 * heightMap_count=<Number of mrpt::slam::CHeightGridMap2D maps> 00480 * reflectivityMap_count=<Number of mrpt::slam::CReflectivityGridMap2D maps> 00481 * colourPointsMap_count=<0 or 1, for creating a mrpt::slam::CColouredPointsMap map> 00482 * weightedPointsMap_count=<0 or 1, for creating a mrpt::slam::CWeightedPointsMap map> 00483 * 00484 * // Selection of map for likelihood. Either a numeric value or the textual enum 00485 * // enum value of slam::CMultiMetricMap::TOptions::TMapSelectionForLikelihood (e.g: either "-1" or "fuseAll", ect...) 00486 * likelihoodMapSelection = -1 00487 * 00488 * // Enables (1 or "true") / Disables (0 or "false") insertion into specific maps (Defaults are all "true"): 00489 * enableInsertion_pointsMap=<0/1> 00490 * enableInsertion_landmarksMap=<0/1> 00491 * enableInsertion_gridMaps=<0/1> 00492 * enableInsertion_gasGridMaps=<0/1> 00493 * enableInsertion_wifiGridMaps=<0/1> 00494 * enableInsertion_beaconMap=<0/1> 00495 * enableInsertion_heightMap=<0/1> 00496 * enableInsertion_reflectivityMap=<0/1> 00497 * enableInsertion_colourPointsMap=<0/1> 00498 * enableInsertion_weightedPointsMap=<0/1> 00499 * 00500 * // ==================================================== 00501 * // Creation Options for OccupancyGridMap ##: 00502 * [<sectionName>+"_occupancyGrid_##_creationOpts"] 00503 * min_x=<value> 00504 * max_x=<value> 00505 * min_y=<value> 00506 * max_y=<value> 00507 * resolution=<value> 00508 * 00509 * // Insertion Options for OccupancyGridMap ##: 00510 * [<sectionName>+"_occupancyGrid_##_insertOpts"] 00511 * <See COccupancyGridMap2D::TInsertionOptions> 00512 * 00513 * // Likelihood Options for OccupancyGridMap ##: 00514 * [<sectionName>+"_occupancyGrid_##_likelihoodOpts"] 00515 * <See COccupancyGridMap2D::TLikelihoodOptions> 00516 * 00517 * 00518 * // ==================================================== 00519 * // Insertion Options for CSimplePointsMap ##: 00520 * [<sectionName>+"_pointsMap_##_insertOpts"] 00521 * <See CPointsMap::TInsertionOptions> 00522 * 00523 * // Likelihood Options for CSimplePointsMap ##: 00524 * [<sectionName>+"_pointsMap_##_likelihoodOpts"] 00525 * <See CPointsMap::TLikelihoodOptions> 00526 * 00527 * 00528 * // ==================================================== 00529 * // Creation Options for CGasConcentrationGridMap2D ##: 00530 * [<sectionName>+"_gasGrid_##_creationOpts"] 00531 * mapType= <0-1> ; See CGasConcentrationGridMap2D::CGasConcentrationGridMap2D 00532 * min_x=<value> 00533 * max_x=<value> 00534 * min_y=<value> 00535 * max_y=<value> 00536 * resolution=<value> 00537 * 00538 * // Insertion Options for CGasConcentrationGridMap2D ##: 00539 * [<sectionName>+"_gasGrid_##_insertOpts"] 00540 * <See CGasConcentrationGridMap2D::TInsertionOptions> 00541 00542 00543 00544 00545 * // ==================================================== 00546 * // Creation Options for CWirelessPowerGridMap2D ##: 00547 * [<sectionName>+"_wifiGrid_##_creationOpts"] 00548 * mapType= <0-1> ; See CWirelessPowerGridMap2D::CWirelessPowerGridMap2D 00549 * min_x=<value> 00550 * max_x=<value> 00551 * min_y=<value> 00552 * max_y=<value> 00553 * resolution=<value> 00554 * 00555 * // Insertion Options for CWirelessPowerGridMap2D ##: 00556 * [<sectionName>+"_wifiGrid_##_insertOpts"] 00557 * <See CWirelessPowerGridMap2D::TInsertionOptions> 00558 00559 00560 * 00561 * 00562 * // ==================================================== 00563 * // Creation Options for CLandmarksMap ##: 00564 * [<sectionName>+"_landmarksMap_##_creationOpts"] 00565 * nBeacons=<# of beacons> 00566 * beacon_001_ID=67 ; The ID and 3D coordinates of each beacon 00567 * beacon_001_X=<x> 00568 * beacon_001_Y=<x> 00569 * beacon_001_Z=<x> 00570 * 00571 * // Insertion Options for CLandmarksMap ##: 00572 * [<sectionName>+"_landmarksMap_##_insertOpts"] 00573 * <See CLandmarksMap::TInsertionOptions> 00574 * 00575 * // Likelihood Options for CLandmarksMap ##: 00576 * [<sectionName>+"_landmarksMap_##_likelihoodOpts"] 00577 * <See CLandmarksMap::TLikelihoodOptions> 00578 * 00579 * 00580 * // ==================================================== 00581 * // Insertion Options for CBeaconMap ##: 00582 * [<sectionName>+"_beaconMap_##_insertOpts"] 00583 * <See CBeaconMap::TInsertionOptions> 00584 * 00585 * // Likelihood Options for CBeaconMap ##: 00586 * [<sectionName>+"_beaconMap_##_likelihoodOpts"] 00587 * <See CBeaconMap::TLikelihoodOptions> 00588 * 00589 * // ==================================================== 00590 * // Creation Options for HeightGridMap ##: 00591 * [<sectionName>+"_heightGrid_##_creationOpts"] 00592 * mapType= <0-1> // See CHeightGridMap2D::CHeightGridMap2D 00593 * min_x=<value> 00594 * max_x=<value> 00595 * min_y=<value> 00596 * max_y=<value> 00597 * resolution=<value> 00598 * 00599 * // Insertion Options for HeightGridMap ##: 00600 * [<sectionName>+"_heightGrid_##_insertOpts"] 00601 * <See CHeightGridMap2D::TInsertionOptions> 00602 * 00603 * 00604 * // ==================================================== 00605 * // Creation Options for ReflectivityGridMap ##: 00606 * [<sectionName>+"_reflectivityGrid_##_creationOpts"] 00607 * min_x=<value> // See CReflectivityGridMap2D::CReflectivityGridMap2D 00608 * max_x=<value> 00609 * min_y=<value> 00610 * max_y=<value> 00611 * resolution=<value> 00612 * 00613 * // Insertion Options for HeightGridMap ##: 00614 * [<sectionName>+"_reflectivityGrid_##_insertOpts"] 00615 * <See CReflectivityGridMap2D::TInsertionOptions> 00616 * 00617 * 00618 * // ==================================================== 00619 * // Insertion Options for CColouredPointsMap ##: 00620 * [<sectionName>+"_colourPointsMap_##_insertOpts"] 00621 * <See CPointsMap::TInsertionOptions> 00622 * 00623 * 00624 * // Color Options for CColouredPointsMap ##: 00625 * [<sectionName>+"_colourPointsMap_##_colorOpts"] 00626 * <See CColouredPointsMap::TColourOptions> 00627 * 00628 * // Likelihood Options for CSimplePointsMap ##: 00629 * [<sectionName>+"_colourPointsMap_##_likelihoodOpts"] 00630 * <See CPointsMap::TLikelihoodOptions> 00631 * 00632 * 00633 * // ==================================================== 00634 * // Insertion Options for CWeightedPointsMap ##: 00635 * [<sectionName>+"_weightedPointsMap_##_insertOpts"] 00636 * <See CPointsMap::TInsertionOptions> 00637 * 00638 * 00639 * // Likelihood Options for CWeightedPointsMap ##: 00640 * [<sectionName>+"_weightedPointsMap_##_likelihoodOpts"] 00641 * <See CPointsMap::TLikelihoodOptions> 00642 * 00643 * \endcode 00644 * 00645 * Where: 00646 * - ##: Represents the index of the map (e.g. "00","01",...) 00647 * - By default, the variables into each "TOptions" structure of the maps are defined in textual form by the same name of the corresponding C++ variable (e.g. "float resolution;" -> "resolution=0.10") 00648 * 00649 * \note Examples of map definitions can be found in the '.ini' files provided in the demo directories: "share/mrpt/config-files/" 00650 */ 00651 void loadFromConfigFile( 00652 const mrpt::utils::CConfigFileBase &source, 00653 const std::string §ionName); 00654 00655 /** This method dumps the options of the multi-metric map AND those of every internal map. 00656 */ 00657 void dumpToTextStream(CStream &out) const; 00658 }; 00659 00660 } // End of namespace 00661 00662 00663 // Specializations MUST occur at the same namespace: 00664 namespace utils 00665 { 00666 template <> 00667 struct TEnumTypeFiller<slam::CMultiMetricMap::TOptions::TMapSelectionForLikelihood> 00668 { 00669 typedef slam::CMultiMetricMap::TOptions::TMapSelectionForLikelihood enum_t; 00670 static void fill(bimap<enum_t,std::string> &m_map) 00671 { 00672 m_map.insert(slam::CMultiMetricMap::TOptions::mapFuseAll, "mapFuseAll"); 00673 m_map.insert(slam::CMultiMetricMap::TOptions::mapGrid, "mapGrid"); 00674 m_map.insert(slam::CMultiMetricMap::TOptions::mapPoints, "mrSimpleAverage"); 00675 m_map.insert(slam::CMultiMetricMap::TOptions::mapLandmarks, "mapLandmarks"); 00676 m_map.insert(slam::CMultiMetricMap::TOptions::mapGasGrid, "mapGasGrid"); 00677 m_map.insert(slam::CMultiMetricMap::TOptions::mapWifiGrid, "mapWifiGrid"); 00678 m_map.insert(slam::CMultiMetricMap::TOptions::mapBeacon, "mapBeacon"); 00679 m_map.insert(slam::CMultiMetricMap::TOptions::mapHeight, "mapHeight"); 00680 m_map.insert(slam::CMultiMetricMap::TOptions::mapColourPoints, "mapColourPoints"); 00681 m_map.insert(slam::CMultiMetricMap::TOptions::mapReflectivity, "mapReflectivity"); 00682 m_map.insert(slam::CMultiMetricMap::TOptions::mapWeightedPoints, "mapWeightedPoints"); 00683 } 00684 }; 00685 } // End of namespace 00686 00687 00688 00689 } // End of namespace 00690 00691 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |