Commit Graph

81 Commits

Author SHA1 Message Date
Sam Haves 1f1bfa9e4e Documentation pass for model editing, model encoding, and mjz.
PiperOrigin-RevId: 951665744
Change-Id: I1dfe3b40f451cca686431c263815039a9c38efc8
2026-07-21 13:27:00 -07:00
Sam Haves 723b8b1ea6 Introduce explicit VFS in Python MjVfs
This change introduces MjVFS, an explicit object to mirror the C mjVFS. This is meant to replace the MjSpec.assets dict. This latter while convenient guides users towards harmful authoring patterns with respect to data duplication and spec attachment workflows. Making VFS management explicit should encourage better memory usage and allow us to make better compile time optimizations.

From this change, `spec.assets` is deprecated. However we will temporarily support backwards compatibility due to the wide spread usage. An error will be thrown if calling code tries to use a spec that uses both the assets dict and the new MjVfs.

PiperOrigin-RevId: 908772050
Change-Id: I77c6d0369307fc300c954768fed17401261e18da
2026-05-01 09:34:17 -07:00
Sam Haves d92fe0810c Add MjSpec.encode method.
PiperOrigin-RevId: 907177387
Change-Id: I65800298798037c4a0c0cd79ec86706be67db51e
2026-04-28 14:22:41 -07:00
Yuval Tassa 239aa1f856 Minor updates to documentation across multiple sections.
PiperOrigin-RevId: 898652783
Change-Id: Idb671910c18ed3406722b8a1307f97ae9a194139
2026-04-13 10:54:28 -07:00
Yuval Tassa 0c66585e39 Fix typos and minor corrections in MuJoCo documentation and comments.
PiperOrigin-RevId: 875163889
Change-Id: Ic604d6235bf9cb999058f191e3ee41e47ec1a567
2026-02-25 07:56:31 -08:00
Yuval Tassa b77977a962 Update Programming/simulation chapter.
PiperOrigin-RevId: 847424298
Change-Id: Icc6efb05dee5e67a5813ed04caa15a5703e59aee
2025-12-21 08:16:39 -08:00
Matija Kecman 3c19b63ed3 Refactor texture.data to be handled using py::bytes
PiperOrigin-RevId: 843226742
Change-Id: I7ab920da3c387467b1fced27f557c6edd1af4bce
2025-12-11 08:06:12 -08:00
Matija Kecman bf49fe3daa Enable reading textures from spec in Python
PiperOrigin-RevId: 842151742
Change-Id: I477d118cc7e2385d29b395b192fa89e9facb9c3e
2025-12-09 03:08:32 -08:00
Yuval Tassa 64add36adb Update documentation to be compatible with PDF generation
PiperOrigin-RevId: 822081040
Change-Id: I935b08751109e973398bc61c21f7217408983494
2025-10-21 06:02:53 -07:00
Tom Erez 0141c6b8b7 Include reference to the State API in the mujoco-py migration guide.
PiperOrigin-RevId: 809349546
Change-Id: I4d48223962e6b89e3844c779e9499932c7b72945
2025-09-20 01:20:19 -07:00
Michiel Blokzijl ee777f74d3 Explain how to build Python and C/C++ sources from the same codebase.
The previous instructions use a pre-built binary from MuJoCo and do not cover
the use-case of building C/C++ and Python bindings from the same codebase.

PiperOrigin-RevId: 802060401
Change-Id: I6d0b9c7c2269ff596ac706b716ff6c95b42c5d99
2025-09-02 02:51:49 -07:00
Yuval Tassa fde479736e Finalize built-in mesh example model and documentation
PiperOrigin-RevId: 791227350
Change-Id: Ibdcdb8a4ee5b3f78c9ae93e1db2a9a2f9d55a80c
2025-08-05 08:32:51 -07:00
Matija Kecman 09f44b3c92 Explain why mjpython is needed on MacOS
PiperOrigin-RevId: 776500649
Change-Id: Ifc4c944284f541cdb3a7027365ee27caaee39731
2025-06-27 03:01:10 -07:00
Matija Kecman 09f7154e57 Add option to only sync the state to improve sync performance in passive mode.
By default this option is off, which preserves the current behavior of syncing all of `mjModel` and `mjData`.

