Commit Graph

4381 Commits

Author SHA1 Message Date
Yuval Tassa c348bc9f4c Disable clang-format for MuJoCo public headers and engine source.
PiperOrigin-RevId: 886720463
Change-Id: I7c89fa99bee0598dcf48807bfbd61ee8bf8fa9b8
2026-03-20 05:06:15 -07:00
Michael Moss 904744bd72 Fix --gc-sections linking error on github macos-15-x86_64.
This forces `CMAKE_REQUIRED_FLAGS` to be treated as a string instead of list,
so none of the args get dropped when passed through `check_c_source_compiles`.

PiperOrigin-RevId: 886717366
Change-Id: I6314f9bfabd9d62bdcad5070c8801c453c381b79
2026-03-20 04:57:54 -07:00
Michael Moss 02d1d3d503 Fix call_guard usage inside .def_property calls.
See also [PR #5533](https://github.com/pybind/pybind11/pull/5533).

PiperOrigin-RevId: 886714838
Change-Id: I8c98461098ccf4958fb18bdcb5acc293c988c258
2026-03-20 04:50:50 -07:00
Yuval Tassa 9fa3f6f77e Enable float32 testing for most MuJoCo engine and user tests.
PiperOrigin-RevId: 886697701
Change-Id: I4a96fae03ea18494c3fcef8eb17b3b6f0863e9b7
2026-03-20 04:05:06 -07:00
Copybara-Service cab4b73f41 Merge pull request #3184 from MatiasManevi:single-thread-npm
PiperOrigin-RevId: 886334046
Change-Id: If054286ac11f2b0e13e770922c049e334d136ab1
2026-03-19 13:05:52 -07:00
Haroon Qureshi 6134fe48d9 Enable shadows depending on render settings.
PiperOrigin-RevId: 886236214
Change-Id: I6999e52ff3d9fc0734082312a77d6c033b69a24b
2026-03-19 09:59:50 -07:00
Haroon Qureshi eae31f0b3c Use model's num_quads for generating planes.
PiperOrigin-RevId: 886228541
Change-Id: I693f85edd84e4e1b1db6a932d4479888426bcae4
2026-03-19 09:44:53 -07:00
Michael Moss 779f6e8403 Save some CMake logs for debugging.
PiperOrigin-RevId: 886222847
Change-Id: Iaa641c334b3e90f594c6a19a29beefcf6eb7a3f4
2026-03-19 09:32:41 -07:00
Haroon Qureshi 7c63bcc8f3 Move Render logic into the Scene/Gui View classes.
This is in preparation for an upcoming change.

PiperOrigin-RevId: 886203890
Change-Id: I91eba35b394898d942f66f75e947c450b924a973
2026-03-19 08:50:41 -07:00
Taylor Howell 57bdf89d07 Import google-deepmind/mujoco_warp from GitHub.
PiperOrigin-RevId: 885715192
Change-Id: I13fcb8312c1515bb1bd2d6cdfd0d256e37cb74de
2026-03-18 11:58:25 -07:00
Kyle Bayes eec6e43a73 Bit compress face vertices in EPA to reduce memory needed. The parameter ccd_iteration is only supported to 1000, so we only need 10 bits for vertex index.
PiperOrigin-RevId: 885690198
Change-Id: I4c6af170ddc86316d3e9cfaf7ca7e0e4fac8a416
2026-03-18 11:10:14 -07:00
MatiasManevi b1c7ae1c19 Restore PTHREAD flag 2026-03-18 13:13:05 -03:00
MatiasManevi 9561decf64 Remove PTHREAD flag 2026-03-18 13:04:04 -03:00
MatiasManevi b35a5bab5e Shorten mv instruction 2026-03-18 12:10:08 -03:00
Alessio Quaglino e57d95e68f Remove vertcollide attribute from flex contact.
The `vertcollide` attribute in flex and flexcomp contact specifications has been removed since the next mjWarp release will support flex collisions. This attribute was previously used to enable vertex-based collisions by adding sphere geoms at flex vertices. The functionality associated with this attribute has been deprecated and removed from the XML parser, documentation, and internal data structures. Affected example XML files have also been updated.

PiperOrigin-RevId: 885595503
Change-Id: I6a78975f1bc540c09ea8b5306ff3be0962b7ab24
2026-03-18 07:59:57 -07:00
MatiasManevi 65d8d26af6 Add newline 2026-03-18 11:50:06 -03:00
MatiasManevi b694e9e951 Change caution for note 2026-03-18 11:49:19 -03:00
MatiasManevi aa07cdde5c Add documentation 2026-03-18 11:48:11 -03:00
MatiasManevi 8b7951c20c Add single threaded version 2026-03-18 11:18:41 -03:00
Sam Haves ef78f07ffb Automated g4 rollback of changelist 885555524.
*** Reason for rollback ***

Rolling back obj/stl decoder inclusion as sources due to broken windows build.

*** Original change description ***

Include obj and stl decoder plugins as sources in CMake builds.

This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

***

PiperOrigin-RevId: 885576586
Change-Id: I31e6fa4d10697862f7d800d0d771ca752747e36d
2026-03-18 07:18:19 -07:00
Sam Haves 15ca42ff68 Include obj and stl decoder plugins as sources in CMake builds.
This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

PiperOrigin-RevId: 885555524
Change-Id: I20aa5b6c55b678398345d49cb1c47667ae2bebcf
2026-03-18 06:23:26 -07:00
Matija Kecman f1715e67bd Fix studio web so that single file xml model can be loaded in a single-threaded wasm build
model_holder.cc modified to disable multi-threaded compilation for WASM builds. index.html `animate()` function modified so the animation rendering loop executes asynchronously with async/await calls. These changes are sufficient to make xml files without references work (e.g., humanoid.xml), more work is needed to make the vfs work so multi-file models can load.

PiperOrigin-RevId: 885537402
Change-Id: I3469cae48e7268073be334b99bf907c5ed8c27a7
2026-03-18 05:31:29 -07:00
Haroon Qureshi b0c48ba846 Planes should not receive shadows when rendered from behind.
Also refactors Renderables a bit to allow for additional use-cases.

PiperOrigin-RevId: 885527587
Change-Id: I4b17e097256de0356151a6d087bc01f11e3071b7
2026-03-18 05:05:21 -07:00
Haroon Qureshi 3f77daa27a Support wireframe rendering.
PiperOrigin-RevId: 885508978
Change-Id: I97216a120f4fede62924819cfb5cef5693adc7f8
2026-03-18 04:13:24 -07:00
Haroon Qureshi bc1f9513be Add flag for software rendering.
This flag is currently unused.

PiperOrigin-RevId: 885453938
Change-Id: Ia2112410ff12c7b18ad154f18887d4d795bafa3d
2026-03-18 01:48:15 -07:00
Tom Erez 60be42e83c Replace autowrap C# binding generator with introspect-based codegen.
This CL replaces the header-parsing autowrap system for generating
MuJoCo C# bindings (MjBindings.cs) with a new generator that uses
the mujoco.introspect module. The new generator reads pre-parsed
API data from introspect's enums, functions, and structs modules
instead of parsing C headers directly.

Changes:
- New: generate_cs_bindings.py in third_party/py/mujoco/codegen/
- Updated: genrule in unity/mujoco/BUILD to use codegen
- Updated: MjBindings.cs regenerated from codegen
- Removed: entire autowrap/ directory (9 files)
- Removed: transitional validate_codegen.py

The validate test continues to verify that the genrule output
matches the checked-in MjBindings.cs.

PiperOrigin-RevId: 885206129
Change-Id: Ib9fb883a2242dd2c039033eadee7a4a6ac91ed55
2026-03-17 14:19:49 -07:00
Yuval Tassa 206e245353 Internal change.
PiperOrigin-RevId: 885152209
Change-Id: I56941ba443fe3daad02eff39d6dbcaa9615df41b
2026-03-17 12:29:37 -07:00
Copybara-Service c0ab1cc130 Merge pull request #3178 from thowell:mjwarp_docs_mjlab_distributed_training_link_update
PiperOrigin-RevId: 885051946
Change-Id: Ib2473764a0d02924d73acccf59fc7a1236f5d8d1
2026-03-17 09:03:32 -07:00
Yuval Tassa 9d3ee5a948 Improve ASAN poisoning logic in mj_freeStack.
When freeing a stack frame, only poison the newly-freed memory region
`[old_top, new_top)` instead of the entire region `[limit, top)`. The old
code redundantly re-poisoned already-poisoned memory on every
`mj_freeStack` call.

Benchmarking `engine_forward_test` under ASAN:
- Before: 99.3s
- After:  75.6s  (~24% faster)

PiperOrigin-RevId: 885035750
Change-Id: Ib195661ca337d13c5ff6094bcc107c4c0a617b9b
2026-03-17 08:26:39 -07:00
Matija Kecman c420a6e1ca Fix resizing the window when running single threaded
This was affecting code running in the browser using WASM

PiperOrigin-RevId: 884921901
Change-Id: I13e634452275927f58a63179cdf140780852be2f
2026-03-17 03:32:35 -07:00
Matija Kecman 4be4a539c4 Fix "Selected backend not supported in this build" error when running using WASM
PiperOrigin-RevId: 884908229
Change-Id: I5515d1ffe8e7a4fd1f3c1eeee11a7f24196be780
2026-03-17 02:57:45 -07:00
Haroon Qureshi 9a0dd7d32d Make planes semi-transparent from behind.
PiperOrigin-RevId: 884896612
Change-Id: I00cc53e539fd1abccb43c7c6b89a7e063cb4848c
2026-03-17 02:27:34 -07:00
Taylor Howell 9d8004f60d mujoco warp documentation: update mjlab distributed training link 2026-03-16 20:26:34 +00:00
Yuval Tassa efae9157a7 Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
PiperOrigin-RevId: 884607673
Change-Id: If8088dbf37fed1055304778a7eb84dec52cba920
2026-03-16 13:25:25 -07:00
Alessio Quaglino aec1b45dce Remove unnecessary const from grad parameter in strain Jacobian functions.
The `grad` parameter in `volumetric_dSdx` and `invariant_dSdx` is not modified, but the `const` qualifier was inconsistent with how the array was being passed, requiring an unnecessary cast. Removing the `const` simplifies the function signatures and calls.

PiperOrigin-RevId: 884598322
Change-Id: Icac8071aa8e838057dd39c979c23a4f47e1dc22d
2026-03-16 13:04:00 -07:00
Alessio Quaglino ac2730ab80 Change flex strain constraints for trilinear to a more stable formulation.
This change improves trilinear flex elements by using reduced integration for volumetric quantities (strain trace and volume ratio) at the element center, while adding full integration for shear components at 8 Gauss points and removing the second strain invariant from the constraints, which is negligible for small strains. This reduced integration "B-bar" technique is standard in finite element analysis and prevents artificial stiffness that can occur when low-order elements are nearly incompressible. The constraint count per trilinear element changes from 24 to 26 compared to using invariants. For quadratic elements, the full 27 quadrature point are used resulting in 162 constraints.

PiperOrigin-RevId: 884570752
Change-Id: Ib74ece8f4712c2c81fbfd784524fcac52a2c80e5
2026-03-16 12:05:16 -07:00
Sam Haves a5098a068a Update changelog for upcoming release.
PiperOrigin-RevId: 884479074
Change-Id: I086420505a047406c6bc36fc293c9722d9b41405
2026-03-16 09:23:13 -07:00
Yuval Tassa 1f2587fe3e Make preprocessor checks for ADDRESS_SANITIZER compatible with GCC
PiperOrigin-RevId: 884468086
Change-Id: I5742f023689fd8cc1747df1af5f0a9687a0e77ac
2026-03-16 09:03:52 -07:00
Taylor Howell bb38a34869 Skip shared dofs for contact constraints
PiperOrigin-RevId: 884455239
Change-Id: I7ee36a13c28be88e12380b4790f150ad62f268c1
2026-03-16 08:36:58 -07:00
Yuval Tassa eca5758bf9 Define ADDRESS_SANITIZER portably using standard compiler macros
Use `__SANITIZE_ADDRESS__` (GCC) and `__has_feature(address_sanitizer)` (Clang)
to define ADDRESS_SANITIZER when the toolchain doesn't provide it natively.

Fixes #3160

PiperOrigin-RevId: 884447485
Change-Id: I48ef51bca8f5c5f15f62089e73cd8fa649723636
2026-03-16 08:18:11 -07:00
Taylor Howell 63bab26536 MuJoCo Warp documentation: CCD margin
PiperOrigin-RevId: 884410781
Change-Id: I61171639503ce2a08c79c0e99ed5ebc09c36bf63
2026-03-16 06:49:32 -07:00
Yuval Tassa c651a0daeb Merge friction and limit constraint counting into instantiation functions.
PiperOrigin-RevId: 884379952
Change-Id: I23605f3e5ada0ed0fbdcf3e1903f54788700e2d3
2026-03-16 05:23:20 -07:00
Yuval Tassa a47a18dd28 Rollback of 1cda1e7a8c, fixes #3163
Note this change re-opens issue #2472

PiperOrigin-RevId: 884378131
Change-Id: Ifefc345f1a296e5245cbb10047bb678ffea3598f
2026-03-16 05:17:43 -07:00
Yuval Tassa 55f5ac0a1d Remove mj_jacDifPairCount by incorporating the counting into mj_jacDifPair
PiperOrigin-RevId: 884366070
Change-Id: I7490ca205a315bc661414e32c91ad1ec753a8fe7
2026-03-16 04:44:59 -07:00
Yuval Tassa 50dfc255b8 Fix pybind11 v3.0 compatibility in callbacks.cc
PiperOrigin-RevId: 884074529
Change-Id: I20e7a8d6f6069895afbc3e18d0612f3b2edfaeb7
2026-03-15 12:46:11 -07:00
Baruch Tabanpour 7324864366 Add random seed to SensorTest to prevent flakiness.
PiperOrigin-RevId: 884055306
Change-Id: Ia053d2661ed30835e66a145659c1e1b7275ab251
2026-03-15 11:23:44 -07:00
Haroon Qureshi 28def7d25d Internal changes.
PiperOrigin-RevId: 883932254
Change-Id: Ic93097dde6425e7de00001b8d74ecc61adcde321
2026-03-15 03:38:34 -07:00
Kyle Bayes 88ba8ffdbc Remove const qualifier on mjData in mjfCollision type as mjData is non-const in mjc_SDF via mjpPlugin.
PiperOrigin-RevId: 883225786
Change-Id: I5fecaa1d575b340a6510212db7b3e7db48f361cc
2026-03-13 10:21:53 -07:00
Google DeepMind 7ec4fe2c50 Refactor: Update MuJoCo WASM README structure
Reorganize the README to clearly separate the "User Guide" (including npm installation) from the "Build from source" instructions.

Also added npm install instruction.

PiperOrigin-RevId: 883180811
Change-Id: I874b101c941d3a2fbff8995fb7e4d104e6f4fec2
2026-03-13 08:34:38 -07:00
Haroon Qureshi b18657acde Remove unused flag.
PiperOrigin-RevId: 883113888
Change-Id: I098669f8a873694903159649567bc2f68397f955
2026-03-13 05:37:47 -07:00