Circumvent bug in mjc_BoxBox.

The box-box collider sometimes outputs bad contact points which are far outside one of the two boxes. This happens at configurations which are very rare numerically, but rare configurations (e.g. perfect box alignment) are often induced by the designer and the physics, making them actually not-so-rare.

Since the box collision functions are very difficult to understand, we circumvent the issue by extending the post processing code to detect and remove such contacts.

PiperOrigin-RevId: 589178197
Change-Id: I82b8a888ef04f9196111c960757e3314d0ab6d8e
This commit is contained in:
Yuval Tassa
2023-12-08 10:38:39 -08:00
committed by Copybara-Service
parent a006b15958
commit 7942fe957e
9 changed files with 381 additions and 24 deletions
+4
View File
@@ -78,6 +78,10 @@ MJAPI void mju_decodePyramid(mjtNum* force, const mjtNum* pyramid,
// integrate spring-damper analytically, return pos(dt)
MJAPI mjtNum mju_springDamper(mjtNum pos0, mjtNum vel0, mjtNum Kp, mjtNum Kv, mjtNum dt);
// return 1 if point is outside box given by pos, mat, size
MJAPI int mju_outsideBox(const mjtNum point[3], const mjtNum pos[3], const mjtNum mat[9],
const mjtNum size[3]);
// print matrix
MJAPI void mju_printMat(const mjtNum* mat, int nr, int nc);