PiperOrigin-RevId: 776498017
Change-Id: I02127c9397efbabebb89b0e0d139b00b6e665d35
2025-06-27 02:49:58 -07:00
Yuval Tassa 18d5d5d03f Improve documentation related to mjSpec element deletion.
PiperOrigin-RevId: 775677830
Change-Id: I02e51b57956b0b6a20c654326b54e001b498dd96
2025-06-25 07:23:51 -07:00
Alessio Quaglino a2acd2d4ed Rename detach_default and detach_body to delete in the mjSpec bindings.
PiperOrigin-RevId: 773674361
Change-Id: I3977060e19e9ff0afc65ad91693c017958576b78
2025-06-20 06:23:30 -07:00
Alessio Quaglino 0488d9f4eb Replace mjs_detachBody and mjs_detachDefault with mjs_detach.
In a follow-up, mjs_detach will be changed to only remove without deleting an element.

PiperOrigin-RevId: 773637351
Change-Id: I9ee4d3584ba88ccc225591337cf036bab806e25c
2025-06-20 04:12:27 -07:00
Alessio Quaglino fb30e0e00c Add docs for mjSpec serialization.
PiperOrigin-RevId: 752230683
Change-Id: Id237ccc1b265e99bf15892f8fd208ba38f4c6ded
2025-04-28 02:58:46 -07:00
Alessio Quaglino ebd30493c8 Allow nameless bind in MJX.
PiperOrigin-RevId: 742592221
Change-Id: I9490aebd64e3a31219c552d5b6eb55236680f10d
2025-04-01 01:45:44 -07:00
Alessio Quaglino 6e19035aab Add delete and detach docs.
PiperOrigin-RevId: 741444657
Change-Id: I4207eaf74524e8a3ca46130967c6fb0dd62b4d64
2025-03-28 01:58:54 -07:00
Yuval Tassa 3b27f30827 Added comment regarding numpy slices.
PiperOrigin-RevId: 735681812
Change-Id: I832219bb63c83ecd5115ac1d5755cd35b4362478
2025-03-11 02:36:51 -07:00
Yuval Tassa 010f9bacbb Fix typo in Python API docs.
PiperOrigin-RevId: 732600862
Change-Id: Ie9a8db9555ac3e233d29a10d289b71745d644cb2
2025-03-02 01:20:25 -08:00
Yuval Tassa dc98ae978d Publicize the rollout notebook, small improvements to plotting.
PiperOrigin-RevId: 730841667
Change-Id: Id365f21cee078f28cb3fa797701c3c5a409607cd
2025-02-25 05:20:41 -08:00
Yuval Tassa ef1ef8ef6a Fix Sphinx-Toolbox dependency issue in documentation.
PiperOrigin-RevId: 725818375
Change-Id: I9f241f9575d4bebceeab62937caf682e455b3816
2025-02-11 16:41:02 -08:00
Alessio Quaglino cef5b31a3f Drop find_ prefix in Python MjSpec methods accessing elements by name.
PiperOrigin-RevId: 725594833
Change-Id: Ibf8a9918e98b298751d0ef2e657714e28e5fa460
2025-02-11 05:50:49 -08:00
Yuval Tassa a6dd5f086f Document element name lookup in MjSpec.
PiperOrigin-RevId: 725258206
Change-Id: I5c9a85d25787eb38e9e8c3854eda2581700e188e
2025-02-10 10:10:41 -08:00
Alessio Quaglino 06758e35ab Fix mjSpec colab after changing the default behavior of attach to be a shallow copy.
PiperOrigin-RevId: 724375710
Change-Id: I5fac7d24c1d0b1ad4d427c021022c47620accf53
2025-02-07 09:41:03 -08:00
Kristian Hartikainen 0fda5344c2 Fix typos 2025-01-29 15:31:39 -05:00
Kevin Zakka 1a4b821b6b [doc] Tweak language in asset dict paragraph.
PiperOrigin-RevId: 720994183
Change-Id: Ib99cc3fdd02eefdb2d78d7ac5adf36293c001062
2025-01-29 08:51:26 -08:00
Kevin Zakka f61973601e [docs] Mention asset lookup in MjSpec construction.
PiperOrigin-RevId: 720671094
Change-Id: I6ba343b37893620ba4f3477e57daa4876805156c
2025-01-28 12:33:55 -08:00
Yuval Tassa 8c22181156 Fix documentation typos.
PiperOrigin-RevId: 720232771
Change-Id: I176db4d4168c37b2819df14b439c4cde838e2025
2025-01-27 10:58:22 -08:00
Yuval Tassa 0090e1e908 Rename rollout variable nroll to nbatch.
PiperOrigin-RevId: 718196100
Change-Id: Ic36b1a96ea1af2de351539115d4eee051d195aaf
2025-01-21 21:04:15 -08:00
Alessio Quaglino 4bb6aeb19f Change site and frame attach API.
Old API:
```
site.attach(child_spec)
frame.attach(child_spec)
```

