From 7ae07d81579bd999ea14706cbae04d1cb3105b02 Mon Sep 17 00:00:00 2001 From: Sam Haves Date: Mon, 13 Apr 2026 08:21:13 -0700 Subject: [PATCH] URDF parsing no longer strips filepaths by default. This default forces users to use the `spec.assets` dictionary or to do other filepath gymnastics when loading URDF. Instead we encourage users to just modify file paths directly if necessary. PiperOrigin-RevId: 899009853 Change-Id: I4bb84606a95b65be79ccc77ccbe78062d6de8773 --- doc/XMLreference.rst | 2 +- doc/changelog.rst | 10 ++++++++++ src/xml/xml.cc | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index a5486dec..8cf40b72 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -739,7 +739,7 @@ has any effect. The settings here are global and apply to the entire model. .. _compiler-strippath: -:at:`strippath`: :at-val:`[false, true], "false" for MJCF, "true" for URDF` +:at:`strippath`: :at-val:`[false, true], "false"` When this attribute is "true", the parser will remove any path information in file names specified in the model. This is useful for loading models created on a different system using a different directory structure. diff --git a/doc/changelog.rst b/doc/changelog.rst index 82fae188..e8dbb0ed 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -52,6 +52,16 @@ General - The :ref:`mjtWarning` enum value ``mjWARN_VGEOMFULL`` is removed. Exhaustion of visual geoms is now handled internally by the :ref:`mjvScene`. + - URDF parsing no longer hardcodes :ref:`strippath` to "true". The setting is now respected and + the default is "false". Setting this is attribute is now the responsibility of the user. + + **Migration:** Set :ref:`strippath` to "true" in MJCF or programmatically using + + .. code-block:: python + + spec = mujoco.MjSpec.from_file("path/to/model.urdf") + spec.compiler.strippath = True + Bug fixes ^^^^^^^^^ diff --git a/src/xml/xml.cc b/src/xml/xml.cc index 639fc587..654d0a57 100644 --- a/src/xml/xml.cc +++ b/src/xml/xml.cc @@ -296,7 +296,6 @@ mjSpec* SpecFromXML(std::string_view xml, std::string_view dir, // set reasonable default for parsing a URDF // this is separate from the Parser to allow multiple URDFs to be loaded. - spec->strippath = true; spec->compiler.fusestatic = true; spec->compiler.discardvisual = true;