Commit Graph

4366 Commits

Author SHA1 Message Date
MatiasManevi b35a5bab5e Shorten mv instruction 2026-03-18 12:10:08 -03: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 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
Copybara-Service 910fbbb111 Merge pull request #3141 from ocadotechnology:recompile-release-gil
PiperOrigin-RevId: 883109831
Change-Id: I75c22ec071aae8f78b8354de40d8f58e8e952a50
2026-03-13 05:25:45 -07:00
Matija Kecman 86aae0f5a5 Use user::ThreadPool for actuator lengthrange calculation in addition to mesh and texture compilation
PiperOrigin-RevId: 883099169
Change-Id: Id6832c2ca0b8f45e2f428615ae54df4b8bb6f434
2026-03-13 04:54:57 -07:00
Copybara-Service 1704f51df6 Merge pull request #3174 from MatiasManevi:fix-wasm-package
PiperOrigin-RevId: 882626629
Change-Id: Iecb61e39f3e994d7b64cec9492ae35e6a1194f9c
2026-03-12 09:14:51 -07:00
Haroon Qureshi 7f437810fd Move MjrRect pybind11 definition to structs.cc.
mjrRect is a common type that will be re-used across different
rendering APIs, not just mjr_ APIs.

PiperOrigin-RevId: 882620060
Change-Id: I7f77ac9298c52c454d94c46379ff5270fd833f26
2026-03-12 09:00:39 -07:00
MatiasManevi a07763f13b Restore npm pack 2026-03-12 11:42:29 -03:00
MatiasManevi 8c3e70998d Fix npm publish command to work with OIDC 2026-03-12 11:39:59 -03:00
Google DeepMind b294d15558 Add from_xml_string to MuJoCo WASM bindings.
This change introduces new functions to load an `mjModel` from an XML string. Two overloads are provided: one that creates a temporary VFS and one that uses a MjVFS arg.

Also updated other places where `from_xml_string` should be used: demos, readme, etc.

PiperOrigin-RevId: 882581762
Change-Id: I8428196f8f56ae9630fcd4f0bb6763cdc1c43da0
2026-03-12 07:35:47 -07:00
Google DeepMind df0bc58578 Add aliases for MjModel loading functions and expose string constants as properties.
Introduces `from_xml_path` and `from_binary_path` as more idiomatic aliases for `mj_loadXML` and `mj_loadModel` respectively. Refactors the binding of `mj*STRING` constants. Instead of exposing `get_mj*STRING` functions, these constants are now available as properties on the `Module` object. Runtime getters are added via EM_ASM to lazily call the underlying C++ functions.

PiperOrigin-RevId: 882566011
Change-Id: Id3bd5c23704fd122af30a50aed089bd3143fbc96
2026-03-12 06:58:50 -07:00
Copybara-Service a62501f305 Merge pull request #3168 from MatiasManevi:npm-workflow-dispatch
PiperOrigin-RevId: 882559989
Change-Id: Ia02f38e632dcd3064433b44f6e14427aa3b36735
2026-03-12 06:43:37 -07:00
Haroon Qureshi b62aed86f9 Recreate swap chain when the window size changes.
PiperOrigin-RevId: 882521107
Change-Id: I0d29d2e323e7830256c24eead439b3f2eb55de40
2026-03-12 04:56:50 -07:00
Copybara-Service 4d0c4666db Merge pull request #3169 from MatiasManevi:npm-pkg-name
PiperOrigin-RevId: 882503732
Change-Id: I20494c3258ba39f382483e82934964472603aa17
2026-03-12 04:07:12 -07:00
Haroon Qureshi 16d618e7b9 Ensure we have a valid vfs when loading a spec.
PiperOrigin-RevId: 882503274
Change-Id: Iddbd6f00c0344bb34d68bb72a640c0a8e81076a2
2026-03-12 04:06:05 -07:00
Copybara-Service 99af6fb9a5 Merge pull request #3167 from MatiasManevi:npm-auth-mechanism
PiperOrigin-RevId: 882500557
Change-Id: Iaa81896c82bac7bf332eefce950ed38c6d4f489d
2026-03-12 03:59:43 -07:00
Sam Haves 3601b063dc Modify mjCMesh vert_ field to be vector<float> instead of vector<double>.
PiperOrigin-RevId: 882162404
Change-Id: Ia97439420f284d594f5cb1a91cd0fb640ac8dff0
2026-03-11 13:15:32 -07:00
MatiasManevi c1586cc86f Change package name to scoped 2026-03-11 15:22:36 -03:00