Main MRPT website > C++ reference for MRPT 1.9.9
CGridMapAligner.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-2017, 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 CGridMapAligner_H
10 #define CGridMapAligner_H
11 
15 #include <mrpt/utils/TEnumType.h>
17 #include <mrpt/poses/CPosePDFSOG.h>
18 #include <mrpt/poses/poses_frwds.h>
21 
22 namespace mrpt
23 {
24 namespace slam
25 {
26 /** A class for aligning two multi-metric maps (with an occupancy grid maps and
27  * a points map, at least) based on features extraction and matching.
28  * The matching pose is returned as a Sum of Gaussians (poses::CPosePDFSOG).
29  *
30  * This class can use three methods (see options.methodSelection):
31  * - amCorrelation: "Brute-force" correlation of the two maps over a
32  * 2D+orientation grid of possible 2D poses.
33  * - amRobustMatch: Detection of features + RANSAC matching
34  * - amModifiedRANSAC: Detection of features + modified multi-hypothesis
35  * RANSAC matching as described in was reported in the paper
36  * http://www.mrpt.org/Paper%3AOccupancy_Grid_Matching
37  *
38  * See CGridMapAligner::Align for more instructions.
39  *
40  * \sa CMetricMapsAlignmentAlgorithm
41  * \ingroup mrpt_slam_grp
42  */
44 {
45  private:
46  /** Private member, implements one the algorithms.
47  */
50  const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
51  float* runningTime = nullptr, void* info = nullptr);
52 
53  /** Private member, implements both, the "robustMatch" and the newer
54  * "modifiedRANSAC" algorithms.
55  */
58  const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
59  float* runningTime = nullptr, void* info = nullptr);
60 
61  /** Grid map features extractor */
63 
64  public:
66  /** The type for selecting the grid-map alignment algorithm.
67  */
69  {
73  };
74 
75  /** The ICP algorithm configuration data
76  */
78  {
79  public:
80  /** Initializer for default values:
81  */
82  TConfigParams();
83 
84  void loadFromConfigFile(
86  const std::string& section) override; // See base docs
87  void dumpToTextStream(
88  mrpt::utils::CStream& out) const override; // See base docs
89 
90  /** The aligner method: */
92 
93  /** The feature descriptor to use: 0=detector already has descriptor, 1=
94  * SIFT, 2=SURF, 4=Spin images, 8=Polar images, 16=log-polar images */
96 
97  /** All the parameters for the feature detector. */
99 
100  /** RANSAC-step options:
101  * \sa CICP::robustRigidTransformation
102  */
103  /** The ratio of landmarks that must be inliers to accepto an hypotheses
104  * (typ: 0.20) */
106  /** The square root of the uncertainty normalization variance var_m (see
107  * papers...) */
109 
110  /** [amRobustMatch method only] RANSAC-step options:
111  * \sa CICP::robustRigidTransformation
112  */
114 
115  /** [amModifiedRANSAC method only] The quantile used for chi-square
116  * thresholding (default=0.99) */
118 
119  /** Probability of having a good inliers (def:0,9999), used for
120  * automatic number of iterations */
122  /** Features extraction from grid map: How many features to extract */
124  /** Correspondences are considered if their distances are below this
125  * threshold (in the range [0,1]) (default=0.15). */
127  /** Correspondences are considered if their distances to the best match
128  * are below this threshold (in the range [0,1]) (default=0.15). */
130 
131  /** The minimum goodness (0-1) of the post-matching ICP to accept a
132  * hypothesis as good (default=0.30) */
134  /** The maximum Mahalanobis distance between the initial and final poses
135  * in the ICP not to discard the hypothesis (default=10) */
137  /** Maximum KL-divergence for merging modes of the SOG (default=0.9) */
139 
140  /** DEBUG - Dump all feature correspondences in a directory "grid_feats"
141  */
143  /** DEBUG - Show graphs with the details of each feature correspondences
144  */
146  /** DEBUG - Save the pair of maps with all the pairings. */
148 
149  } options;
150 
151  /** The ICP algorithm return information.
152  */
153  struct TReturnInfo
154  {
156  /** A goodness measure for the alignment, it is a [0,1] range indicator
157  * of percentage of correspondences.
158  */
159  float goodness;
160 
161  /** The "brute" estimation from using all the available correspondences,
162  * provided just for comparison purposes (it is not the robust
163  * estimation, available as the result of the Align method).
164  */
166 
167  /** The different SOG densities at different steps of the algorithm:
168  * - sog1 : Directly from the matching of features
169  * - sog2 : Merged of sog1
170  * - sog3 : sog2 refined with ICP
171  *
172  * - The final sog is the merge of sog3.
173  *
174  */
176  sog3;
177 
178  /** The landmarks of each map (the indices of these landmarks correspond
179  * to those in "correspondences") */
181 
182  /** All the found correspondences (not consistent) */
184 
186  {
187  TPairPlusDistance(size_t i1, size_t i2, float d)
188  : idx_this(i1), idx_other(i2), dist(d)
189  {
190  }
192  float dist;
193  };
194 
195  /** Mahalanobis distance for each potential correspondence */
196  std::vector<TPairPlusDistance> correspondences_dists_maha;
197 
198  /** The ICP goodness of all potential SOG modes at the stage "sog2",
199  * thus before the removing of "bad" ICP matches. */
200  std::vector<double> icp_goodness_all_sog_modes;
201  };
202 
203  /** The method for aligning a pair of 2D points map.
204  * The meaning of some parameters are implementation dependant,
205  * so look for derived classes for instructions.
206  * The target is to find a PDF for the pose displacement between
207  * maps, thus <b>the pose of m2 relative to m1</b>. This pose
208  * is returned as a PDF rather than a single value.
209  *
210  * NOTE: This method can be configurated with "options"
211  *
212  * \param m1 [IN] The first map (Must be a
213  *mrpt::maps::CMultiMetricMap
214  *class)
215  * \param m2 [IN] The second map (Must be a
216  *mrpt::maps::CMultiMetricMap
217  *class)
218  * \param initialEstimationPDF [IN] (IGNORED IN THIS ALGORITHM!)
219  * \param runningTime [OUT] A pointer to a container for obtaining the
220  *algorithm running time in seconds, or NULL if you don't need it.
221  * \param info [OUT] A pointer to a TReturnInfo struct, or NULL if
222  *result information are not required.
223  *
224  * \note The returned PDF depends on the selected alignment method:
225  * - "amRobustMatch" --> A "poses::CPosePDFSOG" object.
226  * - "amCorrelation" --> A "poses::CPosePDFGrid" object.
227  *
228  * \return A smart pointer to the output estimated pose PDF.
229  * \sa CPointsMapAlignmentAlgorithm, options
230  */
232  const mrpt::maps::CMetricMap* m1, const mrpt::maps::CMetricMap* m2,
233  const mrpt::poses::CPosePDFGaussian& initialEstimationPDF,
234  float* runningTime = nullptr,
235 
236  void* info = nullptr);
237 
238  /** Not applicable in this class, will launch an exception. */
240  const mrpt::maps::CMetricMap* m1, const mrpt::maps::CMetricMap* m2,
241  const mrpt::poses::CPose3DPDFGaussian& initialEstimationPDF,
242  float* runningTime = nullptr, void* info = nullptr);
243 };
244 
245 } // End of namespace
246 
247 // Specializations MUST occur at the same namespace:
248 namespace utils
249 {
250 template <>
251 struct TEnumTypeFiller<slam::CGridMapAligner::TAlignerMethod>
252 {
254  static void fill(bimap<enum_t, std::string>& m_map)
255  {
256  m_map.insert(slam::CGridMapAligner::amRobustMatch, "amRobustMatch");
257  m_map.insert(slam::CGridMapAligner::amCorrelation, "amCorrelation");
258  m_map.insert(
259  slam::CGridMapAligner::amModifiedRANSAC, "amModifiedRANSAC");
260  }
261 };
262 } // End of namespace
263 
264 } // End of namespace
265 
266 #endif
mrpt::utils::poly_ptr_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog2
double ransac_chi2_quantile
[amModifiedRANSAC method only] The quantile used for chi-square thresholding (default=0.99)
std::vector< TPairPlusDistance > correspondences_dists_maha
Mahalanobis distance for each potential correspondence.
double maxKLd_for_merge
Maximum KL-divergence for merging modes of the SOG (default=0.9)
A class for aligning two multi-metric maps (with an occupancy grid maps and a points map...
bool debug_show_corrs
DEBUG - Show graphs with the details of each feature correspondences.
TAlignerMethod
The type for selecting the grid-map alignment algorithm.
The ICP algorithm configuration data.
mrpt::poses::CPose3DPDF::Ptr Align3DPDF(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPose3DPDFGaussian &initialEstimationPDF, float *runningTime=nullptr, void *info=nullptr)
Not applicable in this class, will launch an exception.
The set of parameters for all the detectors & descriptor algorithms.
Only specializations of this class are defined for each enum type of interest.
Definition: TEnumType.h:24
mrpt::poses::CPosePDF::Ptr AlignPDF_robustMatch(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPosePDFGaussian &initialEstimationPDF, float *runningTime=nullptr, void *info=nullptr)
Private member, implements both, the "robustMatch" and the newer "modifiedRANSAC" algorithms...
The ICP algorithm return information.
This class allows loading and storing values and vectors of different types from a configuration text...
mrpt::poses::CPosePDF::Ptr AlignPDF(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPosePDFGaussian &initialEstimationPDF, float *runningTime=nullptr, void *info=nullptr)
The method for aligning a pair of 2D points map.
mrpt::poses::CPosePDF::Ptr AlignPDF_correlation(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPosePDFGaussian &initialEstimationPDF, float *runningTime=nullptr, void *info=nullptr)
Private member, implements one the algorithms.
std::shared_ptr< CLandmarksMap > Ptr
Definition: CLandmarksMap.h:77
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
std::shared_ptr< CPosePDF > Ptr
Definition: CPosePDF.h:44
mrpt::vision::TDescriptorType feature_descriptor
The feature descriptor to use: 0=detector already has descriptor, 1= SIFT, 2=SURF, 4=Spin images, 8=Polar images, 16=log-polar images.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
bool debug_save_map_pairs
DEBUG - Save the pair of maps with all the pairings.
bool save_feat_coors
DEBUG - Dump all feature correspondences in a directory "grid_feats".
A list of TMatchingPair.
Definition: TMatchingPair.h:93
mrpt::vision::CFeatureExtraction::TOptions feature_detector_options
All the parameters for the feature detector.
COccupancyGridMapFeatureExtractor m_grid_feat_extr
Grid map features extractor.
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
Definition: bimap.h:34
std::shared_ptr< CPose3DPDF > Ptr
Definition: CPose3DPDF.h:45
mrpt::utils::TMatchingPairList correspondences
All the found correspondences (not consistent)
float ransac_minSetSizeRatio
RANSAC-step options:
TConfigParams()
Initializer for default values:
GLsizei const GLchar ** string
Definition: glext.h:4101
float ransac_SOG_sigma_m
The square root of the uncertainty normalization variance var_m (see papers...)
mrpt::utils::poly_ptr_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog3
mrpt::utils::poly_ptr_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog1
The different SOG densities at different steps of the algorithm:
float threshold_delta
Correspondences are considered if their distances to the best match are below this threshold (in the ...
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
float goodness
A goodness measure for the alignment, it is a [0,1] range indicator of percentage of correspondences...
mrpt::maps::CLandmarksMap::Ptr landmarks_map1
The landmarks of each map (the indices of these landmarks correspond to those in "correspondences") ...
float ransac_mahalanobisDistanceThreshold
[amRobustMatch method only] RANSAC-step options:
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
std::vector< double > icp_goodness_all_sog_modes
The ICP goodness of all potential SOG modes at the stage "sog2", thus before the removing of "bad" IC...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double ransac_prob_good_inliers
Probability of having a good inliers (def:0,9999), used for automatic number of iterations.
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:55
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:40
A base class for any algorithm able of maps alignment.
static void fill(bimap< enum_t, std::string > &m_map)
double max_ICP_mahadist
The maximum Mahalanobis distance between the initial and final poses in the ICP not to discard the hy...
float featsPerSquareMeter
Features extraction from grid map: How many features to extract.
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
TAlignerMethod methodSelection
The aligner method:
mrpt::slam::CGridMapAligner::TConfigParams options
mrpt::maps::CLandmarksMap::Ptr landmarks_map2
void insert(const KEY &k, const VALUE &v)
Insert a new pair KEY<->VALUE in the bi-map.
Definition: bimap.h:75
A class for detecting features from occupancy grid maps.
float threshold_max
Correspondences are considered if their distances are below this threshold (in the range [0...
mrpt::poses::CPose2D noRobustEstimation
The "brute" estimation from using all the available correspondences, provided just for comparison pur...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
float min_ICP_goodness
The minimum goodness (0-1) of the post-matching ICP to accept a hypothesis as good (default=0...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019