Commit Graph

719 Commits

Author SHA1 Message Date
Yuval Tassa ec94bb49aa Make constraint island discovery on by default.
Also fix latent bug in mjData serialization.

PiperOrigin-RevId: 799505349
Change-Id: I299e7cc8133fa2ec0b339a7ff3d02543e06778b1
2025-08-26 04:27:24 -07:00
Yuval Tassa 2b45b39ce5 Move mjtConstraint from mjmodel.h to mjdata.h.
PiperOrigin-RevId: 798987338
Change-Id: I3117742de7eb3c16366f266fe0c0651262717cb4
2025-08-24 23:45:14 -07:00
Yuval Tassa d77ecb3f06 Move mjtConstraintState from mjmodel.h to mjdata.h.
This is the correct location, this enum is only used in `mjData`, not `mjModel`.

PiperOrigin-RevId: 798860951
Change-Id: I48b9a2afc831bd9a6966cc9586429fd03605bdd2
2025-08-24 12:37:54 -07:00
Yuval Tassa 1c1bb14e1c Order fields in mjxmacro like in mjmodel and mjdata headers, add tests.
PiperOrigin-RevId: 798848000
Change-Id: Id1a41f6a0a4e3e6f3bb197f096061bd1d72a4b51
2025-08-24 11:17:30 -07:00
Yuval Tassa a230aa60c5 Improve mj_addM and associated test
- Updated docs to clarify that only the lower triangle is touched
- The function was unnecessarily adding the upper triangle in the sparse case
- The test used an unnecessarily large model and stepping it leading to timeouts under ASAN

PiperOrigin-RevId: 798528736
Change-Id: I592cc17dfb62379bb0cd6b332a8eb7e8b0ef6355
2025-08-23 03:56:47 -07:00
Google DeepMind a64a26c3ae No public description
PiperOrigin-RevId: 798355907
Change-Id: I3a225e3200cbc60ccc3d93f21694a606a7ab296a
2025-08-22 15:04:46 -07:00
Yuval Tassa 93c5665730 Add some missing Nullable annotations.
PiperOrigin-RevId: 798298579
Change-Id: I773eda7deca10c820345a33835716072e0b9af5a
2025-08-22 12:15:02 -07:00
Sam Haves 1fb1810b07 Add ability to specify a material assignment to a mesh asset.
This extends both the spec and the XML definition to allow specification of a material name on a mesh. This material acts as a fallback in the case that the referencing geom element does not specify a material of it's own.

PiperOrigin-RevId: 798232378
Change-Id: Iaf300c727732744ea1b613e64334ee505ac6e209
2025-08-22 09:11:31 -07:00
Google DeepMind 42d8454555 Internal change.
PiperOrigin-RevId: 798190254
Change-Id: Ie3a3b6e074511991cc6ccb35f2c26c6d9ae7ccd8
2025-08-22 06:41:49 -07:00
Google DeepMind ecfe65242f Add nullable attribute to AST nodes for function parameters in API introspection. Fixes #309
This change introduces an `nullable` flag to `ArrayType`, `PointerType`, and `FunctionParameterDecl`. The code generation process now parses function comments from `mujoco.h` to identify parameters marked as "Nullable" and sets this flag accordingly.

PiperOrigin-RevId: 797870883
Change-Id: Ic7cac5a7a9c14177fbf97b8655c5c4809d4ef683
2025-08-21 12:35:10 -07:00
Yuval Tassa 2f28473bc1 Remove transposed Jacobian fields from mjData
No longer computed unconditionally, only ad-hoc where required.

