diff --git a/dm_control/mjcf/schema.xml b/dm_control/mjcf/schema.xml
index 029ceb88..1cf91972 100644
--- a/dm_control/mjcf/schema.xml
+++ b/dm_control/mjcf/schema.xml
@@ -1257,7 +1257,7 @@
-
+
@@ -1641,7 +1641,7 @@
-
+
@@ -1810,18 +1810,18 @@
-
-
-
+
+
+
-
+
-
+
-
+
diff --git a/dm_control/mjcf/xml_validation_test.py b/dm_control/mjcf/xml_validation_test.py
index 58a0ad42..a34c1e1f 100644
--- a/dm_control/mjcf/xml_validation_test.py
+++ b/dm_control/mjcf/xml_validation_test.py
@@ -46,6 +46,47 @@ def validate(xml_string, assets=None):
class XMLValidationTest(absltest.TestCase):
+ def testDeformableFlexRoundTrip(self):
+ # A flex needs three floats per vertex, so even the smallest one exceeds
+ # the five entries the schema used to allow. `dim` and `radius` are
+ # omitted here because MuJoCo supplies defaults for both.
+ model = parser.from_xml_string("""
+
+
+
+
+
+
+
+
+
+
+""")
+ xml_string = model.to_xml_string()
+ validate(xml_string)
+ mjmodel = wrapper.MjModel.from_xml_string(xml_string)
+ self.assertEqual(mjmodel.flex_vertnum[0], 3)
+ self.assertEqual(mjmodel.flex_group[0], 2)
+ self.assertTrue(mjmodel.flex_flatskin[0])
+
+ def testFlexcompFlatskinIsBoolean(self):
+ for parent_open, parent_close in (('', ''), ('', '')):
+ model = parser.from_xml_string("""
+
+
+ %s
+
+ %s
+
+
+""" % (parent_open, parent_close))
+ xml_string = model.to_xml_string()
+ validate(xml_string)
+ mjmodel = wrapper.MjModel.from_xml_string(xml_string)
+ self.assertTrue(mjmodel.flex_flatskin[0])
+
def testXmlAttach(self):
robot_arm = parser.from_file(_ROBOT_XML)
arena = parser.from_file(_ARENA_XML)