Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
pcl::registration::DefaultConvergenceCriteria< Scalar > Class Template Reference

DefaultConvergenceCriteria represents an instantiation of ConvergenceCriteria, and implements the following criteria for registration loop evaluation: More...

#include <pcl/registration/default_convergence_criteria.h>

+ Inheritance diagram for pcl::registration::DefaultConvergenceCriteria< Scalar >:
+ Collaboration diagram for pcl::registration::DefaultConvergenceCriteria< Scalar >:

Public Types

enum  ConvergenceState {
  CONVERGENCE_CRITERIA_NOT_CONVERGED , CONVERGENCE_CRITERIA_ITERATIONS , CONVERGENCE_CRITERIA_TRANSFORM , CONVERGENCE_CRITERIA_ABS_MSE ,
  CONVERGENCE_CRITERIA_REL_MSE , CONVERGENCE_CRITERIA_NO_CORRESPONDENCES , CONVERGENCE_CRITERIA_FAILURE_AFTER_MAX_ITERATIONS
}
 
using Ptr = shared_ptr< DefaultConvergenceCriteria< Scalar > >
 
using ConstPtr = shared_ptr< const DefaultConvergenceCriteria< Scalar > >
 
using Matrix4 = Eigen::Matrix< Scalar, 4, 4 >
 
- Public Types inherited from pcl::registration::ConvergenceCriteria
using Ptr = shared_ptr< ConvergenceCriteria >
 
using ConstPtr = shared_ptr< const ConvergenceCriteria >
 

Public Member Functions

 DefaultConvergenceCriteria (const int &iterations, const Matrix4 &transform, const pcl::Correspondences &correspondences)
 Empty constructor. More...
 
 ~DefaultConvergenceCriteria () override=default
 Empty destructor. More...
 
void setMaximumIterationsSimilarTransforms (const int nr_iterations)
 Set the maximum number of consecutive iterations that the internal rotation, translation, and MSE differences are allowed to be similar. More...
 
int getMaximumIterationsSimilarTransforms () const
 Get the maximum number of consecutive iterations that the internal rotation, translation, and MSE differences are allowed to be similar, as set by the user. More...
 
void setMaximumIterations (const int nr_iterations)
 Set the maximum number of iterations the internal optimization should run for. More...
 
int getMaximumIterations () const
 Get the maximum number of iterations the internal optimization should run for, as set by the user. More...
 
void setFailureAfterMaximumIterations (const bool failure_after_max_iter)
 Specifies if the registration fails or converges when the maximum number of iterations is reached. More...
 
bool getFailureAfterMaximumIterations () const
 Get whether the registration will fail or converge when the maximum number of iterations is reached. More...
 
void setRotationThreshold (const double threshold)
 Set the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) in order for an optimization to be considered as having converged to the final solution. More...
 
double getRotationThreshold () const
 Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) as set by the user. More...
 
void setTranslationThreshold (const double threshold)
 Set the translation threshold (maximum allowable difference between two consecutive transformations) in order for an optimization to be considered as having converged to the final solution. More...
 
double getTranslationThreshold () const
 Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) as set by the user. More...
 
void setRelativeMSE (const double mse_relative)
 Set the relative MSE between two consecutive sets of correspondences. More...
 
double getRelativeMSE () const
 Get the relative MSE between two consecutive sets of correspondences. More...
 
void setAbsoluteMSE (const double mse_absolute)
 Set the absolute MSE between two consecutive sets of correspondences. More...
 
double getAbsoluteMSE () const
 Get the absolute MSE between two consecutive sets of correspondences. More...
 
bool hasConverged () override
 Check if convergence has been reached. More...
 
ConvergenceState getConvergenceState ()
 Return the convergence state after hasConverged () More...
 
void setConvergenceState (ConvergenceState c)
 Sets the convergence state externally (for example, when ICP does not find enough correspondences to estimate a transformation, the function is called setting the convergence state to ConvergenceState::CONVERGENCE_CRITERIA_NO_CORRESPONDENCES) More...
 
- Public Member Functions inherited from pcl::registration::ConvergenceCriteria
 ConvergenceCriteria ()=default
 Empty constructor. More...
 
virtual ~ConvergenceCriteria ()=default
 Empty destructor. More...
 
 operator bool ()
 Bool operator. More...
 

Protected Member Functions

double calculateMSE (const pcl::Correspondences &correspondences) const
 Calculate the mean squared error (MSE) of the distance for a given set of correspondences. More...
 

Protected Attributes

const int & iterations_
 The number of iterations done by the registration loop so far. More...
 
const Matrix4transformation_
 The current transformation obtained by the transformation estimation method. More...
 
const pcl::Correspondencescorrespondences_
 The current set of point correspondences between the source and the target. More...
 
double correspondences_prev_mse_ {std::numeric_limits<double>::max()}
 The MSE for the previous set of correspondences. More...
 
double correspondences_cur_mse_ {std::numeric_limits<double>::max()}
 The MSE for the current set of correspondences. More...
 
int max_iterations_ {100}
 The maximum nuyyGmber of iterations that the registration loop is to be executed. More...
 
bool failure_after_max_iter_ {false}
 Specifys if the registration fails or converges when the maximum number of iterations is reached. More...
 
double rotation_threshold_ {0.99999}
 The rotation threshold is the relative rotation between two iterations (as angle cosine). More...
 
double translation_threshold_ {3e-4 * 3e-4}
 The translation threshold is the relative translation between two iterations (0 if no translation). More...
 
double mse_threshold_relative_ {0.00001}
 The relative change from the previous MSE for the current set of correspondences, e.g. More...
 
double mse_threshold_absolute_ {1e-12}
 The absolute change from the previous MSE for the current set of correspondences. More...
 
int iterations_similar_transforms_ {0}
 Internal counter for the number of iterations that the internal rotation, translation, and MSE differences are allowed to be similar. More...
 
int max_iterations_similar_transforms_ {0}
 The maximum number of iterations that the internal rotation, translation, and MSE differences are allowed to be similar. More...
 
ConvergenceState convergence_state_ {CONVERGENCE_CRITERIA_NOT_CONVERGED}
 The state of the convergence (e.g., why did the registration converge). More...
 

Detailed Description

template<typename Scalar = float>
class pcl::registration::DefaultConvergenceCriteria< Scalar >

DefaultConvergenceCriteria represents an instantiation of ConvergenceCriteria, and implements the following criteria for registration loop evaluation:

Note
Convergence is considered reached if ANY of the above criteria are met.
Author
Radu B. Rusu

Definition at line 65 of file default_convergence_criteria.h.

Member Typedef Documentation

◆ ConstPtr

template<typename Scalar = float>
using pcl::registration::DefaultConvergenceCriteria< Scalar >::ConstPtr = shared_ptr<const DefaultConvergenceCriteria<Scalar> >

Definition at line 68 of file default_convergence_criteria.h.

◆ Matrix4

template<typename Scalar = float>
using pcl::registration::DefaultConvergenceCriteria< Scalar >::Matrix4 = Eigen::Matrix<Scalar, 4, 4>

Definition at line 70 of file default_convergence_criteria.h.

◆ Ptr

template<typename Scalar = float>
using pcl::registration::DefaultConvergenceCriteria< Scalar >::Ptr = shared_ptr<DefaultConvergenceCriteria<Scalar> >

Definition at line 67 of file default_convergence_criteria.h.

Member Enumeration Documentation

◆ ConvergenceState

Enumerator
CONVERGENCE_CRITERIA_NOT_CONVERGED 
CONVERGENCE_CRITERIA_ITERATIONS 
CONVERGENCE_CRITERIA_TRANSFORM 
CONVERGENCE_CRITERIA_ABS_MSE 
CONVERGENCE_CRITERIA_REL_MSE 
CONVERGENCE_CRITERIA_NO_CORRESPONDENCES 
CONVERGENCE_CRITERIA_FAILURE_AFTER_MAX_ITERATIONS 

Definition at line 72 of file default_convergence_criteria.h.

Constructor & Destructor Documentation

◆ DefaultConvergenceCriteria()

template<typename Scalar = float>
pcl::registration::DefaultConvergenceCriteria< Scalar >::DefaultConvergenceCriteria ( const int &  iterations,
const Matrix4 transform,
const pcl::Correspondences correspondences 
)
inline

Empty constructor.

Sets:

  • the maximum number of iterations to 100
  • the rotation threshold to 0.256 degrees (0.99999)
  • the translation threshold to 0.0003 meters (3e-4^2)
  • the MSE relative / absolute thresholds to 0.001% and 1e-12
Parameters
[in]iterationsa reference to the number of iterations the loop has ran so far
[in]transforma reference to the current transformation obtained by the transformation evaluation
[in]correspondencesa reference to the current set of point correspondences between source and target

Definition at line 94 of file default_convergence_criteria.h.

◆ ~DefaultConvergenceCriteria()

template<typename Scalar = float>
pcl::registration::DefaultConvergenceCriteria< Scalar >::~DefaultConvergenceCriteria ( )
overridedefault

Empty destructor.

Member Function Documentation

◆ calculateMSE()

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::calculateMSE ( const pcl::Correspondences correspondences) const
inlineprotected

Calculate the mean squared error (MSE) of the distance for a given set of correspondences.

Parameters
[in]correspondencesthe given set of correspondences

Definition at line 262 of file default_convergence_criteria.h.

◆ getAbsoluteMSE()

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::getAbsoluteMSE ( ) const
inline

Get the absolute MSE between two consecutive sets of correspondences.

Definition at line 230 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_absolute_.

◆ getConvergenceState()

template<typename Scalar = float>
ConvergenceState pcl::registration::DefaultConvergenceCriteria< Scalar >::getConvergenceState ( )
inline

Return the convergence state after hasConverged ()

Definition at line 241 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::convergence_state_.

◆ getFailureAfterMaximumIterations()

template<typename Scalar = float>
bool pcl::registration::DefaultConvergenceCriteria< Scalar >::getFailureAfterMaximumIterations ( ) const
inline

Get whether the registration will fail or converge when the maximum number of iterations is reached.

Definition at line 156 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::failure_after_max_iter_.

◆ getMaximumIterations()

template<typename Scalar = float>
int pcl::registration::DefaultConvergenceCriteria< Scalar >::getMaximumIterations ( ) const
inline

Get the maximum number of iterations the internal optimization should run for, as set by the user.

Definition at line 138 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_.

◆ getMaximumIterationsSimilarTransforms()

template<typename Scalar = float>
int pcl::registration::DefaultConvergenceCriteria< Scalar >::getMaximumIterationsSimilarTransforms ( ) const
inline

Get the maximum number of consecutive iterations that the internal rotation, translation, and MSE differences are allowed to be similar, as set by the user.

Definition at line 120 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_similar_transforms_.

◆ getRelativeMSE()

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::getRelativeMSE ( ) const
inline

Get the relative MSE between two consecutive sets of correspondences.

Definition at line 214 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_relative_.

◆ getRotationThreshold()

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::getRotationThreshold ( ) const
inline

Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) as set by the user.

Definition at line 177 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::rotation_threshold_.

◆ getTranslationThreshold()

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::getTranslationThreshold ( ) const
inline

Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) as set by the user.

Definition at line 198 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::translation_threshold_.

◆ hasConverged()

template<typename Scalar >
bool pcl::registration::DefaultConvergenceCriteria< Scalar >::hasConverged
overridevirtual

Check if convergence has been reached.

Implements pcl::registration::ConvergenceCriteria.

Definition at line 51 of file default_convergence_criteria.hpp.

◆ setAbsoluteMSE()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setAbsoluteMSE ( const double  mse_absolute)
inline

Set the absolute MSE between two consecutive sets of correspondences.

Parameters
[in]mse_absolutethe relative MSE threshold

Definition at line 223 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_absolute_.

◆ setConvergenceState()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setConvergenceState ( ConvergenceState  c)
inline

Sets the convergence state externally (for example, when ICP does not find enough correspondences to estimate a transformation, the function is called setting the convergence state to ConvergenceState::CONVERGENCE_CRITERIA_NO_CORRESPONDENCES)

Parameters
[in]cthe convergence state

Definition at line 252 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::convergence_state_.

◆ setFailureAfterMaximumIterations()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setFailureAfterMaximumIterations ( const bool  failure_after_max_iter)
inline

Specifies if the registration fails or converges when the maximum number of iterations is reached.

Parameters
[in]failure_after_max_iterIf true, the registration fails. If false, the registration is assumed to have converged.

Definition at line 148 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::failure_after_max_iter_.

◆ setMaximumIterations()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setMaximumIterations ( const int  nr_iterations)
inline

Set the maximum number of iterations the internal optimization should run for.

Parameters
[in]nr_iterationsthe maximum number of iterations the internal optimization should run for

Definition at line 130 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_.

◆ setMaximumIterationsSimilarTransforms()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setMaximumIterationsSimilarTransforms ( const int  nr_iterations)
inline

Set the maximum number of consecutive iterations that the internal rotation, translation, and MSE differences are allowed to be similar.

Parameters
[in]nr_iterationsthe maximum number of iterations

Definition at line 110 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_similar_transforms_.

◆ setRelativeMSE()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setRelativeMSE ( const double  mse_relative)
inline

Set the relative MSE between two consecutive sets of correspondences.

Parameters
[in]mse_relativethe relative MSE threshold

Definition at line 207 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_relative_.

◆ setRotationThreshold()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setRotationThreshold ( const double  threshold)
inline

Set the rotation threshold cosine angle (maximum allowable difference between two consecutive transformations) in order for an optimization to be considered as having converged to the final solution.

Parameters
[in]thresholdthe rotation threshold in order for an optimization to be considered as having converged to the final solution.

Definition at line 168 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::rotation_threshold_.

◆ setTranslationThreshold()

template<typename Scalar = float>
void pcl::registration::DefaultConvergenceCriteria< Scalar >::setTranslationThreshold ( const double  threshold)
inline

Set the translation threshold (maximum allowable difference between two consecutive transformations) in order for an optimization to be considered as having converged to the final solution.

Parameters
[in]thresholdthe translation threshold in order for an optimization to be considered as having converged to the final solution.

Definition at line 189 of file default_convergence_criteria.h.

References pcl::registration::DefaultConvergenceCriteria< Scalar >::translation_threshold_.

Member Data Documentation

◆ convergence_state_

template<typename Scalar = float>
ConvergenceState pcl::registration::DefaultConvergenceCriteria< Scalar >::convergence_state_ {CONVERGENCE_CRITERIA_NOT_CONVERGED}
protected

◆ correspondences_

template<typename Scalar = float>
const pcl::Correspondences& pcl::registration::DefaultConvergenceCriteria< Scalar >::correspondences_
protected

The current set of point correspondences between the source and the target.

Definition at line 280 of file default_convergence_criteria.h.

◆ correspondences_cur_mse_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::correspondences_cur_mse_ {std::numeric_limits<double>::max()}
protected

The MSE for the current set of correspondences.

Definition at line 286 of file default_convergence_criteria.h.

◆ correspondences_prev_mse_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::correspondences_prev_mse_ {std::numeric_limits<double>::max()}
protected

The MSE for the previous set of correspondences.

Definition at line 283 of file default_convergence_criteria.h.

◆ failure_after_max_iter_

template<typename Scalar = float>
bool pcl::registration::DefaultConvergenceCriteria< Scalar >::failure_after_max_iter_ {false}
protected

Specifys if the registration fails or converges when the maximum number of iterations is reached.

Definition at line 294 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getFailureAfterMaximumIterations(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setFailureAfterMaximumIterations().

◆ iterations_

template<typename Scalar = float>
const int& pcl::registration::DefaultConvergenceCriteria< Scalar >::iterations_
protected

The number of iterations done by the registration loop so far.

Definition at line 272 of file default_convergence_criteria.h.

◆ iterations_similar_transforms_

template<typename Scalar = float>
int pcl::registration::DefaultConvergenceCriteria< Scalar >::iterations_similar_transforms_ {0}
protected

Internal counter for the number of iterations that the internal rotation, translation, and MSE differences are allowed to be similar.

Definition at line 314 of file default_convergence_criteria.h.

◆ max_iterations_

template<typename Scalar = float>
int pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_ {100}
protected

The maximum nuyyGmber of iterations that the registration loop is to be executed.

Definition at line 290 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getMaximumIterations(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setMaximumIterations().

◆ max_iterations_similar_transforms_

template<typename Scalar = float>
int pcl::registration::DefaultConvergenceCriteria< Scalar >::max_iterations_similar_transforms_ {0}
protected

The maximum number of iterations that the internal rotation, translation, and MSE differences are allowed to be similar.

Definition at line 318 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getMaximumIterationsSimilarTransforms(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setMaximumIterationsSimilarTransforms().

◆ mse_threshold_absolute_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_absolute_ {1e-12}
protected

The absolute change from the previous MSE for the current set of correspondences.

Definition at line 310 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getAbsoluteMSE(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setAbsoluteMSE().

◆ mse_threshold_relative_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::mse_threshold_relative_ {0.00001}
protected

The relative change from the previous MSE for the current set of correspondences, e.g.

.1 means 10% change.

Definition at line 306 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getRelativeMSE(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setRelativeMSE().

◆ rotation_threshold_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::rotation_threshold_ {0.99999}
protected

The rotation threshold is the relative rotation between two iterations (as angle cosine).

Definition at line 298 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getRotationThreshold(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setRotationThreshold().

◆ transformation_

template<typename Scalar = float>
const Matrix4& pcl::registration::DefaultConvergenceCriteria< Scalar >::transformation_
protected

The current transformation obtained by the transformation estimation method.

Definition at line 276 of file default_convergence_criteria.h.

◆ translation_threshold_

template<typename Scalar = float>
double pcl::registration::DefaultConvergenceCriteria< Scalar >::translation_threshold_ {3e-4 * 3e-4}
protected

The translation threshold is the relative translation between two iterations (0 if no translation).

Definition at line 302 of file default_convergence_criteria.h.

Referenced by pcl::registration::DefaultConvergenceCriteria< Scalar >::getTranslationThreshold(), and pcl::registration::DefaultConvergenceCriteria< Scalar >::setTranslationThreshold().


The documentation for this class was generated from the following files: