diff --git a/doc/XMLschema.rst b/doc/XMLschema.rst
index 11cdb6b4..ec61223a 100644
--- a/doc/XMLschema.rst
+++ b/doc/XMLschema.rst
@@ -446,7 +446,7 @@
| |_|:el:`extension` | \* | *no attribute* |
| | | |
+--------------------------+----+------------------------------------------------------------------------------------+
-| |_2|:el:`required` | \* | .. table:: |
+| |_2|:el:`plugin` | \* | .. table:: |
| | | :class: mjcf-attributes |
| | | |
| | | +-------------------------+-------------------------+-------------------------+ |
diff --git a/model/plugin/belt.xml b/model/plugin/belt.xml
index cdb4d181..e1f0db65 100644
--- a/model/plugin/belt.xml
+++ b/model/plugin/belt.xml
@@ -17,7 +17,7 @@
-
+
@@ -74,4 +74,4 @@
-
\ No newline at end of file
+
diff --git a/model/plugin/cable.xml b/model/plugin/cable.xml
index 4d1337ff..2db16b57 100644
--- a/model/plugin/cable.xml
+++ b/model/plugin/cable.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/model/plugin/coil.xml b/model/plugin/coil.xml
index 2709cc9a..dff6464f 100644
--- a/model/plugin/coil.xml
+++ b/model/plugin/coil.xml
@@ -17,7 +17,7 @@
-
+
@@ -103,4 +103,4 @@
-
\ No newline at end of file
+
diff --git a/model/plugin/floppy.xml b/model/plugin/floppy.xml
index 748b19a9..5819451f 100644
--- a/model/plugin/floppy.xml
+++ b/model/plugin/floppy.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/model/plugin/jelly.xml b/model/plugin/jelly.xml
index be583020..7ee3cb04 100644
--- a/model/plugin/jelly.xml
+++ b/model/plugin/jelly.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/model/plugin/press.xml b/model/plugin/press.xml
index b55bf40b..81a86574 100644
--- a/model/plugin/press.xml
+++ b/model/plugin/press.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/python/mujoco/bindings_test.py b/python/mujoco/bindings_test.py
index 16b56546..d5d90a90 100644
--- a/python/mujoco/bindings_test.py
+++ b/python/mujoco/bindings_test.py
@@ -72,7 +72,7 @@ TEST_XML_SENSOR = r"""
TEST_XML_PLUGIN = r"""
-
+
"""
diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc
index 9e998e8d..174e2ece 100644
--- a/src/xml/xml_native_reader.cc
+++ b/src/xml/xml_native_reader.cc
@@ -190,11 +190,11 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = {
{"extension", "*", "0"},
{"<"},
- {"required", "*", "1", "plugin"},
+ {"plugin", "*", "1", "plugin"},
{"<"},
{"instance", "*", "1", "name"},
{"<"},
- {"config", "*", "2", "key", "value"},
+ {"config", "*", "2", "key", "value"},
{">"},
{">"},
{">"},
@@ -2196,7 +2196,7 @@ void mjXReader::Extension(XMLElement* section) {
// get sub-element name
std::string_view name = elem->Value();
- if (name == "required") {
+ if (name == "plugin") {
std::string plugin_name;
int plugin_slot = -1;
ReadAttrTxt(elem, "plugin", plugin_name, /* required = */ true);
diff --git a/src/xml/xml_native_writer.cc b/src/xml/xml_native_writer.cc
index dfc8a4a2..77934565 100644
--- a/src/xml/xml_native_writer.cc
+++ b/src/xml/xml_native_writer.cc
@@ -1081,12 +1081,12 @@ void mjXWriter::Extension(XMLElement* root) {
// create section
XMLElement* section = InsertEnd(root, "extension");
- // keep track of plugins whose section have been created
+ // keep track of plugins whose section have been created
std::unordered_set seen_plugins;
// write all plugins
const mjpPlugin* last_plugin = nullptr;
- XMLElement* required_elem = nullptr;
+ XMLElement* plugin_elem = nullptr;
for (int i = 0; i < model->plugins.size(); ++i) {
mjCPlugin* pp = static_cast(model->GetObject(mjOBJ_PLUGIN, i));
@@ -1096,17 +1096,17 @@ void mjXWriter::Extension(XMLElement* root) {
break;
}
- // check if we need to open a new section
+ // check if we need to open a new section
const mjpPlugin* plugin = mjp_getPluginAtSlot(pp->plugin_slot);
if (plugin != last_plugin) {
- required_elem = InsertEnd(section, "required");
- WriteAttrTxt(required_elem, "plugin", plugin->name);
+ plugin_elem = InsertEnd(section, "plugin");
+ WriteAttrTxt(plugin_elem, "plugin", plugin->name);
seen_plugins.insert(plugin);
last_plugin = plugin;
}
// write instance element
- XMLElement* elem = InsertEnd(required_elem, "instance");
+ XMLElement* elem = InsertEnd(plugin_elem, "instance");
WriteAttrTxt(elem, "name", pp->name);
// write plugin config attributes
@@ -1123,11 +1123,11 @@ void mjXWriter::Extension(XMLElement* root) {
}
}
- // write elements for plugins without explicit instances
+ // write elements for plugins without explicit instances
for (const auto& [plugin, slot] : model->active_plugins) {
if (seen_plugins.find(plugin) == seen_plugins.end()) {
- required_elem = InsertEnd(section, "required");
- WriteAttrTxt(required_elem, "plugin", plugin->name);
+ plugin_elem = InsertEnd(section, "plugin");
+ WriteAttrTxt(plugin_elem, "plugin", plugin->name);
}
}
}
diff --git a/test/engine/engine_plugin_test.cc b/test/engine/engine_plugin_test.cc
index a0091c2c..3d7e6960 100644
--- a/test/engine/engine_plugin_test.cc
+++ b/test/engine/engine_plugin_test.cc
@@ -343,19 +343,19 @@ class PluginTest : public MujocoTest {
constexpr char xml[] = R"(
-
+
-
-
+
+
-
-
+
+
diff --git a/test/plugin/elasticity/elasticity_test.cc b/test/plugin/elasticity/elasticity_test.cc
index 206aba5a..2c72dc06 100644
--- a/test/plugin/elasticity/elasticity_test.cc
+++ b/test/plugin/elasticity/elasticity_test.cc
@@ -56,7 +56,7 @@ TEST_F(PluginTest, ElasticEnergy) {
static constexpr char cantilever_xml[] = R"(
-
+
@@ -114,7 +114,7 @@ TEST_F(PluginTest, CantileverIntoCircle) {
-
+
@@ -167,12 +167,12 @@ TEST_F(PluginTest, InvalidTxtAttribute) {
static constexpr char cantilever_xml[] = R"(
-
+
-
+
@@ -190,12 +190,12 @@ TEST_F(PluginTest, InvalidMixedAttribute) {
static constexpr char cantilever_xml[] = R"(
-
+
-
+
@@ -213,12 +213,12 @@ TEST_F(PluginTest, ValidAttributes) {
static constexpr char cantilever_xml[] = R"(
-
+
-
+