Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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  */
54  {
55  /** Sets default values at object creation
56  */
57  TOptions();
58 
59  void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source,const std::string &section) MRPT_OVERRIDE; // See base docs
60  void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE; // See base docs
61 
62  /** The partition threshold for bisection in range [0,2], default=1.0
63  */
65 
66  /** For the occupancy grid maps of each node, default=0.10
67  */
69 
70  /** Used in the computation of weights, default=0.20
71  */
73 
74  /** Used in the computation of weights, default=2.0
75  */
77 
78  /** If set to true (default), 1 or 2 clusters will be returned. Default=false -> Autodetermine the number of partitions.
79  */
81 
82  /** If set to true (default), adjacency matrix is computed from maps matching; otherwise, the method CObservation::likelihoodWith will be called directly from the SFs.
83  */
85 
86  /** If a partition leads to a cluster with less elements than this, it will be rejected even if had a good Ncut (default=1). */
88 
89  } options;
90 
91  /** Add a new frame to the current graph: call this method each time a new observation
92  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
93  * \param frame The sensed data
94  * \param robotPose An estimation of the robot global 2D pose.
95  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
96  * \sa updatePartitions
97  */
98  unsigned int addMapFrame( const mrpt::obs::CSensoryFramePtr &frame, const mrpt::poses::CPosePDFPtr &robotPose2D );
99 
100  /** Add a new frame to the current graph: call this method each time a new observation
101  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
102  * \param frame The sensed data
103  * \param robotPose An estimation of the robot global 2D pose.
104  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
105  * \sa updatePartitions
106  */
107  unsigned int addMapFrame( const mrpt::obs::CSensoryFramePtr &frame, const mrpt::poses::CPose3DPDFPtr &robotPose3D );
108 
109  /** Add a new frame to the current graph: call this method each time a new observation
110  * is added to the map/graph, and whenever you want to update the partitions, call "updatePartitions"
111  * \param frame The sensed data
112  * \param robotPose An estimation of the robot global 2D pose.
113  * \return The index of the new pose in the internal list, which will be used to refer to the pose in the future.
114  * \sa updatePartitions
115  */
116  unsigned int addMapFrame( const mrpt::obs::CSensoryFrame &frame, const mrpt::poses::CPose3DPDF &robotPose3D );
117 
118  /** This method executed only the neccesary part of the partition to take
119  * into account the lastest added frames.
120  * \sa addMapFrame
121  */
122  void updatePartitions( std::vector<vector_uint> &partitions );
123 
124  /** It returns the nodes count currently in the internal map/graph.
125  */
126  unsigned int getNodesCount();
127 
128  /** Remove the stated nodes (0-based indexes) from the internal lists.
129  * If changeCoordsRef is true, coordinates are changed to leave the first node at (0,0,0).
130  */
131  void removeSetOfNodes(vector_uint indexesToRemove, bool changeCoordsRef = true);
132 
133  /** Returns a copy of the internal adjacency matrix. */
134  template <class MATRIX>
135  void getAdjacencyMatrix( MATRIX &outMatrix ) const { outMatrix = m_A; }
136 
137  /** Returns a const ref to the internal adjacency matrix. */
138  const mrpt::math::CMatrixDouble & getAdjacencyMatrix( ) const { return m_A; }
139 
140  /** Read-only access to the sequence of Sensory Frames
141  */
143  {
144  return &m_individualFrames;
145  }
146 
147  /** Access to the sequence of Sensory Frames
148  */
150  {
151  return &m_individualFrames;
152  }
153 
154  /** Mark all nodes for reconsideration in the next call to "updatePartitions", instead of considering just those affected by aditions of new arcs.
155  */
156  void markAllNodesForReconsideration();
157 
158  /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system. */
159  void changeCoordinatesOrigin( const mrpt::poses::CPose3D &newOrigin );
160 
161  /** 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. */
162  void changeCoordinatesOriginPoseIndex( const unsigned &newOriginPose );
163 
164  /** Returns a 3D representation of the current state: poses & links between them.
165  * The previous contents of "objs" will be discarded
166  */
167  void getAs3DScene(
168  mrpt::opengl::CSetOfObjectsPtr &objs,
169  const std::map< uint32_t, int64_t > *renameIndexes = NULL
170  ) const;
171 
172  private:
174  std::deque<mrpt::maps::CMultiMetricMap> m_individualMaps;
175 
176  /** Adjacency matrix */
178 
179  /** The last partition */
180  std::vector<vector_uint> m_last_partition;
181 
182  /** This will be true after adding new observations, and before an "updatePartitions" is invoked. */
184 
185  /** The list of keyframes to consider in the next update */
186  std::vector<uint8_t> m_modified_nodes;
187 
188  }; // End of class def.
190 
191 
192  } // End of namespace
193 } // End of namespace
194 
195 #endif
void getAdjacencyMatrix(MATRIX &outMatrix) const
Returns a copy of the internal adjacency matrix.
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.
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
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
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.
float gridResolution
For the occupancy grid maps of each node, default=0.10.
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...
const mrpt::math::CMatrixDouble & getAdjacencyMatrix() const
Returns a const ref to the internal adjacency matrix.
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
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
const mrpt::maps::CSimpleMap * getSequenceOfFrames() const
Read-only access to the sequence of Sensory Frames.
std::vector< uint8_t > m_modified_nodes
The list of keyframes to consider in the next update.



Page generated by Doxygen 1.8.13 for MRPT 1.4.0 SVN: at Fri Mar 17 07:27:15 UTC 2017