Use geom margin in the midphase.

At the leaves of the midphase trees in `mj_collideTree`, a bounding sphere test is performed. The margin was incorrectly set to zero instead of reading it from `geom_margin`.

PiperOrigin-RevId: 559782262
Change-Id: Icfceb8445bbf6977582e0061566d7bd4def2f0ae
This commit is contained in:
Alessio Quaglino
2023-08-24 09:44:27 -07:00
committed by Copybara-Service
parent 9255cc58a9
commit b0077e4052
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -43,6 +43,11 @@ Python bindings
7. Fixed `#870 <https://github.com/deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
camera name used the default camera.
Bug fixes
^^^^^^^^^
#. Fixed a bug that was causing the geom margins to be ignored during the midphase.
Version 2.3.7 (July 20, 2023)
-----------------------------
+2 -1
View File
@@ -244,7 +244,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int b1, int b2,
// both are leaves
if (isleaf1 && isleaf2 && nodeid1 != -1 && nodeid2 != -1) {
if (mj_collideSphere(m, d, nodeid1, nodeid2, /*margin=*/ 0)) {
if (mj_collideSphere(m, d, nodeid1, nodeid2, m->geom_margin[nodeid1] +
m->geom_margin[nodeid2])) {
if (mj_collideOBB(m->geom_aabb + 6*nodeid1, m->geom_aabb + 6*nodeid2,
d->geom_xpos + 3*nodeid1, d->geom_xmat + 9*nodeid1,
d->geom_xpos + 3*nodeid2, d->geom_xmat + 9*nodeid2,