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:
committed by
Copybara-Service
parent
b942c9f922
commit
a264d0bc8b
@@ -4502,6 +4502,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.constructor<>()
|
||||
.function("copy", &MjContact::copy, take_ownership())
|
||||
.property("H", &MjContact::H)
|
||||
.property("adhesion", &MjContact::adhesion, &MjContact::set_adhesion, reference())
|
||||
.property("dim", &MjContact::dim, &MjContact::set_dim, reference())
|
||||
.property("dist", &MjContact::dist, &MjContact::set_dist, reference())
|
||||
.property("efc_address", &MjContact::efc_address, &MjContact::set_efc_address, reference())
|
||||
@@ -4685,6 +4686,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.property("qacc_smooth", &MjData::qacc_smooth)
|
||||
.property("qacc_warmstart", &MjData::qacc_warmstart)
|
||||
.property("qfrc_actuator", &MjData::qfrc_actuator)
|
||||
.property("qfrc_adhesion", &MjData::qfrc_adhesion)
|
||||
.property("qfrc_applied", &MjData::qfrc_applied)
|
||||
.property("qfrc_bias", &MjData::qfrc_bias)
|
||||
.property("qfrc_constraint", &MjData::qfrc_constraint)
|
||||
@@ -4982,9 +4984,11 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.property("flexvert_J_colind", &MjModel::flexvert_J_colind)
|
||||
.property("flexvert_J_rowadr", &MjModel::flexvert_J_rowadr)
|
||||
.property("flexvert_J_rownnz", &MjModel::flexvert_J_rownnz)
|
||||
.property("flg_adhesion", &MjModel::flg_adhesion, &MjModel::set_flg_adhesion, reference())
|
||||
.property("flg_gravcomp", &MjModel::flg_gravcomp, &MjModel::set_flg_gravcomp, reference())
|
||||
.property("flg_surfacevel", &MjModel::flg_surfacevel, &MjModel::set_flg_surfacevel, reference())
|
||||
.property("geom_aabb", &MjModel::geom_aabb)
|
||||
.property("geom_adhesion", &MjModel::geom_adhesion)
|
||||
.property("geom_bodyid", &MjModel::geom_bodyid)
|
||||
.property("geom_conaffinity", &MjModel::geom_conaffinity)
|
||||
.property("geom_condim", &MjModel::geom_condim)
|
||||
@@ -5240,6 +5244,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.property("oct_coeff", &MjModel::oct_coeff)
|
||||
.property("oct_depth", &MjModel::oct_depth)
|
||||
.property("opt", &MjModel::opt, reference())
|
||||
.property("pair_adhesion", &MjModel::pair_adhesion)
|
||||
.property("pair_dim", &MjModel::pair_dim)
|
||||
.property("pair_friction", &MjModel::pair_friction)
|
||||
.property("pair_gap", &MjModel::pair_gap)
|
||||
@@ -5752,6 +5757,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.property("pos", &MjsFrame::pos)
|
||||
.property("quat", &MjsFrame::quat);
|
||||
emscripten::class_<MjsGeom>("MjsGeom")
|
||||
.property("adhesion", &MjsGeom::adhesion, &MjsGeom::set_adhesion, reference())
|
||||
.property("alt", &MjsGeom::alt, reference())
|
||||
.property("conaffinity", &MjsGeom::conaffinity, &MjsGeom::set_conaffinity, reference())
|
||||
.property("condim", &MjsGeom::condim, &MjsGeom::set_condim, reference())
|
||||
@@ -5895,6 +5901,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
|
||||
.property("xyaxes", &MjsOrientation::xyaxes)
|
||||
.property("zaxis", &MjsOrientation::zaxis);
|
||||
emscripten::class_<MjsPair>("MjsPair")
|
||||
.property("adhesion", &MjsPair::adhesion, &MjsPair::set_adhesion, reference())
|
||||
.property("condim", &MjsPair::condim, &MjsPair::set_condim, reference())
|
||||
.property("element", &MjsPair::element, reference())
|
||||
.property("friction", &MjsPair::friction)
|
||||
|
||||
@@ -377,6 +377,12 @@ struct MjContact {
|
||||
emscripten::val solimp() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(5, ptr_->solimp));
|
||||
}
|
||||
mjtNum adhesion() const {
|
||||
return ptr_->adhesion;
|
||||
}
|
||||
void set_adhesion(mjtNum value) {
|
||||
ptr_->adhesion = value;
|
||||
}
|
||||
mjtNum mu() const {
|
||||
return ptr_->mu;
|
||||
}
|
||||
@@ -3091,6 +3097,12 @@ struct MjsPair {
|
||||
void set_gap(double value) {
|
||||
ptr_->gap = value;
|
||||
}
|
||||
double adhesion() const {
|
||||
return ptr_->adhesion;
|
||||
}
|
||||
void set_adhesion(double value) {
|
||||
ptr_->adhesion = value;
|
||||
}
|
||||
emscripten::val friction() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(5, ptr_->friction));
|
||||
}
|
||||
@@ -4320,6 +4332,12 @@ struct MjModel {
|
||||
void set_flg_surfacevel(mjtBool value) {
|
||||
ptr_->flg_surfacevel = value;
|
||||
}
|
||||
mjtBool flg_adhesion() const {
|
||||
return ptr_->flg_adhesion;
|
||||
}
|
||||
void set_flg_adhesion(mjtBool value) {
|
||||
ptr_->flg_adhesion = value;
|
||||
}
|
||||
emscripten::val buffer() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->nbuffer, static_cast<uint8_t*>(ptr_->buffer)));
|
||||
}
|
||||
@@ -4626,6 +4644,9 @@ struct MjModel {
|
||||
emscripten::val geom_surfacevel() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->ngeom * 6, ptr_->geom_surfacevel));
|
||||
}
|
||||
emscripten::val geom_adhesion() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->ngeom, ptr_->geom_adhesion));
|
||||
}
|
||||
emscripten::val geom_fluid() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->ngeom * mjNFLUID, ptr_->geom_fluid));
|
||||
}
|
||||
@@ -5289,6 +5310,9 @@ struct MjModel {
|
||||
emscripten::val pair_gap() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->npair, ptr_->pair_gap));
|
||||
}
|
||||
emscripten::val pair_adhesion() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->npair, ptr_->pair_adhesion));
|
||||
}
|
||||
emscripten::val pair_friction() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(ptr_->npair * 5, ptr_->pair_friction));
|
||||
}
|
||||
@@ -6290,6 +6314,12 @@ struct MjsGeom {
|
||||
emscripten::val surfacevel() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(6, ptr_->surfacevel));
|
||||
}
|
||||
double adhesion() const {
|
||||
return ptr_->adhesion;
|
||||
}
|
||||
void set_adhesion(double value) {
|
||||
ptr_->adhesion = value;
|
||||
}
|
||||
double mass() const {
|
||||
return ptr_->mass;
|
||||
}
|
||||
@@ -7055,6 +7085,9 @@ struct MjData {
|
||||
emscripten::val qfrc_fluid() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(model->nv, ptr_->qfrc_fluid));
|
||||
}
|
||||
emscripten::val qfrc_adhesion() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(model->nv, ptr_->qfrc_adhesion));
|
||||
}
|
||||
emscripten::val qfrc_passive() const {
|
||||
return emscripten::val(emscripten::typed_memory_view(model->nv, ptr_->qfrc_passive));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user