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://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 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                   * \ingroup mrpt_hmtslam_grp
00098                   */
00099                 class HMTSLAM_IMPEXP THypothesisIDSet : public mrpt::utils::CSerializable, public std::set<THypothesisID>
00100                 {
00101                         // This must be added to any CSerializable derived class:
00102                         DEFINE_SERIALIZABLE( THypothesisIDSet )
00103 
00104                 public:
00105                         /** Default constructor
00106                           */
00107                         THypothesisIDSet()
00108                         {
00109                         }
00110 
00111                         /** Constructor with one initial element
00112                           */
00113                         THypothesisIDSet( const THypothesisID& val)
00114                         {
00115                                 insert( val );
00116                         }
00117 
00118                         virtual ~THypothesisIDSet()
00119                         {
00120                         }
00121 
00122                         /** Returns true if the hypothesis is into the set.
00123                           */
00124                         bool has(  const THypothesisID& val ) const
00125                         {
00126                                 return find(val)!=end() || find(COMMON_TOPOLOG_HYP)!=end();
00127                         }
00128 
00129                         /** Dump to console.
00130                           */
00131                         void debugDump() const;
00132 
00133                 };
00134 
00135 
00136                 /** A class for storing a sequence of arcs (a path).
00137                   * \sa CHMTSLAM
00138                   */
00139                 class HMTSLAM_IMPEXP TArcList : public list_searchable<mrpt::hmtslam::CHMHMapArcPtr>
00140                 {
00141                 private:
00142                         typedef list_searchable<mrpt::hmtslam::CHMHMapArcPtr> BASE;
00143 
00144                 public:
00145                         void  debugDump();
00146                         void read( utils::CStream &in );
00147                         void write( utils::CStream &out ) const;
00148 
00149                 };
00150 
00151 
00152         } // End of namespace
00153 } // End of namespace
00154 
00155 
00156 
00157 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011