Add geom adhesion: contacts that pull, via translated friction cones.

https://youtu.be/GioWwB36XHI

The new geom attribute adhesion (units of force, signed; pair-level
override) translates the contact friction cone along its normal so
that the force origin lies strictly inside it. Consequences: each
contact can pull with up to the given force before breaking, and the
tangential friction budget becomes mu*(f_N + adhesion) -- the
Mohr-Coulomb yield condition with cohesion c = mu*adhesion -- so
lightly-squeezed grasps retain a guaranteed friction floor.

A translated cone factors exactly into {constant attractive force}
+ {original cone}, so no solver kernels change. The implementation is
this factorization: a constant attraction along contact normals
accumulated into the new mjData.qfrc_adhesion (summed into
qfrc_passive), plus a bias of adhesive contact rows' reference
acceleration (aref += R*adhesion), which makes resting penetration
exactly independent of adhesion. Contacts of adhesive pairs remain
active throughout the gap zone, producing rows with positive violation
whose reference acceleration pulls: a tether that resists pull-off
smoothly, captures objects released within the band into steady
contact, and detaches at the specified force. Adhesion values of the
two geoms combine by sum; explicit pairs override.

mj_contactForce reports the net interface force (cone force minus the
adhesive pull), whose normal component can now be negative. Negative
adhesion is allowed and produces a repulsive offset (air hockey).

PiperOrigin-RevId: 950858148
Change-Id: I879c08eba7ae501e5c0f8c2f807167344da4c2bc
This commit is contained in:
Yuval Tassa
2026-07-20 08:35:17 -07:00
committed by Copybara-Service
parent b942c9f922
commit a264d0bc8b
28 changed files with 784 additions and 50 deletions
+2
View File
@@ -46,6 +46,7 @@ typedef struct mjContact_ { // result of collision detection functions
mjtNum solref[mjNREF]; // constraint solver reference, normal direction
mjtNum solreffriction[mjNREF]; // constraint solver reference, friction directions
mjtNum solimp[mjNIMP]; // constraint solver impedance
mjtNum adhesion; // adhesive force along the contact normal
// internal storage used by solver
mjtNum mu; // friction of regularized cone, set by mj_makeConstraint
@@ -287,6 +288,7 @@ typedef struct mjData_ {
mjtNum* qfrc_damper; // passive damper force (nv x 1)
mjtNum* qfrc_gravcomp; // passive gravity compensation force (nv x 1)
mjtNum* qfrc_fluid; // passive fluid force (nv x 1)
mjtNum* qfrc_adhesion; // passive contact adhesion force (nv x 1)
mjtNum* qfrc_passive; // total passive force (nv x 1)
// computed by mj_sensorVel/mj_subtreeVel if needed
+3
View File
@@ -350,6 +350,7 @@ typedef struct mjModel_ {
mjtBool flg_gravcomp; // whether any body has nonzero gravcomp
mjtBool flg_surfacevel; // whether any geom has nonzero surfacevel
mjtBool flg_adhesion; // whether any geom or pair has nonzero adhesion
// ------------------------------- options and statistics
@@ -478,6 +479,7 @@ typedef struct mjModel_ {
mjtNum* geom_margin; // geometric inflation for contact (ngeom x 1)
mjtNum* geom_gap; // additional contact detection buffer (ngeom x 1)
mjtNum* geom_surfacevel; // surface velocity in local frame: lin,ang (ngeom x 6)
mjtNum* geom_adhesion; // adhesive force of contacts (ngeom x 1)
mjtNum* geom_fluid; // fluid interaction parameters (ngeom x mjNFLUID)
mjtNum* geom_user; // user data (ngeom x nuser_geom)
float* geom_rgba; // rgba when material is omitted (ngeom x 4)
@@ -721,6 +723,7 @@ typedef struct mjModel_ {
mjtNum* pair_solimp; // solver impedance: contact (npair x mjNIMP)
mjtNum* pair_margin; // geometric inflation for contact (npair x 1)
mjtNum* pair_gap; // additional contact detection buffer (npair x 1)
mjtNum* pair_adhesion; // adhesive force of contacts (npair x 1)
mjtNum* pair_friction; // tangent1, 2, spin, roll1, 2 (npair x 5)
// excluded body pairs for collision detection
+2
View File
@@ -359,6 +359,7 @@ typedef struct mjsGeom_ { // geom specification
double margin; // margin for contact detection
double gap; // additional contact detection buffer
double surfacevel[6]; // surface velocity in local frame: linear, angular
double adhesion; // adhesive force of contacts
// inertia inference
double mass; // used to compute density
@@ -642,6 +643,7 @@ typedef struct mjsPair_ { // pair specification
mjtNum solimp[mjNIMP]; // solver impedance
double margin; // margin for contact detection
double gap; // additional contact detection buffer
double adhesion; // adhesive force of contacts
double friction[5]; // full contact friction
mjString* info; // message appended to errors
} mjsPair;
+2
View File
@@ -183,6 +183,7 @@
X ( double, margin, 1 ) \
X ( double, gap, 1 ) \
XVEC( double, surfacevel, 6 ) \
X ( double, adhesion, 1 ) \
X ( double, mass, 1 ) \
X ( double, density, 1 ) \
X ( mjtGeomInertia, typeinertia, 1 ) \
@@ -421,6 +422,7 @@
XVEC( mjtNum, solimp, mjNIMP ) \
X ( double, margin, 1 ) \
X ( double, gap, 1 ) \
X ( double, adhesion, 1 ) \
XVEC( double, friction, 5 ) \
X ( mjString*, info, 1 )
+3
View File
@@ -386,6 +386,7 @@
X ( mjtNum, geom_margin, ngeom, 1 ) \
X ( mjtNum, geom_gap, ngeom, 1 ) \
X ( mjtNum, geom_surfacevel, ngeom, 6 ) \
X ( mjtNum, geom_adhesion, ngeom, 1 ) \
XNV ( mjtNum, geom_fluid, ngeom, mjNFLUID ) \
X ( mjtNum, geom_user, ngeom, MJ_M(nuser_geom) ) \
X ( float, geom_rgba, ngeom, 4 )
@@ -627,6 +628,7 @@
X ( mjtNum, pair_solimp, npair, mjNIMP ) \
X ( mjtNum, pair_margin, npair, 1 ) \
X ( mjtNum, pair_gap, npair, 1 ) \
X ( mjtNum, pair_adhesion, npair, 1 ) \
X ( mjtNum, pair_friction, npair, 5 )
#define MJMODEL_POINTERS_EXCLUDE \
@@ -911,6 +913,7 @@
X ( mjtNum, qfrc_damper, nv, 1 ) \
X ( mjtNum, qfrc_gravcomp, nv, 1 ) \
X ( mjtNum, qfrc_fluid, nv, 1 ) \
X ( mjtNum, qfrc_adhesion, nv, 1 ) \
X ( mjtNum, qfrc_passive, nv, 1 ) \
X ( mjtNum, subtree_linvel, nbody, 3 ) \
X ( mjtNum, subtree_angmom, nbody, 3 ) \