New API:
```
parent_spec.attach(child_spec, frame=frame_name_or_object)
parent_spec.attach(site_spec, site=site_name_or_object)
```

This enables accessing the parent object during attach, which will be used in a follow-up CL to automatically append the child assets to the parent.

PiperOrigin-RevId: 717908589
Change-Id: I0fb27e99694c954cb8ba8a8c98484ffd53a4d6db
2025-01-21 07:29:27 -08:00
Alessio Quaglino c2138c3fb0 Do not copy the spec during attach.
Use a reference count for managing the memory.

PiperOrigin-RevId: 716169486
Change-Id: Id270c4858c17b9250115e9544d5ea143584e2d5f
2025-01-16 03:53:17 -08:00
Alessio Quaglino 05d4c3d670 Add mjs_getParent to retrieve the parent body of an object.
PiperOrigin-RevId: 715794859
Change-Id: Ib9792787cdb966f579938dde3f94ebabca8ef1fc
2025-01-15 07:42:43 -08:00
Levi Burner a7eb6efd4e Copybara import of the project:
--
3a95b62f59e81bfef0f076afb173ecc14b27943d by Levi Burner <leviburner@gmail.com>:

rollout prototype native threadpool for comparing to python threads

--
efd8be1124ac839b902de45973a3ca8b9f2215e6 by Levi Burner <leviburner@gmail.com>:

copy mjpcs threadpool into python bindings

--
75603eea3e8362e354a9675e8a6cd14e56ec3d28 by Levi Burner <leviburner@gmail.com>:

rollout use threadpool as translation unit

--
06b90febd021663f6cc81fd7895e4d6e2008ed97 by Levi Burner <leviburner@gmail.com>:

rollout add chunk_divisor parameter

--
298ab2f3c0d6e12530832c3cdbf784dd92d54806 by Levi Burner <leviburner@gmail.com>:

rollout add native threading test

--
169cf9978e7abad6edd1392b8e6aab995e4f8f10 by Levi Burner <leviburner@gmail.com>:

rollout exchange chunk_divisor arg for chunk_size

--
265af851d74432d261277d3dbda11cdef1841bc8 by Levi Burner <leviburner@gmail.com>:

rollout fix cosmetics

--
1e8bffa88bf36190501b334bef31147e23db39f7 by Levi Burner <leviburner@gmail.com>:

make native rollout a class instead of a function

--
ba788214b047577f58c41ce0ab6c62c277cd8b0d by Levi Burner <leviburner@gmail.com>:

rollout update docs and changelog

--
e4cb7732319e04cba2ab2c2ad848c659f6309808 by Levi Burner <leviburner@gmail.com>:

rollout don't register atexit handler for Rollout objects

--
5a08d2efdbbbb01d4b1231ff9a36a1dc44f4d9ee by Levi Burner <leviburner@gmail.com>:

rollout nthread kwarg, rename shutdown_pool to close, fixups

