Main MRPT website > C++ reference for MRPT 1.3.2
CIncrementalMapPartitioner.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 
10 #ifndef CINCREMENTALMAPPARTITIONER_H
11 #define CINCREMENTALMAPPARTITIONER_H
12 
17 #include <mrpt/maps/CSimpleMap.h>
19 #include <mrpt/poses/poses_frwds.h>
20 
21 #include <mrpt/slam/link_pragmas.h>
22 
23 namespace mrpt
24 {
25 namespace slam
26 {
28 
29  /** This class can be used to make partitions on a map/graph build from
30  * observations taken at some poses/nodes.
31  * \ingroup mrpt_slam_grp
32  */
33  class SLAM_IMPEXP CIncrementalMapPartitioner : public mrpt::utils::CDebugOutputCapable, public mrpt::utils::CSerializable
34  {
35  // This must be added to any CSerializable derived class:
37 
38  public:
39  /** Constructor:
40  */
42 
43  /** Destructor:
44  */
45  virtual ~CIncrementalMapPartitioner();
46 
47  /** Initialization: Start of a new map, new internal matrices,...
48  */
49  void clear();
50 
51  /** Configuration of the algorithm:
52  */
53  struct SLAM_IMPEXP TOptions : public utils::CLoadableOptions
54  {
55  /** Sets default values at object creation
56  */
57  TOptions();
58 
59  /** Load parameters from configuration source
60  */
61  void loadFromConfigFile(
62  const mrpt::utils::CConfigFileBase &source,
63  const std::string &section);
64 
65  /** This method must display clearly all the contents of the structure in textual form, sending it to a CStream.
66  */
67  void dumpToTextStream(mrpt::utils::CStream &out) const;
68 
69  /** The partition threshold for bisection in range [0,2], default=1.0
70  */
72 
73  /** For the occupancy grid maps of each node, default=0.10
74  */
76 
77  /** Used in the computation of weights, default=0.20
78  */
80 
81  /** Used in the computation of weights, default=2.0
82  */
84 
85  /** If set to true (default), 1 or 2 clusters will be returned. Default=false -> Autodetermine the number of partitions.
86  */
88 
89  /** If set to true (default), adjacency matrix is computed from maps matching; otherwise, the method CObservation::likelihoodWith will be called directly from the SFs.
90  */
92 
93  /** If a partition leads to a cluster with less elements than this, it will be rejected even if had a good Ncut (default=1). */
95 
96  } options;
97 
98  /** Add a new frame to the current graph: call this method each time a new observation
99  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
100  * \param frame The sensed data
101  * \param robotPose An estimation of the robot global 2D pose.
102  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
103  * \sa updatePartitions
104  */
105  unsigned int addMapFrame( const mrpt::obs::CSensoryFramePtr &frame, const mrpt::poses::CPosePDFPtr &robotPose2D );
106 
107  /** Add a new frame to the current graph: call this method each time a new observation
108  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
109  * \param frame The sensed data
110  * \param robotPose An estimation of the robot global 2D pose.
111  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
112  * \sa updatePartitions
113  */
114  unsigned int addMapFrame( const mrpt::obs::CSensoryFramePtr &frame, const mrpt::poses::CPose3DPDFPtr &robotPose3D );
115 
116  /** Add a new frame to the current graph: call this method each time a new observation
117  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
118  * \param frame The sensed data
119  * \param robotPose An estimation of the robot global 2D pose.
120  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
121  * \sa updatePartitions
122  */
123  unsigned int addMapFrame( const mrpt::obs::CSensoryFrame &frame, const mrpt::poses::CPose3DPDF &robotPose3D );
124 
125  /** This method executed only the neccesary part of the partition to take
126  * into account the lastest added frames.
127  * \sa addMapFrame
128  */
129  void updatePartitions( std::vector<vector_uint> &partitions );
130 
131  /** It returns the nodes count currently in the internal map/graph.
132  */
133  unsigned int getNodesCount();
134 
135  /** Remove the stated nodes (0-based indexes) from the internal lists.
136  * If changeCoordsRef is true, coordinates are changed to leave the first node at (0,0,0).
137  */
138  void removeSetOfNodes(vector_uint indexesToRemove, bool changeCoordsRef = true);
139 
140  /** Returns a copy of the internal adjacency matrix. */
141  template <class MATRIX>
142  void getAdjacencyMatrix( MATRIX &outMatrix ) const { outMatrix = m_A; }
143 
144  /** Returns a const ref to the internal adjacency matrix. */
145  const mrpt::math::CMatrixDouble & getAdjacencyMatrix( ) const { return m_A; }
146 
147  /** Read-only access to the sequence of Sensory Frames
148  */
150  {
151  return &m_individualFrames;
152  }
153 
154  /** Access to the sequence of Sensory Frames
155  */
157  {
158  return &m_individualFrames;
159  }
160 
161  /** Mark all nodes for reconsideration in the next call to "updatePartitions", instead of considering just those affected by aditions of new arcs.
162  */
163  void markAllNodesForReconsideration();
164 
165  /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system. */
166  void changeCoordinatesOrigin( const mrpt::poses::CPose3D &newOrigin );
167 
168  /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system; the new origin is given by the index of the pose to become the new origin. */
169  void changeCoordinatesOriginPoseIndex( const unsigned &newOriginPose );
170 
171  /** Returns a 3D representation of the current state: poses & links between them.
172  * The previous contents of "objs" will be discarded
173  */
174  void getAs3DScene(
175  mrpt::opengl::CSetOfObjectsPtr &objs,
176  const std::map< uint32_t, int64_t > *renameIndexes = NULL
177  ) const;
178 
179  private:
181  std::deque<mrpt::maps::CMultiMetricMap> m_individualMaps;
182 
183  /** Adjacency matrix */
185 
186  /** The last partition */
187  std::vector<vector_uint> m_last_partition;
188 
189  /** This will be true after adding new observations, and before an "updatePartitions" is invoked. */
191 
192  /** The list of keyframes to consider in the next update */
193  std::vector<uint8_t> m_modified_nodes;
194 
195  }; // End of class def.
197 
198 
199  } // End of namespace
200 } // End of namespace
201 
202 #endif
float partitionThreshold
The partition threshold for bisection in range [0,2], default=1.0.
bool forceBisectionOnly
If set to true (default), 1 or 2 clusters will be returned.
std::deque< mrpt::maps::CMultiMetricMap > m_individualMaps
This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric<double>".
Definition: CMatrixD.h:30
std::vector< uint32_t > vector_uint
Definition: types_simple.h:28
mrpt::math::CMatrixD m_A
Adjacency matrix.
const mrpt::maps::CSimpleMap * getSequenceOfFrames() const
Read-only access to the sequence of Sensory Frames.
This class stores a sequence of <Probabilistic Pose,SensoryFrame> 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
bool useMapMatching
If set to true (default), adjacency matrix is computed from maps matching; otherwise, the method CObservation::likelihoodWith will be called directly from the SFs.
void getAdjacencyMatrix(MATRIX &outMatrix) const
Returns a copy of the internal adjacency matrix.
float gridResolution
For the occupancy grid maps of each node, default=0.10.
const mrpt::math::CMatrixDouble & getAdjacencyMatrix() const
Returns a const ref to the internal adjacency matrix.
This class allows loading and storing values and vectors of different types from a configuration text...
mrpt::maps::CSimpleMap * getSequenceOfFrames()
Access to the sequence of Sensory Frames.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
#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
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
std::vector< vector_uint > m_last_partition
The last partition.
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...
This class can be used to make partitions on a map/graph build from observations taken at some poses/...
int minimumNumberElementsEachCluster
If a partition leads to a cluster with less elements than this, it will be rejected even if had a goo...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
float minDistForCorrespondence
Used in the computation of weights, default=0.20.
bool m_last_last_partition_are_new_ones
This will be true after adding new observations, and before an "updatePartitions" is invoked...
float minMahaDistForCorrespondence
Used in the computation of weights, default=2.0.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
Definition: CPose3DPDF.h:40
std::vector< uint8_t > m_modified_nodes
The list of keyframes to consider in the next update.



Page generated by Doxygen 1.8.11 for MRPT 1.3.2 SVN: at Wed May 25 02:34:21 UTC 2016