Remove vertcollide attribute from flex contact.

The `vertcollide` attribute in flex and flexcomp contact specifications has been removed since the next mjWarp release will support flex collisions. This attribute was previously used to enable vertex-based collisions by adding sphere geoms at flex vertices. The functionality associated with this attribute has been deprecated and removed from the XML parser, documentation, and internal data structures. Affected example XML files have also been updated.

PiperOrigin-RevId: 885595503
Change-Id: I6a78975f1bc540c09ea8b5306ff3be0962b7ab24
This commit is contained in:
Alessio Quaglino
2026-03-18 07:58:45 -07:00
committed by Copybara-Service
parent ef78f07ffb
commit e57d95e68f
11 changed files with 11 additions and 58 deletions
+2 -10
View File
@@ -3801,7 +3801,6 @@ saving the XML:
.. _flexcomp-contact-internal: .. _flexcomp-contact-internal:
.. _flexcomp-contact-selfcollide: .. _flexcomp-contact-selfcollide:
.. _flexcomp-contact-vertcollide:
.. _flexcomp-contact-activelayers: .. _flexcomp-contact-activelayers:
.. _flexcomp-contact-contype: .. _flexcomp-contact-contype:
.. _flexcomp-contact-conaffinity: .. _flexcomp-contact-conaffinity:
@@ -3816,8 +3815,8 @@ saving the XML:
.. _flexcomp-contact-passive: .. _flexcomp-contact-passive:
.. |body/flexcomp/contact attrib list| replace:: .. |body/flexcomp/contact attrib list| replace::
:at:`internal`, :at:`selfcollide`, :at:`vertcollide`, :at:`activelayers`, :at:`contype`, :at:`conaffinity`, :at:`internal`, :at:`selfcollide`, :at:`activelayers`, :at:`contype`, :at:`conaffinity`, :at:`condim`,
:at:`condim`, :at:`priority`, :at:`friction`, :at:`solmix`, :at:`solimp`, :at:`margin`, :at:`gap` :at:`priority`, :at:`friction`, :at:`solmix`, :at:`solimp`, :at:`margin`, :at:`gap`
|body/flexcomp/contact attrib list| |body/flexcomp/contact attrib list|
Same as in :ref:`flex/contact<flex-contact>`. All attributes are passed through to the automatically-generated flex. Same as in :ref:`flex/contact<flex-contact>`. All attributes are passed through to the automatically-generated flex.
@@ -4336,13 +4335,6 @@ extensions specific to flexes.
**sap** in 1D and 2D, and **bvh** in 3D. Which strategy performs better depends on the specifics of the model. The **sap** in 1D and 2D, and **bvh** in 3D. Which strategy performs better depends on the specifics of the model. The
automatic setting is just a simple rule which we have found to perform well in general. automatic setting is just a simple rule which we have found to perform well in general.
.. _flex-contact-vertcollide:
:at:`vertcollide`: :at-val:`[true, false], "false"`
Enables or disables vertex collisions. if **true**, spherical geoms are added at the vertices of flex, with radius
equal to the radius of the flex. These geoms can collide with other geoms and are not visible by default. If
**false**, no additional geoms are added.
.. _flex-contact-activelayers: .. _flex-contact-activelayers:
:at:`activelayers`: :at-val:`int(1), "1"` :at:`activelayers`: :at-val:`int(1), "1"`
-6
View File
@@ -1564,9 +1564,6 @@
.. grid-item:: .. grid-item::
:ref:`activelayers<flexcomp-contact-activelayers>` :ref:`activelayers<flexcomp-contact-activelayers>`
.. grid-item::
:ref:`vertcollide<flexcomp-contact-vertcollide>`
.. grid-item:: .. grid-item::
:ref:`passive<flexcomp-contact-passive>` :ref:`passive<flexcomp-contact-passive>`
@@ -1705,9 +1702,6 @@
.. grid-item:: .. grid-item::
:ref:`activelayers<flex-contact-activelayers>` :ref:`activelayers<flex-contact-activelayers>`
.. grid-item::
:ref:`vertcollide<flex-contact-vertcollide>`
.. grid-item:: .. grid-item::
:ref:`passive<flex-contact-passive>` :ref:`passive<flex-contact-passive>`
+3
View File
@@ -29,6 +29,9 @@ General
**Migration:** Replace assignments like ``joint.stiffness = val`` with ``joint.stiffness[0] = val``. **Migration:** Replace assignments like ``joint.stiffness = val`` with ``joint.stiffness[0] = val``.
- The ``vertcollide`` field in :ref:`mjsContact` has been deprecated since the next release of :doc:`MuJoCo Warp <mjwarp/index>`
will support native flex collisions.
Bug fixes Bug fixes
^^^^^^^^^ ^^^^^^^^^
-1
View File
@@ -2228,7 +2228,6 @@ typedef struct mjsFlex_ { // flex specification
mjtByte internal; // enable internal collisions mjtByte internal; // enable internal collisions
mjtByte flatskin; // render flex skin with flat shading mjtByte flatskin; // render flex skin with flat shading
int selfcollide; // mode for flex self collision int selfcollide; // mode for flex self collision
int vertcollide; // mode for vertex collision
int passive; // mode for passive collisions int passive; // mode for passive collisions
int activelayers; // number of active element layers in 3D int activelayers; // number of active element layers in 3D
int group; // group for visualization int group; // group for visualization
-1
View File
@@ -442,7 +442,6 @@ typedef struct mjsFlex_ { // flex specification
mjtByte internal; // enable internal collisions mjtByte internal; // enable internal collisions
mjtByte flatskin; // render flex skin with flat shading mjtByte flatskin; // render flex skin with flat shading
int selfcollide; // mode for flex self collision int selfcollide; // mode for flex self collision
int vertcollide; // mode for vertex collision
int passive; // mode for passive collisions int passive; // mode for passive collisions
int activelayers; // number of active element layers in 3D int activelayers; // number of active element layers in 3D
int group; // group for visualization int group; // group for visualization
@@ -15,7 +15,7 @@
<mujoco model="Poncho"> <mujoco model="Poncho">
<include file="mannequin.xml"/> <include file="mannequin.xml"/>
<option timestep="0.01" integrator="implicitfast" viscosity=".3" solver="CG" tolerance="1e-6"> <option timestep="0.005" integrator="implicitfast" viscosity=".3" solver="CG" tolerance="1e-6">
<flag energy="enable"/> <flag energy="enable"/>
</option> </option>
@@ -33,7 +33,7 @@
<worldbody> <worldbody>
<light directional="false" diffuse=".2 .2 .2" specular="0 0 0" pos="0 0 5" dir="0 0 -1"/> <light directional="false" diffuse=".2 .2 .2" specular="0 0 0" pos="0 0 5" dir="0 0 -1"/>
<flexcomp name="f1" type="direct" rgba=".8 .2 .2 1" radius="0.02" dim="2" pos="0 0 2" <flexcomp name="f1" type="direct" rgba=".8 .2 .2 1" radius="0.01" dim="2" pos="0 0 2"
mass="1" mass="1"
point="0 0 0 point="0 0 0
-1 1 0 -1 1 0
@@ -1414,8 +1414,8 @@
398 399 418 398 399 418
398 376 378"> 398 376 378">
<edge equality="true" damping="0.1"/> <edge equality="true" damping="0.1"/>
<elasticity poisson="0.3" young="3e5" thickness="8e-3" elastic2d="bend"/> <elasticity poisson="0" young="3e5" thickness="8e-3" elastic2d="bend"/>
<contact solref="0.003" contype="0" conaffinity="0" vertcollide="true"/> <contact solref="0.003"/>
</flexcomp> </flexcomp>
</worldbody> </worldbody>
-5
View File
@@ -8119,11 +8119,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='int'), type=ValueType(name='int'),
doc='mode for flex self collision', doc='mode for flex self collision',
), ),
StructFieldDecl(
name='vertcollide',
type=ValueType(name='int'),
doc='mode for vertex collision',
),
StructFieldDecl( StructFieldDecl(
name='passive', name='passive',
type=ValueType(name='int'), type=ValueType(name='int'),
-1
View File
@@ -537,7 +537,6 @@ void ElementSpecGui(mjsElement* element, SpecEditor* editor) {
FIELD(internal, "enable internal collisions"); FIELD(internal, "enable internal collisions");
FIELD(flatskin, "render flex skin with flat shading"); FIELD(flatskin, "render flex skin with flat shading");
FIELD(selfcollide, "mode for flex self collision"); FIELD(selfcollide, "mode for flex self collision");
FIELD(vertcollide, "mode for vertex collision");
FIELD(passive, "mode for passive collisions"); FIELD(passive, "mode for passive collisions");
FIELD(activelayers, "number of active element layers in 3D"); FIELD(activelayers, "number of active element layers in 3D");
FIELD(group, "group for visualization"); FIELD(group, "group for visualization");
-15
View File
@@ -502,14 +502,6 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz, const mjVFS* vf
// add new body at vertex coordinates // add new body at vertex coordinates
mjsBody* pb = mjs_addBody(body, 0); mjsBody* pb = mjs_addBody(body, 0);
// add geom if vertcollide
if (dflex->vertcollide) {
mjsGeom* geom = mjs_addGeom(pb, 0);
geom->type = mjGEOM_SPHERE;
geom->size[0] = dflex->radius;
geom->group = 4;
}
// set frame and inertial // set frame and inertial
pb->pos[0] = point[3*i]; pb->pos[0] = point[3*i];
pb->pos[1] = point[3*i+1]; pb->pos[1] = point[3*i+1];
@@ -605,13 +597,6 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz, const mjVFS* vf
pb->inertia[2] = pb->mass*(2.0*inertiabox*inertiabox)/3.0; pb->inertia[2] = pb->mass*(2.0*inertiabox*inertiabox)/3.0;
pb->explicitinertial = true; pb->explicitinertial = true;
// add geom if vertcollide
if (dflex->vertcollide) {
mjsGeom* geom = mjs_addGeom(pb, 0);
geom->type = mjGEOM_SPHERE;
geom->size[0] = dflex->radius;
}
for (int d=0; d < 3; d++) { for (int d=0; d < 3; d++) {
mjsJoint* jnt = mjs_addJoint(pb, 0); mjsJoint* jnt = mjs_addJoint(pb, 0);
jnt->type = mjJNT_SLIDE; jnt->type = mjJNT_SLIDE;
+2 -8
View File
@@ -318,7 +318,7 @@ std::vector<const char*> MJCF[nMJCF] = {
{"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"}, {"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"},
{"contact", "?", "contype", "conaffinity", "condim", "priority", {"contact", "?", "contype", "conaffinity", "condim", "priority",
"friction", "solmix", "solref", "solimp", "margin", "gap", "friction", "solmix", "solref", "solimp", "margin", "gap",
"internal", "selfcollide", "activelayers", "vertcollide", "passive"}, "internal", "selfcollide", "activelayers", "passive"},
{"pin", "*", "id", "range", "grid", "gridrange"}, {"pin", "*", "id", "range", "grid", "gridrange"},
{"plugin", "*", "plugin", "instance"}, {"plugin", "*", "plugin", "instance"},
{"<"}, {"<"},
@@ -334,7 +334,7 @@ std::vector<const char*> MJCF[nMJCF] = {
{"<"}, {"<"},
{"contact", "?", "contype", "conaffinity", "condim", "priority", {"contact", "?", "contype", "conaffinity", "condim", "priority",
"friction", "solmix", "solref", "solimp", "margin", "gap", "friction", "solmix", "solref", "solimp", "margin", "gap",
"internal", "selfcollide", "activelayers", "vertcollide", "passive"}, "internal", "selfcollide", "activelayers", "passive"},
{"edge", "?", "stiffness", "damping"}, {"edge", "?", "stiffness", "damping"},
{"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"}, {"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"},
{">"}, {">"},
@@ -1519,9 +1519,6 @@ void mjXReader::OneFlex(XMLElement* elem, mjsFlex* flex) {
flex->internal = (n == 1); flex->internal = (n == 1);
} }
MapValue(cont, "selfcollide", &flex->selfcollide, flexself_map, 5); MapValue(cont, "selfcollide", &flex->selfcollide, flexself_map, 5);
if (MapValue(cont, "vertcollide", &flex->vertcollide, bool_map, 2)) {
flex->vertcollide = (n == 1);
}
if (MapValue(cont, "passive", &flex->passive, bool_map, 2)) { if (MapValue(cont, "passive", &flex->passive, bool_map, 2)) {
flex->passive = (n == 1); flex->passive = (n == 1);
} }
@@ -2822,9 +2819,6 @@ void mjXReader::OneFlexcomp(XMLElement* elem, mjsBody* body, const mjVFS* vfs) {
dflex.internal = (n == 1); dflex.internal = (n == 1);
} }
MapValue(cont, "selfcollide", &dflex.selfcollide, flexself_map, 5); MapValue(cont, "selfcollide", &dflex.selfcollide, flexself_map, 5);
if (MapValue(cont, "vertcollide", &n, bool_map, 2)) {
dflex.vertcollide = (n == 1);
}
if (MapValue(cont, "passive", &n, bool_map, 2)) { if (MapValue(cont, "passive", &n, bool_map, 2)) {
dflex.passive = (n == 1); dflex.passive = (n == 1);
} }
-7
View File
@@ -2375,12 +2375,6 @@ struct MjsFlex {
void set_selfcollide(int value) { void set_selfcollide(int value) {
ptr_->selfcollide = value; ptr_->selfcollide = value;
} }
int vertcollide() const {
return ptr_->vertcollide;
}
void set_vertcollide(int value) {
ptr_->vertcollide = value;
}
int passive() const { int passive() const {
return ptr_->passive; return ptr_->passive;
} }
@@ -12554,7 +12548,6 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
.property("thickness", &MjsFlex::thickness, &MjsFlex::set_thickness, reference()) .property("thickness", &MjsFlex::thickness, &MjsFlex::set_thickness, reference())
.property("vert", &MjsFlex::vert, reference()) .property("vert", &MjsFlex::vert, reference())
.property("vertbody", &MjsFlex::vertbody, reference()) .property("vertbody", &MjsFlex::vertbody, reference())
.property("vertcollide", &MjsFlex::vertcollide, &MjsFlex::set_vertcollide, reference())
.property("young", &MjsFlex::young, &MjsFlex::set_young, reference()); .property("young", &MjsFlex::young, &MjsFlex::set_young, reference());
emscripten::class_<MjsFrame>("MjsFrame") emscripten::class_<MjsFrame>("MjsFrame")
.property("alt", &MjsFrame::alt, reference()) .property("alt", &MjsFrame::alt, reference())