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

Added option to specify translation and rotation convergence deltas in ICP and NDT algorithms. #1724

Conversation

carlosmccosta
Copy link
Contributor

Although ICP allowed to set the rotation epsilon by overriding the ConvergenceCriteria, setting the convergence metric in the Registration class allows a more uniform approach to provide a rotation and translation convergence metrics to all variants of ICP and NDT.

I also made the usage of transformation_epsilon_ and transformation_rotation_epsilon_ uniform for ICP and NDT.

In NDT i made the convergence criteria selective (if the rotation [and / or] translation parameters are not > 0, they are not used to stop the registration).

@taketwo taketwo added the needs: code review Specify why not closed/merged yet label Jun 30, 2017
@SergioRAgostinho SergioRAgostinho self-assigned this Jul 5, 2017
Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to have this granularity in terms of epsilon control so I consider this new feature useful.

I would prefer to deprecate the use of the transformation_epsilon_ accessors and expose set/getTranslationThreshold plus the set/getRotationThreshold you already added.

Opinions @taketwo and @jspricke

@taketwo
Copy link
Member

taketwo commented Jul 5, 2017

👍

Also, I wonder if we need this fallback threshold value: convergence_criteria_->setRotationThreshold (1.0 - transformation_epsilon_);.

@jspricke jspricke merged commit 971bd7c into PointCloudLibrary:master Jul 9, 2017
@taketwo
Copy link
Member

taketwo commented Jul 9, 2017

I would prefer to deprecate the use of the transformation_epsilon_ accessors and expose set/getTranslationThreshold plus the set/getRotationThreshold you already added.

I still think this is something we should do.

@jspricke
Copy link
Member

jspricke commented Jul 9, 2017

I agree.

@SergioRAgostinho
Copy link
Member

This was a very premature merge. I didn't review the thing properly :/

@jspricke
Copy link
Member

jspricke commented Jul 9, 2017

Oups sorry, must have been too early ;). For me it looked fine, as it's backward compatible for now.

@rsasaki0109
Copy link

rsasaki0109 commented Mar 12, 2020

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

First,the following line is redundant and confusing because transformation_delta.coeff (2, 2) is constant(=1) in the homogeneous transformation matrix.
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);

@kunaltyagi
Copy link
Member

Create an issue to track this. Let's continue the conversation on the issue

msmcconnell added a commit to usdot-fhwa-stol/autoware.ai that referenced this pull request Dec 14, 2021
This PR resolves usdot-fhwa-stol/carma-platform#1559 by updating the NDT optimization parameters to reflect the new PCL 1.9+ API changes.

ROS Noetic targets PCL v 1.10 whereas ROS Kinetic target PCL v 1.7.2
It seems that in v1.9 the API for the error epsilons was changed (see PointCloudLibrary/pcl#1724) Now the translation epsilon is actually a squared error and there is an additional epsilon which is the rotation angle error in an axis-angle rotation representation. This PR updates the translation error setting in NDT to therefore be 0.001 which makes the optimization selectivity closer to the old value (TODO I'm still evaluating if 0.001 or 0.0001 (which is 0.01*0.01) is better) (No longer investigating, see comment below). The rotation error is computed as 1.0-translation error which is the default used technique in the ICP matching algorithm (seems they didn't add a default for NDT matching). This may seem strange but actually makes sense as the input is cos(angle error). And arccos(0.999) =0.044 rad or 2.5 deg error.

This PR also removes the --sequential build argument from the docker image to hopefully speed up build times.


I performed some comparison runs using translation epsilons of 0.001 and 0.0001 respectively. Both gave similar over all NDT score values. The first value required fewer iterations overall and hit the max less often while the second value more often hit the max. Both ran within reasonable time frames though the second value did go above 100ms more frequently.

Since I did not see a noticeable improvement in NDT score, I plan to continue with 0.001 for now as it stayed under the 100ms execution time target more reliably. However, I have left a comment describing that 0.0001 can work as documentation of its feasibility.
if (transformation_rotation_epsilon_ > 0)
convergence_criteria_->setRotationThreshold (transformation_rotation_epsilon_);
else
convergence_criteria_->setRotationThreshold (1.0 - transformation_epsilon_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why this line uses transformation_epsilon_ which has a totally different unit than transformation_rotation_epsilon_? is this a bug or intended?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it was there before, but still wondering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: ABI break Meta-information for changelog generation module: registration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants