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-2018, 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 
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  std::ostream& 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  */
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 } // namespace slam
246 } // namespace mrpt
247 
249 using namespace mrpt::slam;
250 MRPT_FILL_ENUM_MEMBER(CGridMapAligner, amRobustMatch);
251 MRPT_FILL_ENUM_MEMBER(CGridMapAligner, amCorrelation);
252 MRPT_FILL_ENUM_MEMBER(CGridMapAligner, amModifiedRANSAC);
254 
255 #endif
mrpt::slam::CGridMapAligner::TReturnInfo::noRobustEstimation
mrpt::poses::CPose2D noRobustEstimation
The "brute" estimation from using all the available correspondences, provided just for comparison pur...
Definition: CGridMapAligner.h:165
mrpt::slam::CMetricMapsAlignmentAlgorithm
A base class for any algorithm able of maps alignment.
Definition: CMetricMapsAlignmentAlgorithm.h:29
mrpt::poses::CPose3DPDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
Definition: CPose3DPDFGaussian.h:40
mrpt::slam::CGridMapAligner::TReturnInfo::TPairPlusDistance
Definition: CGridMapAligner.h:185
mrpt::slam::CGridMapAligner::TReturnInfo::TPairPlusDistance::idx_other
size_t idx_other
Definition: CGridMapAligner.h:191
MRPT_ENUM_TYPE_END
#define MRPT_ENUM_TYPE_END()
Definition: TEnumType.h:74
mrpt::slam::CGridMapAligner::TConfigParams::ransac_prob_good_inliers
double ransac_prob_good_inliers
Probability of having a good inliers (def:0,9999), used for automatic number of iterations.
Definition: CGridMapAligner.h:121
mrpt::vision::TDescriptorType
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
Definition: vision/include/mrpt/vision/types.h:95
mrpt::slam::CGridMapAligner::TConfigParams::max_ICP_mahadist
double max_ICP_mahadist
The maximum Mahalanobis distance between the initial and final poses in the ICP not to discard the hy...
Definition: CGridMapAligner.h:136
mrpt::slam::CGridMapAligner::TReturnInfo::TPairPlusDistance::TPairPlusDistance
TPairPlusDistance(size_t i1, size_t i2, float d)
Definition: CGridMapAligner.h:187
mrpt::slam::COccupancyGridMapFeatureExtractor
A class for detecting features from occupancy grid maps.
Definition: COccupancyGridMapFeatureExtractor.h:35
CPosePDFSOG.h
mrpt::slam::CGridMapAligner::TConfigParams::debug_show_corrs
bool debug_show_corrs
DEBUG - Show graphs with the details of each feature correspondences.
Definition: CGridMapAligner.h:145
mrpt::slam::CGridMapAligner::TReturnInfo::TPairPlusDistance::dist
float dist
Definition: CGridMapAligner.h:192
mrpt::slam::CGridMapAligner::TConfigParams::feature_detector_options
mrpt::vision::CFeatureExtraction::TOptions feature_detector_options
All the parameters for the feature detector.
Definition: CGridMapAligner.h:98
COccupancyGridMapFeatureExtractor.h
mrpt::maps::CLandmarksMap::Ptr
std::shared_ptr< CLandmarksMap > Ptr
Definition: CLandmarksMap.h:77
mrpt::slam::CGridMapAligner::TConfigParams::threshold_max
float threshold_max
Correspondences are considered if their distances are below this threshold (in the range [0,...
Definition: CGridMapAligner.h:126
mrpt::slam::CGridMapAligner::CGridMapAligner
CGridMapAligner()
Definition: CGridMapAligner.h:65
mrpt::slam::CGridMapAligner::AlignPDF
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.
Definition: CGridMapAligner.cpp:39
mrpt::slam::CGridMapAligner::AlignPDF_correlation
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.
Definition: CGridMapAligner.cpp:1015
mrpt::slam::CGridMapAligner::Align3DPDF
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.
Definition: CGridMapAligner.cpp:1259
mrpt::slam::CGridMapAligner::options
mrpt::slam::CGridMapAligner::TConfigParams options
mrpt::slam::CGridMapAligner::TConfigParams::ransac_SOG_sigma_m
float ransac_SOG_sigma_m
The square root of the uncertainty normalization variance var_m (see papers...)
Definition: CGridMapAligner.h:108
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
MRPT_FILL_ENUM_MEMBER
MRPT_FILL_ENUM_MEMBER(CGridMapAligner, amRobustMatch)
mrpt::slam::CGridMapAligner::TReturnInfo::sog2
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog2
Definition: CGridMapAligner.h:176
mrpt::slam::CGridMapAligner::TConfigParams::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: CGridMapAligner.cpp:1193
MRPT_ENUM_TYPE_BEGIN
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
Definition: TEnumType.h:58
mrpt::slam::CGridMapAligner::amRobustMatch
@ amRobustMatch
Definition: CGridMapAligner.h:70
mrpt::slam::CGridMapAligner::TConfigParams::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: CGridMapAligner.cpp:1224
mrpt::slam::CGridMapAligner::TReturnInfo::icp_goodness_all_sog_modes
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...
Definition: CGridMapAligner.h:200
mrpt::slam::CGridMapAligner::TConfigParams::TConfigParams
TConfigParams()
Initializer for default values:
Definition: CGridMapAligner.cpp:1166
mrpt::slam::CGridMapAligner::TConfigParams::ransac_chi2_quantile
double ransac_chi2_quantile
[amModifiedRANSAC method only] The quantile used for chi-square thresholding (default=0....
Definition: CGridMapAligner.h:117
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::maps::CMetricMap
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:56
mrpt::slam::CGridMapAligner::TReturnInfo::correspondences
mrpt::tfest::TMatchingPairList correspondences
All the found correspondences (not consistent)
Definition: CGridMapAligner.h:183
mrpt::slam::CGridMapAligner::TConfigParams
The ICP algorithm configuration data.
Definition: CGridMapAligner.h:77
CLandmarksMap.h
mrpt::slam::CGridMapAligner::TConfigParams::featsPerSquareMeter
float featsPerSquareMeter
Features extraction from grid map: How many features to extract.
Definition: CGridMapAligner.h:123
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::slam::CGridMapAligner::TReturnInfo::TReturnInfo
TReturnInfo()
Definition: CGridMapAligner.h:155
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:40
mrpt::slam::CGridMapAligner::TReturnInfo::sog1
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog1
The different SOG densities at different steps of the algorithm:
Definition: CGridMapAligner.h:175
CMetricMapsAlignmentAlgorithm.h
TEnumType.h
CFeatureExtraction.h
mrpt::slam::CGridMapAligner::TReturnInfo::TPairPlusDistance::idx_this
size_t idx_this
Definition: CGridMapAligner.h:191
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
mrpt::vision::CFeatureExtraction::TOptions
The set of parameters for all the detectors & descriptor algorithms.
Definition: CFeatureExtraction.h:95
mrpt::slam::CGridMapAligner::TReturnInfo::goodness
float goodness
A goodness measure for the alignment, it is a [0,1] range indicator of percentage of correspondences.
Definition: CGridMapAligner.h:159
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDFSOG::Ptr >
mrpt::slam::CGridMapAligner::TConfigParams::debug_save_map_pairs
bool debug_save_map_pairs
DEBUG - Save the pair of maps with all the pairings.
Definition: CGridMapAligner.h:147
mrpt::slam::CGridMapAligner::TConfigParams::threshold_delta
float threshold_delta
Correspondences are considered if their distances to the best match are below this threshold (in the ...
Definition: CGridMapAligner.h:129
mrpt::slam::CGridMapAligner::TConfigParams::ransac_mahalanobisDistanceThreshold
float ransac_mahalanobisDistanceThreshold
[amRobustMatch method only] RANSAC-step options:
Definition: CGridMapAligner.h:113
mrpt::slam::CGridMapAligner::m_grid_feat_extr
COccupancyGridMapFeatureExtractor m_grid_feat_extr
Grid map features extractor.
Definition: CGridMapAligner.h:62
mrpt::slam::CGridMapAligner::TConfigParams::ransac_minSetSizeRatio
float ransac_minSetSizeRatio
RANSAC-step options:
Definition: CGridMapAligner.h:105
mrpt::slam::CGridMapAligner
A class for aligning two multi-metric maps (with an occupancy grid maps and a points map,...
Definition: CGridMapAligner.h:43
mrpt::slam::CGridMapAligner::TConfigParams::min_ICP_goodness
float min_ICP_goodness
The minimum goodness (0-1) of the post-matching ICP to accept a hypothesis as good (default=0....
Definition: CGridMapAligner.h:133
mrpt::slam::CGridMapAligner::TReturnInfo::sog3
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDFSOG::Ptr > sog3
Definition: CGridMapAligner.h:176
mrpt::slam::CGridMapAligner::TConfigParams::methodSelection
TAlignerMethod methodSelection
The aligner method:
Definition: CGridMapAligner.h:91
mrpt::slam::CGridMapAligner::TConfigParams::maxKLd_for_merge
double maxKLd_for_merge
Maximum KL-divergence for merging modes of the SOG (default=0.9)
Definition: CGridMapAligner.h:138
mrpt::slam::CGridMapAligner::TReturnInfo
The ICP algorithm return information.
Definition: CGridMapAligner.h:153
CLoadableOptions.h
poses_frwds.h
mrpt::slam::CGridMapAligner::AlignPDF_robustMatch
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.
Definition: CGridMapAligner.cpp:73
deepcopy_poly_ptr.h
mrpt::poses::CPose3DPDF::Ptr
std::shared_ptr< CPose3DPDF > Ptr
Definition: CPose3DPDF.h:45
mrpt::tfest::TMatchingPairList
A list of TMatchingPair.
Definition: TMatchingPair.h:83
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::slam::CGridMapAligner::TReturnInfo::landmarks_map1
mrpt::maps::CLandmarksMap::Ptr landmarks_map1
The landmarks of each map (the indices of these landmarks correspond to those in "correspondences")
Definition: CGridMapAligner.h:180
mrpt::slam::CGridMapAligner::TReturnInfo::correspondences_dists_maha
std::vector< TPairPlusDistance > correspondences_dists_maha
Mahalanobis distance for each potential correspondence.
Definition: CGridMapAligner.h:196
mrpt::slam::CGridMapAligner::amModifiedRANSAC
@ amModifiedRANSAC
Definition: CGridMapAligner.h:72
mrpt::poses::CPosePDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 2D pose .
Definition: CPosePDFGaussian.h:31
mrpt::poses::CPosePDF::Ptr
std::shared_ptr< CPosePDF > Ptr
Definition: CPosePDF.h:44
mrpt::slam
Definition: CMultiMetricMapPDF.h:27
mrpt::slam::CGridMapAligner::TReturnInfo::landmarks_map2
mrpt::maps::CLandmarksMap::Ptr landmarks_map2
Definition: CGridMapAligner.h:180
mrpt::slam::CGridMapAligner::TConfigParams::feature_descriptor
mrpt::vision::TDescriptorType feature_descriptor
The feature descriptor to use: 0=detector already has descriptor, 1= SIFT, 2=SURF,...
Definition: CGridMapAligner.h:95
mrpt::slam::CGridMapAligner::TAlignerMethod
TAlignerMethod
The type for selecting the grid-map alignment algorithm.
Definition: CGridMapAligner.h:68
mrpt::slam::CGridMapAligner::TConfigParams::save_feat_coors
bool save_feat_coors
DEBUG - Dump all feature correspondences in a directory "grid_feats".
Definition: CGridMapAligner.h:142
mrpt::slam::CGridMapAligner::amCorrelation
@ amCorrelation
Definition: CGridMapAligner.h:71



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST