Skip to content

Commit

Permalink
Fix bug where EPA horizon returns zero edges due to numerical inaccur…
Browse files Browse the repository at this point in the history
…acies in float32.

PiperOrigin-RevId: 717825833
Change-Id: I9fa440816765d4c3eaa0c6c26ec0bd90c774fa01
  • Loading branch information
kbayes authored and copybara-github committed Jan 21, 2025
1 parent 2624d52 commit bd1bbfe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/engine/engine_collision_gjk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,15 @@ static Face* epa(mjCCDStatus* status, Polytope* pt, mjCCDObj* obj1, mjCCDObj* ob
h.w = w;
horizon(&h, face);

// unrecoverable numerical issue; at least one face was deleted so nedges is 3 or more
if (h.nedges < 3) {
mj_freeStack(d);
status->epa_iterations = k;
status->nx = 0;
status->dist = 0;
return NULL;
}

// insert w as new vertex and attach faces along the horizon
int wi = newVertex(pt, w1, w2), nfaces = pt->nfaces, nedges = h.nedges;

Expand Down

0 comments on commit bd1bbfe

Please sign in to comment.