TransformationCheckersImpl.h
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #ifndef __POINTMATCHER_TRANSFORMATIONCHECKERS_H
37 #define __POINTMATCHER_TRANSFORMATIONCHECKERS_H
38 
39 #include "PointMatcher.h"
40 
41 template<typename T>
43 {
49 
52  typedef typename PointMatcher<T>::Vector Vector;
56  typedef typename PointMatcher<T>::Matrix Matrix;
57 
58  struct CounterTransformationChecker: public TransformationChecker
59  {
62 
63  inline static const std::string description()
64  {
65  return "This checker stops the ICP loop after a certain number of iterations.";
66  }
67  inline static const ParametersDoc availableParameters()
68  {
69  return {
70  {"maxIterationCount", "maximum number of iterations ", "40", "0", "2147483647", &P::Comp<unsigned>}
71  };
72  }
73 
74  const unsigned maxIterationCount;
75 
76  CounterTransformationChecker(const Parameters& params = Parameters());
77  virtual void init(const TransformationParameters& parameters, bool& iterate);
78  virtual void check(const TransformationParameters& parameters, bool& iterate);
79  };
80 
81  struct DifferentialTransformationChecker: public TransformationChecker
82  {
83  inline static const std::string description()
84  {
85  return "This checker stops the ICP loop when the relative motions (i.e. abs(currentIter - lastIter)) of rotation and translation components are below a fix thresholds. This allows to stop the iteration when the point cloud is stabilized. Smoothing can be applied to avoid oscillations. Inspired by \\cite{Chetverikov2002Trimmed}.";
86  }
87  inline static const ParametersDoc availableParameters()
88  {
89  return {
90  {"minDiffRotErr", "threshold for rotation error (radian)", "0.001", "0.", "6.2831854", &P::Comp<T>},
91  {"minDiffTransErr", "threshold for translation error", "0.001", "0.", "inf", &P::Comp<T>},
92  {"smoothLength", "number of iterations over which to average the differencial error", "3", "0", "2147483647", &P::Comp<unsigned>}
93  };
94  }
95 
98  const unsigned int smoothLength;
99 
100  protected:
101  QuaternionVector rotations;
102  VectorVector translations;
103 
104  public:
105  DifferentialTransformationChecker(const Parameters& params = Parameters());
106 
107  virtual void init(const TransformationParameters& parameters, bool& iterate);
108  virtual void check(const TransformationParameters& parameters, bool& iterate);
109  };
110 
111  struct BoundTransformationChecker: public TransformationChecker
112  {
113  inline static const std::string description()
114  {
115  return "This checker stops the ICP loop with an exception when the transformation values exceed bounds.";
116  }
117  inline static const ParametersDoc availableParameters()
118  {
119  return {
120  {"maxRotationNorm", "rotation bound", "1", "0", "inf", &P::Comp < T > },
121  {"maxTranslationNorm", "translation bound", "1", "0", "inf", &P::Comp < T > }
122  };
123  }
124 
127 
128  protected:
129  Quaternion initialRotation3D;
132 
133  public:
134  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
135  BoundTransformationChecker(const Parameters& params = Parameters());
136  virtual void init(const TransformationParameters& parameters, bool& iterate);
137  virtual void check(const TransformationParameters& parameters, bool& iterate);
138  };
139 }; // TransformationCheckersImpl
140 
141 #endif // __POINTMATCHER_TRANSFORMATIONCHECKERS_H
std::vector< Vector, Eigen::aligned_allocator< Vector > > VectorVector
A vector of vector over ScalarType, not a matrix.
Definition: PointMatcher.h:163
public interface
virtual void check(const TransformationParameters &parameters, bool &iterate)
Set iterate to false if iteration should stop.
Eigen::Quaternion< T > Quaternion
A quaternion over ScalarType.
Definition: PointMatcher.h:165
::std::string string
Definition: gtest.h:1979
PointMatcher< T >::TransformationChecker TransformationChecker
Struct used to inform through an exeption that ICP reached max number of iterations.
PointMatcher< T >::TransformationParameters TransformationParameters
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dense matrix over ScalarType.
Definition: PointMatcher.h:169
PointMatcher< T >::Vector Vector
Parametrizable::ParameterDoc ParameterDoc
std::map< std::string, Parameter > Parameters
Parameters stored as a map of string->string.
PointMatcher< T >::Matrix Matrix
PointMatcherSupport::Parametrizable Parametrizable
Parametrizable::Parameters Parameters
std::vector< Quaternion, Eigen::aligned_allocator< Quaternion > > QuaternionVector
A vector of quaternions over ScalarType.
Definition: PointMatcher.h:167
Parameters parameters
parameters with their values encoded in string
The documentation of a parameter.
The superclass of classes that are constructed using generic parameters. This class provides the para...
std::vector< ParameterDoc > ParametersDoc
The documentation of all parameters.
PointMatcher< T >::QuaternionVector QuaternionVector
A transformation checker can stop the iteration depending on some conditions.
Definition: PointMatcher.h:583
virtual void init(const TransformationParameters &parameters, bool &iterate)
Init, set iterate to false if iteration should stop.
PointMatcher< T >::VectorVector VectorVector
PointMatcher< T >::Quaternion Quaternion
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector over ScalarType.
Definition: PointMatcher.h:161
PointMatcherSupport::Parametrizable P
Parametrizable::ParametersDoc ParametersDoc
Matrix TransformationParameters
A matrix holding the parameters a transformation.
Definition: PointMatcher.h:182


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03