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

[Registration] NDT implementation flaws #3734

Closed
kunaltyagi opened this issue Mar 12, 2020 · 5 comments
Closed

[Registration] NDT implementation flaws #3734

kunaltyagi opened this issue Mar 12, 2020 · 5 comments
Labels
kind: bug Type of issue module: registration needs: author reply Specify why not closed/merged yet

Comments

@kunaltyagi
Copy link
Member

Hey, this merged PR is not good.
I noticed this problem because ndt didn't work well in the latest version.

First,the following line is redundant and confusing.
https://github.com/PointCloudLibrary/pcl/blob/master/registration/include/pcl/registration/impl/ndt_2d.hpp#L478

double cos_angle = 0.5 * (transformation_delta.coeff (0, 0) + transformation_delta.coeff (1, 1) + transformation_delta.coeff (2, 2) - 1);

the following code is enough.

double cos_angle = 0.5 * (transformation_delta.coeff (0, 0) + transformation_delta.coeff (1, 1));

or

double cos_angle = transformation_delta.coeff (0, 0);

Secondly, it is wrong to use cos_angle in 3d like as 2d.

https://github.com/PointCloudLibrary/pcl/blob/master/registration/include/pcl/registration/impl/ndt.hpp#L153

double cos_angle = 0.5 * (transformation_.coeff (0, 0) + transformation_.coeff (1, 1) + transformation_.coeff (2, 2) - 1);

Originally posted by @rsasaki0109 in #1724 (comment)

@kunaltyagi kunaltyagi added kind: bug Type of issue module: registration needs: author reply Specify why not closed/merged yet labels Mar 12, 2020
@kunaltyagi
Copy link
Member Author

@rsasaki0109 Could you please give some examples to show the flaws in the existing implementation?

If possible, would you like to create a PR?

@rsasaki0109
Copy link

rsasaki0109 commented Mar 12, 2020

It is a mathematical problem.
The homogeneous transformation matrix H(x,y,θ) in 2d is as below.
ndt1

So, using the change of cos_ang in ndt_2d.hpp is correct for the convergence judgment of scan-matching algorithms(but redundant) because cos_ang is

ndt2

But in 3d, H(p) is,using the Euler sequence z-y-x,

ndt3

where ci = cosφi and si = sinφi.
(reference:page 63 of a thesis about ndt in reserchgate)

So, cos_ang in ndt.hpp is nonsense because it is

ndt4

@kunaltyagi
Copy link
Member Author

kunaltyagi commented Mar 12, 2020

It make sense. Thanks for the explanation.

Would you mind creating a PR? It might take lesser effort for you 😄

@rsasaki0109
Copy link

rsasaki0109 commented Mar 12, 2020

I'm sorry, I misunderstood.

Any rotation matrix R(θ) in three-dimensional space can be represented by a rotation axis r and a rotation angle θ.
And trace{R(θ)} is 2cosθ + 1.
In the convergence judgment of scan-matching algorithms, this theta is considered.

I think that there is an another cause that ndt-scanmatching don't work well in my environment.
I will let you know the details once I find out.

@kunaltyagi
Copy link
Member Author

another cause that ndt-scanmatching don't work well in my environment

Sure. Please share your findings with us once you debug it, even if the issue wasn't in PCL 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue module: registration needs: author reply Specify why not closed/merged yet
Projects
None yet
Development

No branches or pull requests

2 participants