Main MRPT website > C++ reference for MRPT 1.3.2
maps/CSimpleMap.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-2015, 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 #ifndef CSimpleMap_H
10 #define CSimpleMap_H
11 
13 #include <mrpt/obs/CSensoryFrame.h>
14 #include <mrpt/poses/CPosePDF.h>
15 #include <mrpt/poses/CPose3DPDF.h>
16 #include <mrpt/obs/obs_frwds.h>
17 
18 namespace mrpt
19 {
20 namespace maps
21 {
22  // This must be added to any CSerializable derived class:
24 
25  /** This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be totally determined with this information.
26  * The pose of the sensory frame is not deterministic, but described by some PDF. Full 6D poses are used.
27  *
28  * \note Objects of this class are serialized into (possibly GZ-compressed) files with the extension ".simplemap".
29  *
30  * \note Before MRPT 0.9.0 the name of this class was "CSensFrameProbSequence", that's why there is a typedef with that name to allow backward compatibility.
31  * \sa CSensoryFrame, CPosePDF
32  * \ingroup mrpt_obs_grp
33  */
34  class OBS_IMPEXP CSimpleMap : public mrpt::utils::CSerializable
35  {
36  // This must be added to any CSerializable derived class:
38 
39  public:
40  /** Constructor
41  */
42  CSimpleMap();
43 
44  /** Copy constructor
45  */
46  CSimpleMap( const CSimpleMap &o );
47 
48  /** Copy constructor
49  */
50  CSimpleMap & operator = ( const CSimpleMap& o);
51 
52  /** Destructor:
53  */
54  virtual ~CSimpleMap();
55 
56  /** Save this object to a .simplemap binary file (compressed with gzip)
57  * \sa loadFromFile
58  * \return false on any error.
59  */
60  bool saveToFile(const std::string &filName) const;
61 
62  /** Load the contents of this object from a .simplemap binary file (possibly compressed with gzip)
63  * \sa saveToFile
64  * \return false on any error.
65  */
66  bool loadFromFile(const std::string &filName);
67 
68 
69  /** Returns the pairs count.
70  */
71  size_t size() const;
72 
73  /** Access to the i'th pair, first one is index '0'. NOTE: This method
74  * returns pointers to the objects inside the list, nor a copy of them,
75  * so <b>do neither modify them nor delete them</b>.
76  * NOTE: You can pass a NULL pointer if you dont need one of the two variables to be returned.
77  * \exception std::exception On index out of bounds.
78  */
79  void get(size_t index, mrpt::poses::CPose3DPDFPtr &out_posePDF, mrpt::obs::CSensoryFramePtr &out_SF ) const ;
80 
81  /** Changes the i'th pair, first one is index '0'.
82  * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this.
83  * If one of the pointers is NULL, the corresponding contents of the current i'th pair is not modified (i.e. if you want just to modify one of the values).
84  * \exception std::exception On index out of bounds.
85  * \sa insert, get, remove
86  */
87  void set(size_t index, const mrpt::poses::CPose3DPDFPtr &in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
88 
89  /** Changes the i'th pair, first one is index '0'.
90  * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this.
91  * If one of the pointers is NULL, the corresponding contents of the current i'th pair is not modified (i.e. if you want just to modify one of the values).
92  * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version.
93  * \exception std::exception On index out of bounds.
94  * \sa insert, get, remove
95  */
96  void set(size_t index, const mrpt::poses::CPosePDFPtr &in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
97 
98  /** Deletes the i'th pair, first one is index '0'.
99  * \exception std::exception On index out of bounds.
100  * \sa insert, get, set
101  */
102  void remove(size_t index);
103 
104  /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired after insertion. */
105  void insert( const mrpt::poses::CPose3DPDF *in_posePDF, const mrpt::obs::CSensoryFrame &in_SF );
106 
107  /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */
108  void insert( const mrpt::poses::CPose3DPDF *in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
109 
110  /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */
111  void insert( const mrpt::poses::CPose3DPDFPtr &in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
112 
113  /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired
114  * after insertion.
115  * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version.
116  */
117  void insert( const mrpt::poses::CPosePDFPtr &in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
118 
119  /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired
120  * after insertion.
121  * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version.
122  */
123  void insert( const mrpt::poses::CPosePDF *in_posePDF, const mrpt::obs::CSensoryFrame &in_SF );
124 
125  /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired
126  * after insertion.
127  * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version.
128  */
129  void insert( const mrpt::poses::CPosePDF *in_posePDF, const mrpt::obs::CSensoryFramePtr &in_SF );
130 
131  /** Remove all stored pairs.
132  * \sa remove
133  */
134  void clear();
135 
136  /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system. */
137  void changeCoordinatesOrigin( const mrpt::poses::CPose3D &newOrigin );
138 
139 
140  typedef std::pair<mrpt::poses::CPose3DPDFPtr,mrpt::obs::CSensoryFramePtr> TPosePDFSensFramePair;
141  typedef std::deque<TPosePDFSensFramePair> TPosePDFSensFramePairList;
142 
143  typedef TPosePDFSensFramePairList::const_iterator const_iterator;
144  typedef TPosePDFSensFramePairList::iterator iterator;
145  typedef TPosePDFSensFramePairList::reverse_iterator reverse_iterator;
146  typedef TPosePDFSensFramePairList::const_reverse_iterator const_reverse_iterator;
147 
148 
149  inline const_iterator begin() const { return m_posesObsPairs.begin(); }
150  inline const_iterator end() const { return m_posesObsPairs.end(); }
151  inline iterator begin() { return m_posesObsPairs.begin(); }
152  inline iterator end() { return m_posesObsPairs.end(); }
153 
154  inline const_reverse_iterator rbegin() const { return m_posesObsPairs.rbegin(); }
155  inline const_reverse_iterator rend() const { return m_posesObsPairs.rend(); }
156  inline reverse_iterator rbegin() { return m_posesObsPairs.rbegin(); }
157  inline reverse_iterator rend() { return m_posesObsPairs.rend(); }
158 
159  private:
160  /** The stored data */
162 
163  }; // End of class def.
165 
166  } // End of namespace
167 } // End of namespace
168 
169 #endif
std::pair< mrpt::poses::CPose3DPDFPtr, mrpt::obs::CSensoryFramePtr > TPosePDFSensFramePair
This class stores a sequence of pairs, thus a "metric map" can be t...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:26
STL namespace.
std::deque< TPosePDFSensFramePair > TPosePDFSensFramePairList
const_reverse_iterator rbegin() const
#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...
class BASE_IMPEXP CSerializable
Definition: CStream.h:23
TPosePDFSensFramePairList::reverse_iterator reverse_iterator
const_iterator end() const
TPosePDFSensFramePairList::iterator iterator
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...
size_t size(const MATRIXLIKE &m, int dim)
Definition: bits.h:38
TPosePDFSensFramePairList::const_iterator const_iterator
reverse_iterator rbegin()
TPosePDFSensFramePairList::const_reverse_iterator const_reverse_iterator
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
const_reverse_iterator rend() const
TPosePDFSensFramePairList m_posesObsPairs
The stored data.
reverse_iterator rend()



Page generated by Doxygen 1.8.9.1 for MRPT 1.3.2 SVN:Unversioned directory at Thu Dec 10 00:07:55 UTC 2015