Commit Graph

14 Commits

Author SHA1 Message Date
Haroon Qureshi 2fd9b5e92f Partial roll back VFS refactor due internal breakages
PiperOrigin-RevId: 862210191
Change-Id: Ia15a345a267bcef4b593d507d54f1668da0c0611
2026-01-28 06:40:11 -08:00
Haroon Qureshi 0ddbb46fa1 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 861550939
Change-Id: I070eb4bcc2982466c8f368f7918005538baa5185
2026-01-26 23:53:29 -08:00
Google DeepMind cbc1136502 Roll back VFS refactor due internal breakages
PiperOrigin-RevId: 856273160
Change-Id: I4097e05ed4e48ebee05b4347d0f227d4f39c1b09
2026-01-14 10:38:29 -08:00
Haroon Qureshi d387578783 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 856166919
Change-Id: Id723d612ffc0bff020705cf19ef95fbf24676840
2026-01-14 05:19:57 -08:00
Haroon Qureshi 45e164bf8f Refactor 'ParseXML' and 'ParseSpecFromString' to use a shared helper function.
This allows us to remove the special "LoadModelFromString" resource provider.

PiperOrigin-RevId: 854207845
Change-Id: I6d00f2ab99b4351866e1d39dbeed96f29aaaf915
2026-01-09 08:40:40 -08:00
Alessio Quaglino 287f46b220 Ensure last XML is freed after tests.
This fixes undetected memory leaks in tests calling mj_loadXML.

Additionally, a specific test for `mj_freeLastXML` is introduced.

PiperOrigin-RevId: 764294041
Change-Id: I8b5a5683d8431ed920cdd52b06ad3515d8e19e14
2025-05-28 09:26:46 -07:00
Tom Power e7a715497e Write mesh inertia to defaults when exporting to xml. Fixes #2478
PiperOrigin-RevId: 735338748
Change-Id: Id0b71d06c77baef417f7968ae8a14154243a1f83
2025-03-10 05:31:55 -07:00
Alessio Quaglino e310c23267 Fix return value of mj_saveXML and mj_saveXMLString, fixes #2247
PiperOrigin-RevId: 700269761
Change-Id: Ifb7e9c66c70eac7d681cfcf106712d47291cf9e2
2024-11-26 02:32:50 -08:00
Yuval Tassa 8c380e7ba4 Don't print the fixed name ("main") of the top-level default class when saving XMLs.
Also insert newlines between top level sections in saved XML.

PiperOrigin-RevId: 646802227
Change-Id: If16b93409bda88aee8ef75f4a78d7ba0419fcfae
2024-06-26 03:22:22 -07:00
Alessio Quaglino 7a06bcfdaf Make model editing API public, fixes #364
Still missing:

- Detailed documentation.
- Python bindings.

PiperOrigin-RevId: 641445626
Change-Id: I20e67b707cf1bebae7e0cc94d17f7b76a89171f0
2024-06-07 22:28:01 -07:00
Alessio Quaglino b35ae973e1 Add mj_parseXML and mj_saveXML to xml_api.
PiperOrigin-RevId: 640099466
Change-Id: I75f763523c5bc8f6f7c2f2de6806d82ba37ebd4e
2024-06-04 15:28:14 +01:00
Alexis Fraudita a2a770453e Copybara import of the project:
--
1fcff13dfdc70519c4d33e17ade4be6afb2960a2 by Alexis <cuatroalejandro@gmail.com>:

add multipleBodies test for mj_loadXML

--
34270fa57946e68a82fa55313b64a5a56e5aa080 by Alexis <cuatroalejandro@gmail.com>:

add some space

--
3594020eb9be57cb6a2eef0baeca97cee8f25aab by Alexis <cuatroalejandro@gmail.com>:

remove TODO comment in xml_api_test

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/1487 from alefram:alexis-test 3594020eb9be57cb6a2eef0baeca97cee8f25aab
PiperOrigin-RevId: 615033458
Change-Id: I05fe5659b07b3226b82d2562e31bcd73f150b089
2024-03-12 07:31:11 -07:00
Kyle Bayes 24c1ec9aec Add support for printing to stdout in mj_saveLastXML.
PiperOrigin-RevId: 546849864
Change-Id: I799ea3fcd723cf036f82ef5c1ef8152c314072dc
2023-07-10 06:08:10 -07:00
Saran Tunyasuvunakool 1913a02b40 Initial open sourcing of MuJoCo.
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00