Commit Graph

2684 Commits

Author SHA1 Message Date
Yuval Tassa 5b245e5d02 Fix handling of _full_compat argument in put_data.
PiperOrigin-RevId: 721128021
Change-Id: Ic1cce42fbb38799228d6433ef0c761b1f9b81c4b
2025-01-29 15:27:14 -08:00
Erik Frey 7232a91617 Add keyframe fields to mjx.Model.
PiperOrigin-RevId: 721060807
Change-Id: Iae6aa8773e0e9802b0bd1de9a14d83987cd56936
2025-01-29 12:02:48 -08:00
Alessio Quaglino 7cdf180641 Introduce trilinear flex parametrization.
These flexes use only 24 DOFs (3 per vertex of the bounding box), while colliding with the full high resolution mesh.

On an 8x8x8 cube, the performance using DOFs at all vertices is

```
 Simulation time      : 18.74 s
 Steps per second     : 533
 Realtime factor      : 0.53 x
 Time per step        : 1874.4 µs

 Contacts per step    : 114.88
 Constraints per step : 3322.51
 Degrees of freedom   : 1536
```

With the new implementation, it is the following:

```
 Simulation time      : 1.82 s
 Steps per second     : 5507
 Realtime factor      : 5.51 x
 Time per step        : 181.6 µs

 Contacts per step    : 38.84
 Constraints per step : 155.36
 Degrees of freedom   : 24
```

PiperOrigin-RevId: 721008829
Change-Id: I833df027527db578d86667cc4b24295bcf6f7d22
2025-01-29 09:38:22 -08: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
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
Taylor Howell f4096bcab9 Add sphere and cylinder internal wrapping for spatial tendons to MJX.
PiperOrigin-RevId: 720507688
Change-Id: I49fda2839e68623ff5e1f3c46bdc3d77acfc36ef
2025-01-28 03:22:14 -08:00
Yuval Tassa 6a23841aad manually inline mju_combineSparse
PiperOrigin-RevId: 720326669
Change-Id: I03727291f133e3d481e73ad88735e54af8f62f1f
2025-01-27 15:22:18 -08:00
Alessio Quaglino 3dcfad3293 Add qpos to MJX bindings.
PiperOrigin-RevId: 720311208
Change-Id: Iaf5f905e206256f38cd71949bbebd5151b2a2041
2025-01-27 14:36:42 -08:00
Yuval Tassa 8c22181156 Fix documentation typos.
PiperOrigin-RevId: 720232771
Change-Id: I176db4d4168c37b2819df14b439c4cde838e2025
2025-01-27 10:58:22 -08:00
Yuval Tassa 9605990648 Replace custom sort of sparse fixed tendons with mju_combineSparse.
PiperOrigin-RevId: 720219887
Change-Id: I0491b3cb8987c119c3864fc0b5c38ca303d8f7f0
2025-01-27 10:24:58 -08:00
Alessio Quaglino d21f624264 Fix binding issue with scalar attributes.
PiperOrigin-RevId: 720136044
Change-Id: I0846a93ef36a23371d1bd504adff02dcce0abcf9
2025-01-27 05:47:36 -08:00
Yuval Tassa d86900aac1 Speed up mju_cholUpdateSparse by not checking for varying sparsity pattern where it is guaranteed to not vary.
PiperOrigin-RevId: 720126576
Change-Id: I3a43bdd0259656fab462b1cd155cb422982e970d
2025-01-27 05:07:28 -08:00
Google DeepMind 4ab274aea9 Fix missing arg for mj_compile in model-editing doc example code.
PiperOrigin-RevId: 720005405
Change-Id: Idf71a1a12fe4cfcc450cd80c91b13ee8a75e1636
2025-01-26 20:25:50 -08:00
Yuval Tassa 08edde5fd8 Add test for armature, model will be used in upcoming improved documentation for armature.
PiperOrigin-RevId: 719916567
Change-Id: I7f74bd3c3864f43f5f68d458d5b128cfee1d7e6c
2025-01-26 12:01:12 -08:00
Erik Frey 2c3d0becb2 Empty out Model fields restricted to MuJoCo in the same way we do for Data fields.
PiperOrigin-RevId: 719705508
Change-Id: I4b07433481eafaea1d95a5bdd8fd83786939188f
2025-01-25 14:03:20 -08:00
Alessio Quaglino 2546fcefa0 Add mujoco.MjSpec.to_zip()
PiperOrigin-RevId: 719003836
Change-Id: I310ac96b0080b3313c325cee76d3bf7f81fa9df0
2025-01-23 14:01:06 -08:00
Andrea Gesmundo 3d174a4034 internal change
PiperOrigin-RevId: 718782821
Change-Id: I2d2ead2577767587800f3ea69dba61247105e16f
2025-01-23 02:51:51 -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
Alessio Quaglino 21d97902ee Check keyframe size before appending it during attach.
Fixes #2365.

