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

Fix ICP misbehavior in the "failure after maximum iterations" mode #2892

Merged

Conversation

WraithKim
Copy link
Contributor

@WraithKim WraithKim commented Mar 6, 2019

Executive summary:

This updates ICP and DefaultConvergenceCriteria classes to fix misbehavior in the "failure after maximum iterations" mode. (Prior to this change the registration loop would hang in an infinite loop #1598). It also refines "maximum iterations similar transforms" option to mean consequtive transforms.

If you use DefaultConvergenceCriteria in your registration code, you need to make an adjustment similar to what this PR does in "icp.hpp".


It follows #1598. I try to implement as possible as i can. But I didn't understand what taketwo said about reset similar transforms, so I implement my solution.

  • Exit loop with convergence state instead of converged_ in icp.
  • Add new convergence state CONVERGENCE_CRITERIA_FAILURE_AFTER_MAX_ ITERATIONS.
  • When failure_after_max_iter_ is set true, hasConverged() checks all similarity before returning a failure.
  • Even though one iteration has several similar conditions, counts iterations_similar_transforms_ up only 1.
  • If transform becomes large, iterations_similar_transforms_ reset to 0. Only consecutive similar iterations are allowed to converge.
  • Edit a description about the change above in API docs.
  • When new alignment restarts after a convergence or a failure, iterations_similar_transforms_ also reset to 0.

- Exit loop with convergence state instead of `converged_` in icp
- Add new convergence state `CONVERGENCE_CRITERIA_FAILURE_AFTER_MAX_
ITERATIONS`
- When `failure_after_max_iter_` is set true, `hasConverged()` checks
all similarity before returning a failure.
- Even though one iteration has several similar conditions, counts
`iterations_similar_transforms_` up only 1.
- If transform becomes large, `iterations_similar_transforms_` reset
to 0. Only consecutive similar iterations are allowed to converge.
- Edit a description about the change above in API docs.
- When new alignment restarts after a convergence or a failure,
`iterations_similar_transforms_` also reset to 0.
@taketwo taketwo added needs: code review Specify why not closed/merged yet module: registration labels Mar 7, 2019
@taketwo taketwo self-assigned this Mar 7, 2019
@SunBlack
Copy link
Contributor

SunBlack commented Mar 9, 2019

No. Just remove else case in case there is a return in the other case. This is not the case here

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

Hi, sorry for the long delay. Except to my inline comment, looks good to me.

@taketwo taketwo removed the needs: code review Specify why not closed/merged yet label Apr 3, 2019
Because there is a reset right after hasConverged() is called.
Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

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.

LGTM. @taketwo I would propose a squash with a more meaningful commit message and it's probably better for you to actually write it since I didn't follow this issue properly. 😅

Edit: Forgot to add the question. Should we tag this as a behavioural change? We are adding more statuses...

@taketwo taketwo added the changelog: behavior change Meta-information for changelog generation label Apr 9, 2019
@taketwo
Copy link
Member

taketwo commented Apr 9, 2019

Yes, this certainly qualifies for behavior change.

@taketwo taketwo merged commit ce3b18b into PointCloudLibrary:master Apr 9, 2019
@taketwo taketwo changed the title Fix broken failure_after_max_iter_ Fix ICP misbehavior in the "failure after maximum iterations" mode Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: behavior change Meta-information for changelog generation module: registration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants