-
-
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
Refactoring and Bugfix of NDT #4180
Conversation
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.
Adding notes of the notable non-variable-name-change
@@ -440,21 +438,16 @@ namespace pcl | |||
* | |||
* 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<double, 8, 4> angular_jacobian_; |
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.
Note: 3D vectors changed to 4D vectors. ABI breakage here
Should we separate the bug fix (the |
I agree. It would be nice to merge the bug fix first because it brings significant accuracy improment. Should I open another PR for the bugfix? |
Refactoring and Bugfix of NDT PointCloudLibrary/pcl#4180
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.
Thank you for the clean-up.
Edit: looks like we need a rebase though
I rabased and there should not be conflicts now. |
Sorry, it seems the commit was contaminated with a wrong branch. I'll revert it. |
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.
Welp. I reviewed some before looking at what I was reviewing 👀. You can use this in the other PR though 😆
09863c3
to
88c5b89
Compare
Sorry, I did something wrong and did reset the branch. I'm sorry if it increases the reviewing effort... |
Is this ready for review? |
Yes, it's ready. |
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.
Based on what you've said, you performed some benchmarking? Could you please share those results?
I found a bug in computeDerivatives() that was injected during the refactoring. I fixed it, and now the registration result is consistent with the NDT in master branch. |
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.
Looks good otherwise. After these and CI passes, rebase and merge as needed. My bandwidth is a bit low nowadays
In computeHessian(), I found a bug same as the one in computeDerivatives(). After fixing it, I confirmed that the score, jacobian, and hessian each iteration step are exactly the same as before refactoring. |
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.
Just a few more places where we can put const in
I replaced duplicated transformation vector-matrix conversion codes with |
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.
Thanks for the update with const
Needs conflict resolution and green CI, but a go from my side |
I did rebase and squash to resolve the conflict |
Work on ABI breaks can now commence |
@kunaltyagi
Sorry for being late to open this PR. I refactored the NDT code according to #4135 and took a look at the suspicious code mentioned at #3832.
Refactoring #4135 (review)
ndt.cpp
updateIntervalMT
andtrialValueSelectionMT
as they are because these methods have different in/out argument combinations, and putting them in a struct would hide this informationh_ang_*
are concatenated into one matrix for simplicity and Eigen's SSE optimization (it brings about 1% speedup)point_gradient
is renamed topoint_jacobian
p
is renamed totransform
All the above modifications don't change the behavior of NDT, and the registration result will be exactly the same as before refactoring.
Bugfix #3832 (comment)
(step_max - step_min) > 0
must be(step_max - step_min) < 0
because this code is intended to check the validity of the range. As @atom2003 pointed out,(step_max - step_min) > 0
is always true, and this prevents the step length calculation being performed. This bug affects the registration accuracy in particular when we set a smalltransformation_epsilon
for fine registration.After resolving this bug, the fitness score of the registration result of the unit test (
test_ndt.cpp
) is slightly improved (before: 5.05433e-05, after: 4.68033e-05).I also confirmed the accuracy improvement on my own dataset. The following figures show sensor trajectories estimated by frame-by-frame NDT registration, and the one before the bugfix has a large drift.
After Bugfix
Before Bugfix