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
+44
View File
@@ -1433,6 +1433,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='mjtBool'),
doc='whether any geom has nonzero surfacevel',
),
StructFieldDecl(
name='flg_adhesion',
type=ValueType(name='mjtBool'),
doc='whether any geom or pair has nonzero adhesion',
),
StructFieldDecl(
name='opt',
type=ValueType(name='mjOption'),
@@ -2263,6 +2268,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='surface velocity in local frame: lin,ang',
array_extent=('ngeom', 6),
),
StructFieldDecl(
name='geom_adhesion',
type=PointerType(
inner_type=ValueType(name='mjtNum'),
),
doc='adhesive force of contacts',
array_extent=('ngeom',),
),
StructFieldDecl(
name='geom_fluid',
type=PointerType(
@@ -4031,6 +4044,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='additional contact detection buffer',
array_extent=('npair',),
),
StructFieldDecl(
name='pair_adhesion',
type=PointerType(
inner_type=ValueType(name='mjtNum'),
),
doc='adhesive force of contacts',
array_extent=('npair',),
),
StructFieldDecl(
name='pair_friction',
type=PointerType(
@@ -5409,6 +5430,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='constraint solver impedance',
),
StructFieldDecl(
name='adhesion',
type=ValueType(name='mjtNum'),
doc='adhesive force along the contact normal',
),
StructFieldDecl(
name='mu',
type=ValueType(name='mjtNum'),
@@ -6415,6 +6441,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='passive fluid force',
array_extent=('nv',),
),
StructFieldDecl(
name='qfrc_adhesion',
type=PointerType(
inner_type=ValueType(name='mjtNum'),
),
doc='passive contact adhesion force',
array_extent=('nv',),
),
StructFieldDecl(
name='qfrc_passive',
type=PointerType(
@@ -7983,6 +8017,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='surface velocity in local frame: linear, angular',
),
StructFieldDecl(
name='adhesion',
type=ValueType(name='double'),
doc='adhesive force of contacts',
),
StructFieldDecl(
name='mass',
type=ValueType(name='double'),
@@ -9256,6 +9295,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='double'),
doc='additional contact detection buffer',
),
StructFieldDecl(
name='adhesion',
type=ValueType(name='double'),
doc='adhesive force of contacts',
),
StructFieldDecl(
name='friction',
type=ArrayType(
+9
View File
@@ -365,6 +365,13 @@ This is useful for example when the MJB is not available as a file on disk.)"));
m.get()->flg_surfacevel = val;
});
mjModel.def_property(
"flg_adhesion",
[](const MjModelWrapper& m) { return m.get()->flg_adhesion; },
[](MjModelWrapper& m, bool val) {
m.get()->flg_adhesion = val;
});
#define X(var) \
mjModel.def_property_readonly( \
#var, [](const MjModelWrapper& m) { return m.get()->var; });
@@ -770,6 +777,7 @@ This is useful for example when the MJB is not available as a file on disk.)"));
})
X(dist);
X(includemargin);
X(adhesion);
X(mu);
X(dim);
X(geom1);
@@ -821,6 +829,7 @@ This is useful for example when the MJB is not available as a file on disk.)"));
XN(mjtNum, solref);
XN(mjtNum, solreffriction);
XN(mjtNum, solimp);
X(mjtNum, adhesion);
X(mjtNum, mu);
XN(mjtNum, H);
X(int, dim);