Commit Graph

567 Commits

Author SHA1 Message Date
Copybara-Service 8de9b4e4e3 Merge pull request #2462 from jjyyxx:main
PiperOrigin-RevId: 731710330
Change-Id: If87dd2c06123bd9ddfc62b63370c8fedf320e721
2025-02-27 06:58:24 -08:00
Yuval Tassa 9c31494fa1 Add MjSpec example for procedural meshes.
PiperOrigin-RevId: 731635686
Change-Id: I310b802966755f627c4ec2cbdcd2ce7b14921c57
2025-02-27 01:57:56 -08:00
Kevin Sayed e1f18a747e Update dependencies and the changelog ahead of the 3.3.0 release.
PiperOrigin-RevId: 731406295
Change-Id: I05027722a9681f71549b7e022dfe13fc381b8564
2025-02-26 12:07:55 -08:00
Kevin Sayed 9996500de9 update the version number to 3.3.0 instead of 3.2.8
PiperOrigin-RevId: 731397143
Change-Id: I54089f1678097acf7e4998958effb396da1e47be
2025-02-26 11:42:55 -08:00
Kyle Bayes ed16f2daf2 Set nativeccd as default.
PiperOrigin-RevId: 731343200
Change-Id: I315779017b676f3d118e0d38ee53a515272f50b8
2025-02-26 09:15:15 -08:00
Yuxuan Jiang 2039629457 Expose MjSpec raw pointer via _address 2025-02-26 10:25:55 +08:00
Alessio Quaglino d1d61925da Do not delete the world child when doing spec.attach.
PiperOrigin-RevId: 730976077
Change-Id: I9aa8133241b45883e605ec80d64ae28af2962680
2025-02-25 12:02:13 -08:00
Alessio Quaglino 441b5c6082 Change MjSpec.default from method to attribute.
PiperOrigin-RevId: 730912407
Change-Id: I0147acbd257ecc8b72752a2992a7d4ea6e1b4c07
2025-02-25 09:17:45 -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
Alessio Quaglino ce82b63155 Add mjs_attachFrameToSite.
This is required in preparation of changing the spec.attach behavior in the Python bindings.

PiperOrigin-RevId: 730810198
Change-Id: I095808f0afe62b5bbd27201ed5c75804e0e9c4bf
2025-02-25 03:21:05 -08:00
Levi Burner cfc59164eb rollout notebook: fixups to benchmarks, plots, text
1. MJX benchmarks use jax.lax.scan and block_until_ready
2. Benchmark parameters updated to match RL use case
3. humanoid benchmarks are warmstarted by 2 seconds, humanoid100 by 4 seconds
4. benchmarks use skip_checks and preallocated threadpools
5. Improved advanced usage plots
6. Benchmark no longer includes model initialization in timed section
7. Update notebook text as needed
2025-02-25 03:25:51 -05:00
Yuval Tassa a0eb985532 rollout notebook: fix bugs due to cell reordering
PiperOrigin-RevId: 729567659
Change-Id: I439da667317ed51370d7c8a9fbfc31d11140752c
2025-02-21 10:05:30 -08:00
Yuval Tassa f9bb6cb3db Minor updates to rollout notebook:
1. Move benchmarks below advanced usage.
2. Request A100 GPU
3. Minor cosmetic changes.

PiperOrigin-RevId: 729538515
Change-Id: I12709cd95f6865e53fd3932ea0b303ee8efc4028
2025-02-21 08:27:33 -08:00
Copybara-Service ea2bbc1d14 Merge pull request #2439 from aftersomemath:rollout-size_t
PiperOrigin-RevId: 729519951
Change-Id: Ic50b08960da84d2277820212d19fcbab9f2d67cf
2025-02-21 07:17:25 -08:00
Levi Burner a0971ef749 rollout fix cosmetics 2025-02-21 08:44:17 -05:00
Levi Burner aca4e5d6ae rollout test for integer overflow in array size check 2025-02-20 21:12:52 -05:00
Yuval Tassa 7efaf5c549 Improve docstring of mjxmacro.py
PiperOrigin-RevId: 729058910
Change-Id: I3ae9c7c50facca3bfb08a317c2267b9d8672f207
2025-02-20 04:43:26 -08:00
Alessio Quaglino 41c2918819 Add batch support to MJX data bind.
PiperOrigin-RevId: 729033713
Change-Id: I331317a54a7882dc67bf329da8aeaff7246754e4
2025-02-20 03:10:30 -08:00
Levi Burner df71467eed rollout use size_t for array size check and pointer arithmetic 2025-02-19 22:46:12 -05:00
Yuval Tassa 19624aef9d Add an example of a textured height field to mjSpec notebook.
https://youtu.be/i6eXrzJNKeY

PiperOrigin-RevId: 728841769
Change-Id: I1aca838af69d8474aab13b06d8c1e5cf87fc6440
2025-02-19 15:34:21 -08:00
Copybara-Service 7a2ad8fd97 Merge pull request #2436 from aftersomemath:rollout-notebook-pr
PiperOrigin-RevId: 728706864
Change-Id: I8f3a507234c4265564a4fee9df0ab8111ff7dd85
2025-02-19 09:42:08 -08:00
Alessio Quaglino b0e9d08673 Move introspect to python/introspect
PiperOrigin-RevId: 728695024
Change-Id: I96433e1e9ee509704d66bd4c1be1906732e4cc55
2025-02-19 09:01:21 -08:00
Levi Burner 41a873b016 Notebook showcasing the Python rollout module 2025-02-18 10:57:03 -05:00
Alessio Quaglino 7f11a0df12 Add check for height fields size during compilation.
Fixes #2427.

PiperOrigin-RevId: 727805729
Change-Id: Idf3192e5fb238249faaeae6b4fb9de4c55755d96
2025-02-17 04:01:27 -08:00
Google DeepMind 37d7591ce0 Add support for user-defined figures in the MuJoCo viewer.
PiperOrigin-RevId: 726983516
Change-Id: Ifb821f3cafb163d4f3077d76b0668037b4bc5a9c
2025-02-14 10:45:47 -08:00
Alessio Quaglino 5b924fec98 Add support for binding to arrays of mjs element.
Fixes #2402.

PiperOrigin-RevId: 726449592
Change-Id: I0cde44889837a71a222b20cf91fa56568b4af689
2025-02-13 06:01:30 -08:00
Alessio Quaglino 1b4258d274 Change set_default and default to classname in the bindings.
Having defaults in the names of the attribute or function names is confusing for the users since the defaults are not re-applied but are only used for writing to XML. The alternative would be to change mjs_setDefault to re-apply them, but this would overwrite any other attribute set by the user so far.

PiperOrigin-RevId: 726431090
Change-Id: I41f4a23e1722e278b0ecc0a00b07db9b384fe994
2025-02-13 04:52:02 -08:00
Yuval Tassa 7af9bcbf00 mjSpec tutorial: Move humanoid and Menagerie imports to the cells that require them.
PiperOrigin-RevId: 725945693
Change-Id: I3f0d4c867626ef61605815bb708a55c8e29d79e2
2025-02-12 01:02:17 -08:00
Copybara-Service d830691f53 Merge pull request #2291 from AaronYoung5:main
PiperOrigin-RevId: 725933976
Change-Id: I207cf272d30e28f00fb4d07bd237385ad4c26a84
2025-02-12 00:16:10 -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
Alessio Quaglino e54f3c222d Autogenerate mjSpec find_* methods.
PiperOrigin-RevId: 725255440
Change-Id: Ia9112f6c582ea9bb0af38aa97a917e72a98a84f5
2025-02-10 10:03:44 -08:00
Alessio Quaglino 4156350708 Add to_file function to save the Spec to a file.
Fixes #2415.

PiperOrigin-RevId: 725161617
Change-Id: I6c374cc7f7cb3f1da1cc0da531dd7e5be5d62b6a
2025-02-10 04:33:14 -08:00
Yuval Tassa 73aba91297 Add simple procedural tree example to model editing tutorial.
https://youtu.be/7VJG61AapEc

