-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] gicp: add convergence criteria and correspondence estimation #5287
Open
keineahnung2345
wants to merge
4
commits into
PointCloudLibrary:master
Choose a base branch
from
keineahnung2345:gicp_convergence
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
|
||
#include <pcl/registration/bfgs.h> | ||
#include <pcl/registration/icp.h> | ||
#include <pcl/registration/gicp_convergence_criteria.h> | ||
|
||
namespace pcl { | ||
/** \brief GeneralizedIterativeClosestPoint is an ICP variant that implements the | ||
|
@@ -76,6 +77,17 @@ class GeneralizedIterativeClosestPoint | |
using IterativeClosestPoint<PointSource, PointTarget>::inlier_threshold_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::min_number_correspondences_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::update_visualizer_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::correspondences_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::correspondence_estimation_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::correspondence_rejectors_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::setUseReciprocalCorrespondences; | ||
using IterativeClosestPoint<PointSource, PointTarget>::getUseReciprocalCorrespondences; | ||
using IterativeClosestPoint<PointSource, PointTarget>::determineRequiredBlobData; | ||
using IterativeClosestPoint<PointSource, PointTarget>::use_reciprocal_correspondence_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::source_has_normals_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::target_has_normals_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::need_source_blob_; | ||
using IterativeClosestPoint<PointSource, PointTarget>::need_target_blob_; | ||
|
||
using PointCloudSource = pcl::PointCloud<PointSource>; | ||
using PointCloudSourcePtr = typename PointCloudSource::Ptr; | ||
|
@@ -102,6 +114,9 @@ class GeneralizedIterativeClosestPoint | |
|
||
using Vector6d = Eigen::Matrix<double, 6, 1>; | ||
|
||
typename pcl::registration::GICPConvergenceCriteria<float>::Ptr | ||
convergence_criteria_; | ||
|
||
/** \brief Empty constructor. */ | ||
GeneralizedIterativeClosestPoint() | ||
: k_correspondences_(20) | ||
|
@@ -125,6 +140,39 @@ class GeneralizedIterativeClosestPoint | |
estimateRigidTransformationBFGS( | ||
cloud_src, indices_src, cloud_tgt, indices_tgt, transformation_matrix); | ||
}; | ||
convergence_criteria_.reset( | ||
new pcl::registration::GICPConvergenceCriteria<float>( | ||
nr_iterations_, transformation_, previous_transformation_, *correspondences_)); | ||
} | ||
|
||
/** | ||
* \brief Due to `convergence_criteria_` holding references to the class members, | ||
* it is tricky to correctly implement its copy and move operations correctly. This | ||
* can result in subtle bugs and to prevent them, these operations for GICP have | ||
* been disabled. | ||
* | ||
* \todo: remove deleted ctors and assignments operations after resolving the issue | ||
*/ | ||
GeneralizedIterativeClosestPoint(const GeneralizedIterativeClosestPoint&) = delete; | ||
GeneralizedIterativeClosestPoint(GeneralizedIterativeClosestPoint&&) = delete; | ||
GeneralizedIterativeClosestPoint& | ||
operator=(const GeneralizedIterativeClosestPoint&) = delete; | ||
GeneralizedIterativeClosestPoint& | ||
operator=(GeneralizedIterativeClosestPoint&&) = delete; | ||
|
||
/** \brief Returns a pointer to the GICPConvergenceCriteria used by the | ||
* GeneralizedIterativeClosestPoint class. This allows to check the convergence state after the | ||
* align() method as well as to configure GICPConvergenceCriteria's parameters not | ||
* available through the GICP API before the align() method is called. Please note that | ||
* the align method sets max_iterations_, transformation_epsilon_ and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ICP version: |
||
* rotation_epsilon_ and therefore overrides the default / set values of the | ||
* GICPConvergenceCriteria instance. \return Pointer to the GeneralizedIterativeClosestPoint's | ||
* GICPConvergenceCriteria. | ||
*/ | ||
inline typename pcl::registration::GICPConvergenceCriteria<double>::Ptr | ||
getConvergeCriteria() | ||
{ | ||
return convergence_criteria_; | ||
} | ||
|
||
/** \brief Provide a pointer to the input dataset | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GeneralizedIterativeClosestPoint
inherits fromIterativeClosestPoint<PointSource, PointTarget, Scalar = float>
so usefloat
here.