From e57d95e68fc6179bc9e93869fad38b90ce27e74a Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Wed, 18 Mar 2026 07:58:45 -0700 Subject: [PATCH] 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 --- doc/XMLreference.rst | 12 ++---------- doc/XMLschema.rst | 6 ------ doc/changelog.rst | 3 +++ doc/includes/references.h | 1 - include/mujoco/mjspec.h | 1 - ...ho_vertcollide.xml => poncho_edgeequality.xml} | 8 ++++---- python/mujoco/introspect/structs.py | 5 ----- src/experimental/platform/gui_spec.cc | 1 - src/user/user_flexcomp.cc | 15 --------------- src/xml/xml_native_reader.cc | 10 ++-------- wasm/codegen/generated/bindings.cc | 7 ------- 11 files changed, 11 insertions(+), 58 deletions(-) rename model/flex/{poncho_vertcollide.xml => poncho_edgeequality.xml} (99%) diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index d777a866..8df9de88 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -3801,7 +3801,6 @@ saving the XML: .. _flexcomp-contact-internal: .. _flexcomp-contact-selfcollide: -.. _flexcomp-contact-vertcollide: .. _flexcomp-contact-activelayers: .. _flexcomp-contact-contype: .. _flexcomp-contact-conaffinity: @@ -3816,8 +3815,8 @@ saving the XML: .. _flexcomp-contact-passive: .. |body/flexcomp/contact attrib list| replace:: - :at:`internal`, :at:`selfcollide`, :at:`vertcollide`, :at:`activelayers`, :at:`contype`, :at:`conaffinity`, - :at:`condim`, :at:`priority`, :at:`friction`, :at:`solmix`, :at:`solimp`, :at:`margin`, :at:`gap` + :at:`internal`, :at:`selfcollide`, :at:`activelayers`, :at:`contype`, :at:`conaffinity`, :at:`condim`, + :at:`priority`, :at:`friction`, :at:`solmix`, :at:`solimp`, :at:`margin`, :at:`gap` |body/flexcomp/contact attrib list| Same as in :ref:`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 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: :at:`activelayers`: :at-val:`int(1), "1"` diff --git a/doc/XMLschema.rst b/doc/XMLschema.rst index 3eb57cf0..a3bae914 100755 --- a/doc/XMLschema.rst +++ b/doc/XMLschema.rst @@ -1564,9 +1564,6 @@ .. grid-item:: :ref:`activelayers` - .. grid-item:: - :ref:`vertcollide` - .. grid-item:: :ref:`passive` @@ -1705,9 +1702,6 @@ .. grid-item:: :ref:`activelayers` - .. grid-item:: - :ref:`vertcollide` - .. grid-item:: :ref:`passive` diff --git a/doc/changelog.rst b/doc/changelog.rst index 1e8c2d2b..0c9d73d8 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -29,6 +29,9 @@ General **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 ` + will support native flex collisions. + Bug fixes ^^^^^^^^^ diff --git a/doc/includes/references.h b/doc/includes/references.h index 84046a71..67d1aef8 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -2228,7 +2228,6 @@ typedef struct mjsFlex_ { // flex specification mjtByte internal; // enable internal collisions mjtByte flatskin; // render flex skin with flat shading int selfcollide; // mode for flex self collision - int vertcollide; // mode for vertex collision int passive; // mode for passive collisions int activelayers; // number of active element layers in 3D int group; // group for visualization diff --git a/include/mujoco/mjspec.h b/include/mujoco/mjspec.h index 655c8820..a0b279d6 100644 --- a/include/mujoco/mjspec.h +++ b/include/mujoco/mjspec.h @@ -442,7 +442,6 @@ typedef struct mjsFlex_ { // flex specification mjtByte internal; // enable internal collisions mjtByte flatskin; // render flex skin with flat shading int selfcollide; // mode for flex self collision - int vertcollide; // mode for vertex collision int passive; // mode for passive collisions int activelayers; // number of active element layers in 3D int group; // group for visualization diff --git a/model/flex/poncho_vertcollide.xml b/model/flex/poncho_edgeequality.xml similarity index 99% rename from model/flex/poncho_vertcollide.xml rename to model/flex/poncho_edgeequality.xml index cb75a7cd..d14378df 100644 --- a/model/flex/poncho_vertcollide.xml +++ b/model/flex/poncho_edgeequality.xml @@ -15,7 +15,7 @@ - @@ -33,7 +33,7 @@ - - - + + diff --git a/python/mujoco/introspect/structs.py b/python/mujoco/introspect/structs.py index d2518705..478e591a 100644 --- a/python/mujoco/introspect/structs.py +++ b/python/mujoco/introspect/structs.py @@ -8119,11 +8119,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([ type=ValueType(name='int'), doc='mode for flex self collision', ), - StructFieldDecl( - name='vertcollide', - type=ValueType(name='int'), - doc='mode for vertex collision', - ), StructFieldDecl( name='passive', type=ValueType(name='int'), diff --git a/src/experimental/platform/gui_spec.cc b/src/experimental/platform/gui_spec.cc index 7d30d31d..7991fc03 100644 --- a/src/experimental/platform/gui_spec.cc +++ b/src/experimental/platform/gui_spec.cc @@ -537,7 +537,6 @@ void ElementSpecGui(mjsElement* element, SpecEditor* editor) { FIELD(internal, "enable internal collisions"); FIELD(flatskin, "render flex skin with flat shading"); FIELD(selfcollide, "mode for flex self collision"); - FIELD(vertcollide, "mode for vertex collision"); FIELD(passive, "mode for passive collisions"); FIELD(activelayers, "number of active element layers in 3D"); FIELD(group, "group for visualization"); diff --git a/src/user/user_flexcomp.cc b/src/user/user_flexcomp.cc index c349fb28..56fcb615 100644 --- a/src/user/user_flexcomp.cc +++ b/src/user/user_flexcomp.cc @@ -502,14 +502,6 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz, const mjVFS* vf // add new body at vertex coordinates 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 pb->pos[0] = point[3*i]; 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->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++) { mjsJoint* jnt = mjs_addJoint(pb, 0); jnt->type = mjJNT_SLIDE; diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index 8d8630cb..59aca5da 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -318,7 +318,7 @@ std::vector MJCF[nMJCF] = { {"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"}, {"contact", "?", "contype", "conaffinity", "condim", "priority", "friction", "solmix", "solref", "solimp", "margin", "gap", - "internal", "selfcollide", "activelayers", "vertcollide", "passive"}, + "internal", "selfcollide", "activelayers", "passive"}, {"pin", "*", "id", "range", "grid", "gridrange"}, {"plugin", "*", "plugin", "instance"}, {"<"}, @@ -334,7 +334,7 @@ std::vector MJCF[nMJCF] = { {"<"}, {"contact", "?", "contype", "conaffinity", "condim", "priority", "friction", "solmix", "solref", "solimp", "margin", "gap", - "internal", "selfcollide", "activelayers", "vertcollide", "passive"}, + "internal", "selfcollide", "activelayers", "passive"}, {"edge", "?", "stiffness", "damping"}, {"elasticity", "?", "young", "poisson", "damping", "thickness", "elastic2d"}, {">"}, @@ -1519,9 +1519,6 @@ void mjXReader::OneFlex(XMLElement* elem, mjsFlex* flex) { flex->internal = (n == 1); } 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)) { flex->passive = (n == 1); } @@ -2822,9 +2819,6 @@ void mjXReader::OneFlexcomp(XMLElement* elem, mjsBody* body, const mjVFS* vfs) { dflex.internal = (n == 1); } 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)) { dflex.passive = (n == 1); } diff --git a/wasm/codegen/generated/bindings.cc b/wasm/codegen/generated/bindings.cc index 5169d896..842d13a4 100644 --- a/wasm/codegen/generated/bindings.cc +++ b/wasm/codegen/generated/bindings.cc @@ -2375,12 +2375,6 @@ struct MjsFlex { void set_selfcollide(int value) { ptr_->selfcollide = value; } - int vertcollide() const { - return ptr_->vertcollide; - } - void set_vertcollide(int value) { - ptr_->vertcollide = value; - } int passive() const { return ptr_->passive; } @@ -12554,7 +12548,6 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) { .property("thickness", &MjsFlex::thickness, &MjsFlex::set_thickness, reference()) .property("vert", &MjsFlex::vert, reference()) .property("vertbody", &MjsFlex::vertbody, reference()) - .property("vertcollide", &MjsFlex::vertcollide, &MjsFlex::set_vertcollide, reference()) .property("young", &MjsFlex::young, &MjsFlex::set_young, reference()); emscripten::class_("MjsFrame") .property("alt", &MjsFrame::alt, reference())