PiperOrigin-RevId: 724729966
Change-Id: I48c288de8e01baa3cd8f40700bc7137744de37a0
2025-02-08 13:02:11 -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
Alessio Quaglino dec7b661c1 Add mujoco.MjSpec.MjStruct type.
PiperOrigin-RevId: 723552214
Change-Id: I8ecb43b4025b532ba8b48e15c9c6a2b350293d20
2025-02-05 10:01:35 -08:00
Alessio Quaglino 6bd88711a8 Add parent to MjSpec wrapper in Python bindings.
This keeps track of specs attached with the full attach function `attach`. It does not track fine-grained attach via `attach_body` and `attach_frame`.

PiperOrigin-RevId: 722597081
Change-Id: I56188f1718592128b7033538acc9a40553cbbed2
2025-02-03 04:04:11 -08:00
Alessio Quaglino 86ace5e562 Remove body.spec() function from the Python API
We can only use the MjSpec wrapper, not the raw::MjSpec struct in the API.

PiperOrigin-RevId: 722589064
Change-Id: I007150f92738487f27211d7435e328cab86214f7
2025-02-03 03:31:35 -08:00
Yuval Tassa 767be23207 Fix pretty printing in mjspec notebook.
PiperOrigin-RevId: 721367994
Change-Id: Ia1c4ee5b64540ff2f9c08a1953295ff366e0c72b
2025-01-30 06:32:35 -08:00
Alessio Quaglino 904b49848f Add worldbody assertions in attach tests.
This clarifies the difference between attaching a full spec, which converts the worldbody to a frame, and attaching a specific body (or frame).

PiperOrigin-RevId: 721297010
Change-Id: Iff87fe99b81746e6ab3a189a3057b274d3c9a939
2025-01-30 01:35:55 -08:00
Alessio Quaglino 0643017346 Add asset argument to MjSpec constructors.
PiperOrigin-RevId: 720628689
Change-Id: I189aa34973e58b9fb87951e34cb923d94e081a55
2025-01-28 10:39:27 -08:00
Alessio Quaglino 5b330ca19c Change keyword argument asset to include in spec.from_file and spec.from_string.
PiperOrigin-RevId: 720611881
Change-Id: I92f5e72cece8d3223bc552ea4f2ef742c47cb8c9
2025-01-28 09:55:48 -08:00
Alessio Quaglino 2546fcefa0 Add mujoco.MjSpec.to_zip()
PiperOrigin-RevId: 719003836
Change-Id: I310ac96b0080b3313c325cee76d3bf7f81fa9df0
2025-01-23 14:01:06 -08:00
Yuval Tassa f9fd2e4ba4 Add a test showing how to implement scipy's 'soft_l1' loss in minimize.least_squares
PiperOrigin-RevId: 718649580
Change-Id: I5cec0e2850c805301407c9eb543ab3ba69d42e79
2025-01-22 18:25:44 -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
Copybara-Service ac76540eb8 Merge pull request #2377 from aftersomemath:rollout-fix-ndata-check
PiperOrigin-RevId: 718181763
Change-Id: Ie88bf1d26c77478ce3a5ca8fdf29ae90e54b5834
2025-01-21 20:11:33 -08:00
Alessio Quaglino 6a7a7a5f80 Add the override_assets attribute to MjSpec.
When specified, child asset with repeated names will override parent's, rather than throw an error. Default behavior is to override.

PiperOrigin-RevId: 717979621
Change-Id: I18022dc266619b4ba1a8636d1c60f85b0eb5f862
2025-01-21 10:39:02 -08:00
Alessio Quaglino 1412a29dac Merge child asset dictionary into parent spec during attach().
PiperOrigin-RevId: 717939728
Change-Id: I54f8ac87062cf19f55a16af37b777701545ed865
2025-01-21 08:57:09 -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
Levi Burner cee122116e rollout: fix bugs in checking list lengths, add tests 2025-01-21 00:36:52 -05:00
Yuval Tassa baf1c43b3c Fix more misleading line for creating list of models in rollout_test.py
PiperOrigin-RevId: 717628943
Change-Id: I83a314565ce4ec683afeea18c8c8ce9e23d5452e
2025-01-20 14:27:31 -08:00