--
f622378543596a208339af0208fa3a70bf2a8007 by Levi Burner <leviburner@gmail.com>:

rollout add missing .close() calls

--
50f3ebca43c53eac03f03943c34bb1e46967bd4f by Levi Burner <leviburner@gmail.com>:

rollout return immediately

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/2282 from aftersomemath:rollout-threaded 50f3ebca43c53eac03f03943c34bb1e46967bd4f
PiperOrigin-RevId: 706744277
Change-Id: I1ab2263b7d6ce30cf1908aec8fd5f2eb976a19e6
2024-12-16 09:57:08 -08:00
Yuval Tassa a7fed25fdd Document how to save MjSpec to XML. Fixes #2075
PiperOrigin-RevId: 704712337
Change-Id: I51c1a14c5c48ffc8e37d9e31162a3e70a3b10313
2024-12-10 08:05:01 -08:00
Levi Burner e6eab04dd0 rollout fixups and correctly initialize unspecified controls 2024-11-27 07:04:23 -05:00
Levi Burner 943eb6bc7e rollout accepts a list of models of length nroll 2024-11-25 21:29:14 -05:00
Alessio Quaglino c6ba8f27fd Add bind() method to MjModel and MjData.
This method allows users to bind a spec to a model or data object, making it less verbose to access its arrays.

PiperOrigin-RevId: 699952211
Change-Id: I6b71a88d5a6968bc0f902bd49db7c568b46a4dfb
2024-11-25 05:53:58 -08:00
Alessio Quaglino f909d63cdf Enable to attach a spec to a frame.
PiperOrigin-RevId: 699703988
Change-Id: Idbddcbce1e68286248458eb0bd24d5080451a58a
2024-11-24 07:35:14 -08:00
Yuval Tassa b6037d1759 Improve mjSpec documentation. Fixes #2074.
PiperOrigin-RevId: 692251710
Change-Id: Ia46bbbe5b7eaa890433b38fed66824f716cc9ea0
2024-11-01 12:06:14 -07:00
Yuval Tassa d8494fef3b Remove deprecated mjv_makeConnector function.
PiperOrigin-RevId: 690563333
Change-Id: Ice9c6b6cf41de8a55fa361477f9aee9181d50184
2024-10-28 04:51:47 -07:00
Copybara-Service 7e9481fbeb Merge pull request #2067 from abhihjoshi:documentation
PiperOrigin-RevId: 682364758
Change-Id: I3a5000a2851a560018ae0e04a2b7ad13415cb7c6
2024-10-04 10:15:19 -07:00
Taylor Howell 30cd8cc0e2 Add keyword argument example to code block in model editing section of the documentation.
PiperOrigin-RevId: 678643644
Change-Id: Ie1d5659f01cc882628a669e7be22eff975a888fc
2024-09-25 04:34:03 -07:00
Abhishek Joshi 456dcc150c Updating documentation for comments 2024-09-23 14:10:48 -04:00
Abhishek Joshi 43bf8d5e10 Moving USD documentation under Python page 2024-09-19 07:42:30 -04:00
Nimrod Gileadi f75ead2203 Improve the build instructions for mac.
The app bundle doesn't include mujoco.framework, so the instructions were a bit stale. I verified that with these new instructions I'm able to build the Python bindings from source with a prebuilt MuJoCo binary.

Fixes #313.

PiperOrigin-RevId: 666272041
Change-Id: I8bcf14c8ab6268cdaa617a8b5940b155ef64a8c5
2024-08-22 03:22:17 -07:00
Yuval Tassa 4d9305fbb9 Fix typo.
PiperOrigin-RevId: 663728400
Change-Id: Ifaf266a515bacb7b1598d14eb435561cb2375224
2024-08-16 07:45:38 -07:00
Yuval Tassa e13ddfa2ab Improve compiler-related documentation.
PiperOrigin-RevId: 651827545
Change-Id: I85c12dc12967e49087c342445dbfa049c5cdbcdf
2024-07-12 11:05:16 -07:00