Main MRPT website > C++ reference
MRPT logo

HMT_SLAM_common.h

Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                   http://mrpt.sourceforge.net/                            |
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 HMT_SLAM_common_H
00029 #define HMT_SLAM_common_H
00030 
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/utils/stl_extensions.h>
00033 
00034 #include <mrpt/hmtslam/link_pragmas.h>
00035 
00036 
00037 #define COMMON_TOPOLOG_HYP                                      static_cast<THypothesisID>(0)
00038 
00039 #define NODE_ANNOTATION_METRIC_MAPS             "metricMaps"         // CMultiMetricMap
00040 #define NODE_ANNOTATION_REF_POSEID                      "refPoseID"                      // TPoseID
00041 #define NODE_ANNOTATION_POSES_GRAPH             "posesGraph"         // CRobotPosesGraph
00042 
00043 #define NODE_ANNOTATION_PLACE_POSE                      "placePose"          // CPoint2D
00044 
00045 #define ARC_ANNOTATION_DELTA                            "Delta"                          // CPose3DPDF (for the current implementation, it's a CPose3DPDFParticles)
00046 #define ARC_ANNOTATION_DELTA_SRC_POSEID         "Delta_poseID_src"       // TPoseID (elemental datatype)
00047 #define ARC_ANNOTATION_DELTA_TRG_POSEID         "Delta_poseID_trg"       // TPoseID (elemental datatype)
00048 
00049 /**  Used in constructor of mrpt::hmtslam::CHMHMapArc */
00050 #define ARC_TYPES                       "Membership,Navegability,RelativePose,Location"
00051 #define DEFAULT_ARC_TYPE        "Membership"
00052 
00053 /**  Used in constructor of mrpt::hmtslam::CHMHMapNode */
00054 #define NODE_TYPES                      "Place,Area,TopologicalMap,Object"
00055 #define DEFAULT_NODE_TYPE       "Place"
00056 
00057 // Used as current robot pose when initializing an empty HMT-map.
00058 #define POSEID_INVALID  static_cast<TPoseID>(-1)
00059 
00060 #define AREAID_INVALID  static_cast<uint64_t>(-1)
00061 
00062 #define MSG_SOURCE_LSLAM    1
00063 #define MSG_SOURCE_AA       2
00064 
00065 namespace mrpt
00066 {
00067         namespace hmtslam
00068         {
00069                 using namespace mrpt::utils;
00070 
00071                 class HMTSLAM_IMPEXP CHMHMapArc;
00072                 class HMTSLAM_IMPEXP CHMHMapNode;
00073 
00074                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CHMHMapArc,mrpt::utils::CSerializable, HMTSLAM_IMPEXP )
00075 
00076 
00077                 /** An integer number uniquely identifying each of the concurrent hypotheses for the robot topological path (& possibly local metric clusters) in HMT-SLAM.
00078                   *   The number 0 has the special meaning of "that part of the map/robot path in which all hypotheses agree".
00079                   *  They can be generated from CHMTSLAM::generateHypothesisID()
00080                   */
00081                 typedef int64_t  THypothesisID;
00082 
00083                 /** An integer number uniquely identifying each robot pose stored in HMT-SLAM.
00084                   * They can be generated from CHMTSLAM::generatePoseID()
00085                   */
00086                 typedef uint64_t  TPoseID;
00087 
00088                 typedef std::pair<TPoseID,TPoseID>  TPairPoseIDs;
00089 
00090                 typedef std::vector<TPoseID> TPoseIDList;
00091                 typedef std::set<TPoseID> TPoseIDSet;
00092 
00093                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( THypothesisIDSet,mrpt::utils::CSerializable, HMTSLAM_IMPEXP )
00094 
00095                 /** A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps.
00096                   *  \sa THypothesisID, CHierarchicalMHMap
00097                   */
00098                 class HMTSLAM_IMPEXP THypothesisIDSet : public mrpt::utils::CSerializable, public std::set<THypothesisID>
00099                 {
00100                         // This must be added to any CSerializable derived class:
00101                         DEFINE_SERIALIZABLE( THypothesisIDSet )
00102 
00103                 public:
00104                         /** Default constructor
00105                           */
00106                         THypothesisIDSet()
00107                         {
00108                         }
00109 
00110                         /** Constructor with one initial element
00111                           */
00112                         THypothesisIDSet( const THypothesisID& val)
00113                         {
00114                                 insert( val );
00115                         }
00116 
00117                         virtual ~THypothesisIDSet()
00118                         {
00119                         }
00120 
00121                         /** Returns true if the hypothesis is into the set.
00122                           */
00123                         bool has(  const THypothesisID& val ) const
00124                         {
00125                                 return find(val)!=end() || find(COMMON_TOPOLOG_HYP)!=end();
00126                         }
00127 
00128                         /** Dump to console.
00129                           */
00130                         void debugDump() const;
00131 
00132                 };
00133 
00134 
00135                 /** A class for storing a sequence of arcs (a path).
00136                   * \sa CHMTSLAM
00137                   */
00138                 class HMTSLAM_IMPEXP TArcList : public list_searchable<mrpt::hmtslam::CHMHMapArcPtr>
00139                 {
00140                 private:
00141                         typedef list_searchable<mrpt::hmtslam::CHMHMapArcPtr> BASE;
00142 
00143                 public:
00144                         void  debugDump();
00145                         void read( utils::CStream &in );
00146                         void write( utils::CStream &out ) const;
00147 
00148                 };
00149 
00150 
00151         } // End of namespace
00152 } // End of namespace
00153 
00154 
00155 
00156 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011