47 m_modelCloud(model), m_dataCloud(data)
62 return Matrix4d::Identity();
65 auto start_time = chrono::steady_clock::now();
67 double ret = 0.0, prev_ret = 0.0, prev_prev_ret = 0.0;
71 Vector3d centroid_m = Vector3d::Zero();
72 Vector3d centroid_d = Vector3d::Zero();
83 prev_prev_ret = prev_ret;
90 transform = Transformd::Identity();
99 cout <<
timestamp <<
"ICP Error is " << ret <<
" in iteration " << iteration <<
" / " << m_maxIterations <<
" using " << pairs <<
" points." << endl;
111 auto duration = chrono::steady_clock::now() - start_time;
112 cout << setw(6) << (int)(duration.count() / 1e6) <<
" ms, ";
113 cout <<
"Error: " << fixed << setprecision(3) << setw(7) << ret;
114 if (iteration < m_maxIterations)
116 cout <<
" after " << iteration <<
" Iterations";
121 cout <<
"Result: " << endl <<
m_dataCloud->deltaPose() << endl;
void setMaxMatchDistance(double distance)
void setMaxLeafSize(int maxLeafSize)
static size_t nearestNeighbors(KDTreePtr tree, SLAMScanPtr scan, Neighbor *neighbors, double maxDistance, Vector3d ¢roid_m, Vector3d ¢roid_d)
Finds the nearest neighbors of all points in a Scan using a pre-generated KDTree. ...
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Eigen::Vector3d Vector3d
Eigen 3D vector, double precision.
Transform< double > Transformd
4x4 double precision transformation matrix
static std::shared_ptr< KDTree > create(SLAMScanPtr scan, int maxLeafSize=20)
Creates a new KDTree from the given Scan.
double getEpsilon() const
int getMaxLeafSize() const
void setEpsilon(double epsilon)
double getMaxMatchDistance() const
std::shared_ptr< SLAMScanWrapper > SLAMScanPtr
Transformd match()
Executes the ICPAlign.
void setVerbose(bool verbose)
double m_maxDistanceMatch
T alignPoints(SLAMScanPtr scan, Point3 **neighbors, const Vec3 ¢roid_m, const Vec3 ¢roid_d, Mat4 &align) const
Calculates the estimated Transformation to match a Data Pointcloud to a Model Pointcloud.
void setMaxIterations(int iterations)
PointBufferPtr transform(PointBufferPtr pc_in, const Transformd &T)
int getMaxIterations() const