PiperOrigin-RevId: 797753297
Change-Id: I2030fc342c98ff33575b0526dd72e2110c4fcb74
2025-08-21 07:21:24 -07:00
Alessio Quaglino b66175eba6 Bending stiffness for curved shells in flex.
PiperOrigin-RevId: 796361841
Change-Id: I105ea235fe2a8e1bcbde67276d77fa92eed214a1
2025-08-18 04:13:18 -07:00
Yuval Tassa 6b41fbe72a Use CSR matrices for dof-dof index mappings
PiperOrigin-RevId: 795895311
Change-Id: I1000e0ee98906ef35990e73236e85d6354487b82
2025-08-16 13:06:32 -07:00
Yuval Tassa c0096b51a4 Move ntree to mjModel allocator sizes
PiperOrigin-RevId: 795855203
Change-Id: Idab185294d53dced9ebf073b782969dc5643b95a
2025-08-16 09:16:41 -07:00
Yuval Tassa 1447711037 Rename spec to sig in state-related API functions.
(to avoid confusion with mjSpec)

PiperOrigin-RevId: 795848898
Change-Id: I0b64eb85f5c7a3ee889a746c751d9f5561650277
2025-08-16 08:38:25 -07:00
Yuval Tassa 977f94e9df Delete sparsity structures from mjData, use the ones in mjModel
PiperOrigin-RevId: 795067950
Change-Id: If4f52e40ac49f7c6986b33ef9c8b534199dfd21a
2025-08-14 09:13:02 -07:00
Yuval Tassa 7eb13777f8 Put sparsity structures in mjModel, don't use them yet.
PiperOrigin-RevId: 795032051
Change-Id: I75c69e881980ff9c308acf00bb3a65f4b2ef12f5
2025-08-14 07:37:42 -07:00
Alessio Quaglino 07e7417d26 Add prefix to asset paths when appending specs.
PiperOrigin-RevId: 794966246
Change-Id: I4825a11cc3234e6f403340dd997742cea0e2183b
2025-08-14 03:48:56 -07:00
Alessio Quaglino eff4dda189 Suffix asset names when attaching specs.
PiperOrigin-RevId: 794717786
Change-Id: I02abe06ca3c43138e91e61f4acf87a26b3faf7fc
2025-08-13 13:43:16 -07:00
Alessio Quaglino cc52d0242b Do not strip the path when compiling an mjSpec.
The path has already been stripped while parsing. This will enable prefixes that contain a `/` while attaching.

Also use `spec.meshdir` for asset paths in `spec.to_zip()`.

PiperOrigin-RevId: 794573523
Change-Id: Ic36bb641c3d72848399006cf718afd8542e91ed4
2025-08-13 07:43:25 -07:00
Rishi Krishnan ed3ff15870 Update MuJoCo's version number following the 3.3.5 release.
PiperOrigin-RevId: 792806341
Change-Id: Ic68ecceacc48ddbd6b0c741ae8f0791551e1b4dd
2025-08-08 16:45:12 -07:00
Rishi Krishnan 3152458a6b Update Mujoco Deps in preperation for the 3.3.5 release
PiperOrigin-RevId: 792755404
Change-Id: I9776bb5e5bf2a891e0fa0fbf486875727e1d13b4
2025-08-08 14:07:00 -07:00
Yuval Tassa 249b0cd87d Improve field order and comments in mjdata.h
PiperOrigin-RevId: 792642328
Change-Id: I59330e228a111edec9e86d93d5cdf646b0fab00e
2025-08-08 08:52:35 -07:00
Saran Tunyasuvunakool 4e67fe79f3 Fix use of DYLD_FALLBACK_LIBRARY_PATH in mjpython.
According to `man dyld`, the default value for DYLD_FALLBACK_LIBRARY_PATH changed in late 2023. In newer binaries, if DYLD_FALLBACK_LIBRARY_PATH is not set, dyld will use /usr/local/lib and /usr/lib as fallback. If it is set, these locations will not be used as lookup paths unless explicitly added.

Fixes #2781