PiperOrigin-RevId: 718455748
Change-Id: I20c56b7c6fbd868962d19682e72e6294edb6893e
2025-01-22 11:09:49 -08:00
Kyle Bayes aa505a7872 Add support for NativeCCD multiple contacts for box-box collision.
PiperOrigin-RevId: 718352304
Change-Id: Icaa827e716a2d7aa7c0c644e0ccd2913b476e6fb
2025-01-22 06:02:58 -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
Yuval Tassa 67dd4827a6 Improve printing of inertia-like matrices, allow mj_printData to take const mjData*
PiperOrigin-RevId: 718176884
Change-Id: I057dabe6973e19db86e9ff9ce4430c6d17dfce2b
2025-01-21 19:59:45 -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
Kyle Bayes bd1bbfe401 Fix bug where EPA horizon returns zero edges due to numerical inaccuracies in float32.
PiperOrigin-RevId: 717825833
Change-Id: I9fa440816765d4c3eaa0c6c26ec0bd90c774fa01
2025-01-21 02:50:53 -08:00
Levi Burner cee122116e rollout: fix bugs in checking list lengths, add tests 2025-01-21 00:36:52 -05:00
Yuval Tassa 2624d524ba Switch mj_solveM_island to use CSR representation
PiperOrigin-RevId: 717684720
Change-Id: I7d74a5d4aef4aa5b0c0acddf88c5b8591d63e88d
2025-01-20 18:36:04 -08:00
Yuval Tassa a5ab7a9515 Switch mj_solveM2 to use CSR representation.
PiperOrigin-RevId: 717639495
Change-Id: I59eee0f23606481480ec5acb8a3bba2c14b2ea2f
2025-01-20 15:16:26 -08: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
Google DeepMind 68cd263337 Change type of light_poscom0 and `actuator_acc0'.
This is required for batching over `mjx.Model` in case recompilation is used to change inertial values.

PiperOrigin-RevId: 717596504
Change-Id: I4b6780903ebf12ebbf8b7bc7b8990a01609d4491
2025-01-20 12:11:31 -08:00
Yuval Tassa ff4783482c Fix misleading line for creating list of models in rollout_test.py
PiperOrigin-RevId: 717582208
Change-Id: I1b4e40fc5ccbfe68fb7dc240715c704f1f68d9fe
2025-01-20 11:13:21 -08:00
Alessio Quaglino 699a6765e3 Add find functions for joints, lights, and cameras to mjSpec bindings.
PiperOrigin-RevId: 717578768
Change-Id: I2087ccbb9cf8b3b8ec03e9eb2edb0707d4a4cac1
2025-01-20 11:02:34 -08:00
Kyle Bayes 600f4acb52 Change GJK and EPA return values.
PiperOrigin-RevId: 717549079
Change-Id: I42df5660bcc8336e2e9c8fce71385cbb06104848
2025-01-20 08:59:37 -08:00
Yuval Tassa 5c4c79cd6a Refactor LD back-substitution (CSR version).
PiperOrigin-RevId: 717403904
Change-Id: Idcd5e71f03a960203c22cb737d399fac5a0ba59c
2025-01-19 22:47:25 -08:00
Baruch Tabanpour 2a100547bd Remove match in support.py (introduced in Python 3.10).
https://github.com/google-deepmind/mujoco_playground/issues/16

PiperOrigin-RevId: 717395934
Change-Id: I0be1b8285a79702a1dfc086e15e07bab0f9f6d40
2025-01-19 22:08:51 -08:00
Copybara-Service e2b1cfc3a8 Merge pull request #2249 from Balint-H:docs/unity-tutorial
PiperOrigin-RevId: 717294302
Change-Id: Ief98bd6cd4eac448062e331b6737043f12926ad2
2025-01-19 13:01:07 -08:00
Yuval Tassa f13c107cd7 Workaround to doc build error caused by sphinx-toolbox bug.
See issue for details: https://github.com/sphinx-toolbox/sphinx-toolbox/issues/176

PiperOrigin-RevId: 717282405
Change-Id: I9e02804a3571fcca74eb7f174f3c3e262b0d3b65
2025-01-19 11:58:52 -08:00
Yuval Tassa 1d47a91c19 Add a test for mj_solveM2
PiperOrigin-RevId: 717278730
Change-Id: I7507e569620c34f250482eec8402c08c793f4e48
2025-01-19 11:34:20 -08:00
Bálint Hodossy 203e9bc292 Remove trailing spaces 2025-01-19 13:24:36 +00:00
Yuval Tassa b2d353d062 Document default visible geom groups in XMLreference.
PiperOrigin-RevId: 717050528
Change-Id: I0414495d2f5a17ac2d8ba35c9353ecf0b7e8a18d
2025-01-18 12:42:01 -08:00
Yuval Tassa 463bc47633 Clarify that equality constraints defined using the body-based semantic are assumed to be satisfied at `mjData.qpos0`.
PiperOrigin-RevId: 717050088
Change-Id: I02e82cab5a60f0af48f7f921ba9bca11837f8063
2025-01-18 12:39:40 -08:00
Yuval Tassa 69c66aa1bb Fix typo.
PiperOrigin-RevId: 716820809
Change-Id: I51f8608f0c01f4fc8016b4be779d98c8972bc913
2025-01-17 15:39:56 -08:00
Baruch Tabanpour 1b34246c6e Update MJX notebook to point to playground.
PiperOrigin-RevId: 716778081
Change-Id: Ic99734ba386c4db551766de6f209cb397e7aa967
2025-01-17 13:18:07 -08:00
Yuval Tassa 240a7afdee Add sensors for potential and kinetic energy.
PiperOrigin-RevId: 716775375
Change-Id: Ic8ab7f1a51df970ab551dabe7c797cde13cd97fd
2025-01-17 13:10:12 -08:00
Taylor Howell 688d367733 Modify model loading in MJX tutorial.
PiperOrigin-RevId: 716745232
Change-Id: Ib89f8c00a58b493c89f72c82b47f1c8ff8326536
2025-01-17 11:49:45 -08:00
Yuval Tassa 71e5e376bc Remove units from zero valued size in CSS, fix a typo.
PiperOrigin-RevId: 716345043
Change-Id: I22b28e8e1d6db8ae4e482541169f1ffc46d3db34
2025-01-16 12:55:21 -08:00