Skip to content
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

Refactor multigrid_ndt_omp #32

Merged
merged 31 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ef7fd7a
Refactoring multigrid_ndt_omp
anhnv3991 Mar 7, 2024
d602c54
Refactored multigrid_ndt_omp
anhnv3991 Mar 7, 2024
3fed67d
style(pre-commit): autofix
anhnv3991 Mar 7, 2024
b5512b6
Merge branch 'tier4/main' into refactor/multigrid_ndt_omp
SakodaShintaro Mar 11, 2024
fce6546
Merge branch 'tier4/main' into refactor/multigrid_ndt_omp
anhnv3991 Mar 12, 2024
4a615a2
Merge branch 'tier4/main' into refactor/multigrid_ndt_omp
SakodaShintaro Mar 13, 2024
fed085e
Fixed to build
SakodaShintaro Mar 13, 2024
01ae242
Removed line breaks
SakodaShintaro Mar 13, 2024
81ab0e5
For reference, this should be discared later
anhnv3991 Mar 11, 2024
e75fa6b
Testing
anhnv3991 Mar 12, 2024
730dd02
Clean up a bit
anhnv3991 Mar 13, 2024
8cc59f2
Clean up a bit
anhnv3991 Mar 13, 2024
275081c
style(pre-commit): autofix
anhnv3991 Mar 13, 2024
7225f0e
refactor: organized ndt params (#43)
SakodaShintaro Mar 15, 2024
1b9c287
Speed up multigrid NDT align (#41)
anhnv3991 Mar 15, 2024
52711d0
fix: add tp to regression test (#44)
SakodaShintaro Mar 15, 2024
7850748
fix: add a param use line search (#46)
SakodaShintaro Mar 15, 2024
3993a44
Refactoring multigrid_ndt_omp
anhnv3991 Mar 7, 2024
84507ef
Refactored multigrid_ndt_omp
anhnv3991 Mar 7, 2024
571f765
style(pre-commit): autofix
anhnv3991 Mar 7, 2024
97996c2
Removed line breaks
SakodaShintaro Mar 13, 2024
f24e008
For reference, this should be discared later
anhnv3991 Mar 11, 2024
9d5c044
Testing
anhnv3991 Mar 12, 2024
e3ec8e7
Clean up a bit
anhnv3991 Mar 13, 2024
519237e
Clean up a bit
anhnv3991 Mar 13, 2024
8bb39af
Debugging
anhnv3991 Mar 18, 2024
daa3591
Fixed a bug
anhnv3991 Mar 19, 2024
b476f10
Merge branch 'tier4/main' into refactor/multigrid_ndt_omp
anhnv3991 Mar 19, 2024
f0acc00
style(pre-commit): autofix
anhnv3991 Mar 19, 2024
30693d0
Fixed build error
anhnv3991 Mar 19, 2024
07fa763
Updated result.csv
SakodaShintaro Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions include/multigrid_pclomp/multigrid_ndt_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,20 @@ class MultiGridNormalDistributionsTransform : public pcl::Registration<PointSour

inline void setMaximumIterations(int max_iterations) {
params_.max_iterations = max_iterations;
max_iterations_ = params_.max_iterations;
}

inline int getMaxIterations() const {
return params_.max_iterations;
}

inline int getMaxIterations() {
return params_.max_iterations;
}

void setParams(const NdtParams &ndt_params) {
params_ = ndt_params;
max_iterations_ = params_.max_iterations;
}

NdtParams getParams() const {
Expand Down Expand Up @@ -369,7 +376,7 @@ class MultiGridNormalDistributionsTransform : public pcl::Registration<PointSour
* \param[in] c_inv covariance of occupied covariance voxel
* \param[in] compute_hessian flag to calculate hessian, unnecessary for step calculation.
*/
double updateDerivatives(Eigen::Matrix<double, 6, 1> &score_gradient, Eigen::Matrix<double, 6, 6> &hessian, const Eigen::Matrix<float, 4, 6> &point_gradient, const Eigen::Matrix<float, 24, 6> &point_hessian, const Eigen::Vector3d &x_trans, const Eigen::Matrix3d &c_inv, bool compute_hessian = true) const;
double updateDerivatives(Eigen::Matrix<double, 6, 1> &score_gradient, Eigen::Matrix<double, 6, 6> &hessian, const Eigen::Matrix<double, 4, 6> &point_gradient, const Eigen::Matrix<double, 24, 6> &point_hessian, const Eigen::Vector3d &x_trans, const Eigen::Matrix3d &c_inv, bool compute_hessian = true) const;

/** \brief Precompute angular components of derivatives.
* \note Equation 6.19 and 6.21 [Magnusson 2009].
Expand All @@ -383,9 +390,7 @@ class MultiGridNormalDistributionsTransform : public pcl::Registration<PointSour
* \param[in] x point from the input cloud
* \param[in] compute_hessian flag to calculate hessian, unnecessary for step calculation.
*/
void computePointDerivatives(Eigen::Vector3d &x, Eigen::Matrix<double, 3, 6> &point_gradient, Eigen::Matrix<double, 18, 6> &point_hessian, bool compute_hessian = true) const;

void computePointDerivatives(Eigen::Vector3d &x, Eigen::Matrix<float, 4, 6> &point_gradient, Eigen::Matrix<float, 24, 6> &point_hessian, bool compute_hessian = true) const;
SakodaShintaro marked this conversation as resolved.
Show resolved Hide resolved
void computePointDerivatives(Eigen::Vector3d &x, Eigen::Matrix<double, 4, 6> &point_gradient, Eigen::Matrix<double, 24, 6> &point_hessian, bool compute_hessian = true) const;

/** \brief Compute hessian of probability function w.r.t. the transformation vector.
* \note Equation 6.13 [Magnusson 2009].
Expand All @@ -401,7 +406,7 @@ class MultiGridNormalDistributionsTransform : public pcl::Registration<PointSour
* \param[in] x_trans transformed point minus mean of occupied covariance voxel
* \param[in] c_inv covariance of occupied covariance voxel
*/
void updateHessian(Eigen::Matrix<double, 6, 6> &hessian, const Eigen::Matrix<double, 3, 6> &point_gradient, const Eigen::Matrix<double, 18, 6> &point_hessian, const Eigen::Vector3d &x_trans, const Eigen::Matrix3d &c_inv) const;
void updateHessian(Eigen::Matrix<double, 6, 6> &hessian, const Eigen::Matrix<double, 4, 6> &point_gradient, const Eigen::Matrix<double, 24, 6> &point_hessian, const Eigen::Vector3d &x_trans, const Eigen::Matrix3d &c_inv) const;

/** \brief Compute line search step length and update transform and probability derivatives using More-Thuente method.
* \note Search Algorithm [More, Thuente 1994]
Expand Down Expand Up @@ -494,17 +499,13 @@ class MultiGridNormalDistributionsTransform : public pcl::Registration<PointSour
*
* The precomputed angular derivatives for the jacobian of a transformation vector, Equation 6.19 [Magnusson 2009].
*/
Eigen::Vector3d j_ang_a_, j_ang_b_, j_ang_c_, j_ang_d_, j_ang_e_, j_ang_f_, j_ang_g_, j_ang_h_;

Eigen::Matrix<float, 8, 4> j_ang;
Eigen::Matrix<double, 8, 4> j_ang_;

/** \brief Precomputed Angular Hessian
*
* The precomputed angular derivatives for the hessian of a transformation vector, Equation 6.19 [Magnusson 2009].
*/
Eigen::Vector3d h_ang_a2_, h_ang_a3_, h_ang_b2_, h_ang_b3_, h_ang_c2_, h_ang_c3_, h_ang_d1_, h_ang_d2_, h_ang_d3_, h_ang_e1_, h_ang_e2_, h_ang_e3_, h_ang_f1_, h_ang_f2_, h_ang_f3_;

Eigen::Matrix<float, 16, 4> h_ang;
Eigen::Matrix<double, 16, 4> h_ang_;

Eigen::Matrix<double, 6, 6> hessian_;
std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>> transformation_array_;
Expand Down
Loading
Loading