PiperOrigin-RevId: 791897707
Change-Id: I00d7e80bfbd5e5d7dbf2f601eaad4d9b0e1030f3
2025-08-06 16:53:25 -07:00
Saran Tunyasuvunakool 21a7ac7dd9 Change the license field in pyproject.toml to SPDX string.
According to the deprecation warning, support for the old way of declaring the license will be removed from setuptools on 2026-Feb-18.

PiperOrigin-RevId: 791716539
Change-Id: Iaf9ec55f9425380b017bd7ea370cd481ed01aa8f
2025-08-06 09:11:14 -07:00
Yuval Tassa 784c7a419b Improve builtin hemisphere docs
PiperOrigin-RevId: 791271829
Change-Id: I391215b5388f4e9e2a17198dbcdbd0c605fda4b4
2025-08-05 10:25:45 -07:00
Yuval Tassa 2f4375dda3 Add font_scale option to Renderer
PiperOrigin-RevId: 791213051
Change-Id: I22efd8d09637edbd9a4861132dfff3b46e9340bc
2025-08-05 07:50:20 -07:00
Yuval Tassa 705ec6d7fb Adds built-in superellipsoid mesh.
PiperOrigin-RevId: 791196831
Change-Id: I1d864f6e620870f016377a4d9e2e26d1a23fd77e
2025-08-05 07:02:52 -07:00
Yuval Tassa a5d4d1000e Add built-in supertoroid mesh.
PiperOrigin-RevId: 791180080
Change-Id: I3a70f50ff4a52a1bd4b88fc30334a574895145b4
2025-08-05 06:06:43 -07:00
Yuval Tassa 996f0040fd Add built-in sphere mesh.
PiperOrigin-RevId: 791162850
Change-Id: I573a414727e79f1a495e0f2282b2faff48ab3443
2025-08-05 05:05:05 -07:00
Yuval Tassa 5220767457 Add built-in hemisphere mesh.
PiperOrigin-RevId: 791148546
Change-Id: Ic9ff0c9b0f5fa4fd22d5f7f848f150cf74d378ba
2025-08-05 04:16:24 -07:00
Yuval Tassa a5a6379f83 Add built-in cone mesh type.
Also delete `prism` type since it is subsumed by cone.

PiperOrigin-RevId: 790992343
Change-Id: I7a9c6f2a4377489173acd64b23086c748d2cee8e
2025-08-04 19:35:32 -07:00
Yuval Tassa 32c7d3f085 Tag nullable arguments in main header. Fixes #309
Nullable arguments will be added to the `introspect` datastructures in a future change.

PiperOrigin-RevId: 789350522
Change-Id: I0bfd12fab5121f94b937264570f907593b63cf64
2025-07-31 08:39:16 -07:00
Matija Kecman 23fa7c00d5 Remove usage of size_t types in mjModel, use mjtSize (uint64_t) instead to improve portabilty of MJB files to WASM.
PiperOrigin-RevId: 789321991
Change-Id: Ic25fab876c347fc75f5ca24cad09e8fd972f035f
2025-07-31 07:08:33 -07:00
Alessio Quaglino 51babec9c5 Move tactile sensor to the engine.
PiperOrigin-RevId: 788863133
Change-Id: I3172ebb7641fa8146469da25cba7db794760e7b1
2025-07-30 05:27:44 -07:00
Alessio Quaglino 89f4789085 Add mjs_makeMesh to create a builtin mesh.
PiperOrigin-RevId: 788538127
Change-Id: I999733399a1a0da07b0f915f34d31364ab8b3b52
2025-07-29 11:31:18 -07:00
Yuval Tassa 46dc67b7eb Add function mjs_sensorDim to user API.
Note: change to (unreleased) contact sensor mjSpec API
PiperOrigin-RevId: 788507423
Change-Id: Ie639afb7ed01dc3f7bab43a3e812e8e0b0c67d07
2025-07-29 10:20:27 -07:00
Yuval Tassa a771fc6c09 Increase mjNSENS to 3
PiperOrigin-RevId: 788468705
Change-Id: Id22f131bebb6accc9a29c9aa285efa75fa8b2c16
2025-07-29 08:38:13 -07:00
Yuval Tassa 9e7979e492 Add checks for contact sensor when constructing with mjSpec Python bindings.
PiperOrigin-RevId: 788008233
Change-Id: I14518b8cce1a7dad4fd24933478e0cc1bb75e350
2025-07-28 07:50:56 -07:00
Yuval Tassa 83435361fa Increase max points in 2D plot from 1000 to 1001.
PiperOrigin-RevId: 787513580
Change-Id: I573c779932fa7411b132020213637a25fa859844
2025-07-26 12:46:31 -07:00
Sam Haves 7da32d186f Add basic visual material parsing support to USD interop.
For this first iteration we only support simple UsdPreviewSurface spec node graphs.

PiperOrigin-RevId: 786309455
Change-Id: I2e5501a65b22aca6da570bc94394514c67bd100a
2025-07-23 09:21:56 -07:00
Google DeepMind 4f43a7d08e fix typo in bindings_test.py
PiperOrigin-RevId: 785536018
Change-Id: I06dd65c65c12e92d354d900a8046b38c0c5de8d3
2025-07-21 12:37:23 -07:00
Alessio Quaglino fc13995dd4 Yield ownership of vector<double>, vector<float>, and vector<int> to mjSpec in Python bindings.
Fixes #2756

PiperOrigin-RevId: 785417251
Change-Id: Ib399c46ee59585258ace7d9583c68b7d06d0a9e4
2025-07-21 06:44:17 -07:00
Alessio Quaglino 60f9b34a77 Validate the MjModel pointer passed to MjData constructor.
Fixes #2426.

PiperOrigin-RevId: 785411895
Change-Id: If698120b5a4ab4ac457d35760380c140b1b5a208
2025-07-21 06:23:52 -07:00
Yuval Tassa 5e666635f6 Remove mjtVisFlag.mjVIS_FLEXBVH and mjvOption.oct_depth
PiperOrigin-RevId: 783355711
Change-Id: I1e11999d5c533925f1d07266aeca95598a5691ba
2025-07-15 09:08:22 -07:00
Yuval Tassa d0e4771c8c Add contact sensor.
PiperOrigin-RevId: 783011982
Change-Id: Ica56fe9d520fa1d1ee7338e09148b1a55a049912
2025-07-14 13:03:35 -07:00
Alessio Quaglino 6e7aaacb85 Do not rely on global object lists in mjCBody::NextChild().
PiperOrigin-RevId: 782963753
Change-Id: I0afecbab4b7796f077963ba66eb7140d8f83ad89
2025-07-14 10:47:45 -07:00
Alessio Quaglino 9a41d385c1 Add needsdf flag to mjsMesh.
PiperOrigin-RevId: 782949528
Change-Id: Iaa96326a91795c3469c991bd8def53560b38e4f0
2025-07-14 10:13:05 -07:00
Rishi Krishnan 3c99705f85 Update MuJoCo's version number following the 3.3.4 release.
PiperOrigin-RevId: 781596261
Change-Id: Iac050c4b9cb65542b52fa6b8c54ff2537bc6a648
2025-07-10 10:47:26 -07:00
Alessio Quaglino 96118da08b Move SDF precomputation to the mujoco compiler.
Before:
```
 Simulation time      : 2.24 s
 Steps per second     : 4472
 Realtime factor      : 8.94 x
 Time per step        : 223.6 µs

 Newton iters / step  : 2.47
 Contacts / step      : 3.37
 Constraints / step   : 13.49
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

After:
```
 Simulation time      : 1.71 s
 Steps per second     : 5854
 Realtime factor      : 11.71 x
 Time per step        : 170.8 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

PiperOrigin-RevId: 781075182
Change-Id: Ie509047ff581ab0df4b10bbd394c27d350ab5a13
2025-07-09 08:57:09 -07:00