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

EPA convergence failure on capsules #205

Closed
sebcrozet opened this issue Apr 28, 2024 · 2 comments · Fixed by #245
Closed

EPA convergence failure on capsules #205

sebcrozet opened this issue Apr 28, 2024 · 2 comments · Fixed by #245
Labels
bug Something isn't working

Comments

@sebcrozet
Copy link
Member

See the following PR for a code to reproduce the bug: dimforge/rapier#531

@sebcrozet sebcrozet added the bug Something isn't working label Apr 28, 2024
@Vrixyz Vrixyz transferred this issue from dimforge/rapier May 31, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Jul 27, 2024

The gjk returns intersection, and then epa2 starts.
Adding some logs, it seems it never converges:

Iteration 1: curr_dist = 7.9495697, candidate_max_dist = 11.553711 max_dist = 11.553711, support_point_id = 3
Iteration 2: curr_dist = 8.539658, candidate_max_dist = 9.600317 max_dist = 9.600317, support_point_id = 4
Iteration 3: curr_dist = 9.436261, candidate_max_dist = 9.436432 max_dist = 9.436432, support_point_id = 5
Iteration 4: curr_dist = 9.436262, candidate_max_dist = 9.436306 max_dist = 9.436306, support_point_id = 6
Iteration 5: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 7
Iteration 6: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 8
Iteration 7: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 9
Iteration 8: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 10
Iteration 9: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 11
Iteration 10: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 12
Iteration 11: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 13
Iteration 12: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 14
Iteration 13: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 15
Iteration 14: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 16
Iteration 15: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 17
Iteration 16: curr_dist = 9.436289, candidate_max_dist = 9.43631 max_dist = 9.436306, support_point_id = 18

The problem could be related to the epa value and what it expects the improvement to be. Aside for the check:

if max_dist - curr_dist < _eps_tol {
...
}

There coudl be another check to see if any of the values changed, if not the algorithm is probably stuck and we should accept the intersection.

The difference in this case is:
0.00001715999

While eps is:
0.000011920929

The problem occurs either because:

  • as points are further away from center or bigger, the result doesn't converge with same accuracy
  • as the shapes are bigger, the result also doesn't converge with same accuracy.

Another idea is to use either EPS based on values. Eg. check that the difference between the two is a percentage of total distance.
Another idea would be to increment the EPS based on iteration count, so we don't arrive at a very big iteration index(even if the result would be much more precise, we don't always want that if it takes a lot of iterations)

@Ughuuu
Copy link
Contributor

Ughuuu commented Jul 27, 2024

Related to this(this is 3d related issue) #157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants