Commit Graph

3635 Commits

Author SHA1 Message Date
Haroon Qureshi 2c2773e36d Include third_party_deps cmake files.
PiperOrigin-RevId: 828957097
Change-Id: I2aeea2ae9e2621c8c62a34095af6ea8fd0797f08
2025-11-06 08:02:28 -08:00
Google DeepMind b807d5f852 Remove MjVFS from generated Emscripten bindings.
PiperOrigin-RevId: 828943991
Change-Id: I681079854c71059392518c328a4488bb47127433
2025-11-06 07:20:11 -08:00
Sam Haves 8051f40817 During mj_parse, if mju_openResource fails pass a resource with only the filename to decoders.
This enables decoders to leverage their own file resolution systems. For example: USD can compose a stage (scene) from memory, via a file on disk, or via custom asset resolver.

Passing it through to the decoder reduces the need for custom resource providers that wrap these other resolution systems.

This will also enable a fun, but likely niche usecase where the decoder does procedural generation and does not have to be backed by a resource. See the tests for an example of this.

PiperOrigin-RevId: 828939899
Change-Id: Ic319a685332d91198a4ae926867c834bf7f7f724
2025-11-06 07:06:06 -08:00
Taylor Howell 89fec8f7b2 MuJoCo Warp documentation: Performance Tuning.
PiperOrigin-RevId: 828908430
Change-Id: Iece454fce7dea71df2a5b6f60d81b611c5a3730d
2025-11-06 05:20:19 -08:00
Baruch Tabanpour d0f32a7fe6 Modify mjx.Model tex_data type.
PiperOrigin-RevId: 828606695
Change-Id: I708dcf8e75766bf16d339999a9e8c70c8f65fd0c
2025-11-05 13:33:11 -08:00
Baruch Tabanpour c34ac712a0 Import warp-lang 1.10.0.
PiperOrigin-RevId: 828583884
Change-Id: Ia1c6d8c41fa0785360b85287cab562228fcc80cf
2025-11-05 12:35:25 -08:00
Google DeepMind 3577c98f82 Refactor Emscripten bindings generation for MuJoCo structs.
PiperOrigin-RevId: 828550215
Change-Id: Iab0bf3a9fbaca4d7774f89a4d8977e762aa57629
2025-11-05 11:14:29 -08:00
Google DeepMind 8104235f8e Generate wrappers for anonymous structs within mjVisual.
PiperOrigin-RevId: 828548681
Change-Id: I07f8b407157b91ac24b38604b20826541e20e23e
2025-11-05 11:10:52 -08:00
Google DeepMind c3858f267a Change default values of WrappedFieldData string fields to empty strings.
PiperOrigin-RevId: 828547058
Change-Id: I0dc0f993cd93a8feab3f1a53b7ee6c47266093e0
2025-11-05 11:07:29 -08:00
Google DeepMind ff0ae09bc4 Remove debug printing functionality from WASM codegen.
PiperOrigin-RevId: 828545426
Change-Id: I136e6290c7ffdd4c2029aaf72cb90e0fc3cc7a9f
2025-11-05 11:03:28 -08:00
Haroon Qureshi 01b0ea5b7d Use webgl backend in emscripten builds.
(Also only display the model name if its a file.)

PiperOrigin-RevId: 828498906
Change-Id: I7def85992f413b321c115ea63db2af057f5fd372
2025-11-05 09:17:34 -08:00
Haroon Qureshi 8b7eb097db Remove Sync and Scene functions from Renderer.
PiperOrigin-RevId: 828481721
Change-Id: Id0399139653b0ec27f0d365437e62cadefadfe6c
2025-11-05 08:33:28 -08:00
Taylor Howell 17d36d8e75 MuJoCo Warp documentation: `naconmax`.
PiperOrigin-RevId: 828478607
Change-Id: I90e8b95cf5b869ba60a731b3d2ee962c411da943
2025-11-05 08:24:25 -08:00
Haroon Qureshi 30a99de3b9 Remove dependencies on mjvScene for interactions.
Interactions (like moving the camera or mouse picking) no longer depend
on needing an mjvScene. Instead, everything is done relative to the
camera directly.

This duplicates some code in engine_vis_visualize which we will try to
resolve and recombine at a future time.

PiperOrigin-RevId: 828461259
Change-Id: If26329c1a7c37516f0213b18056c3e31760f60ae
2025-11-05 07:33:42 -08:00
Yuval Tassa 2245210e87 Fix formatting error in the 3.3.6 changelog
PiperOrigin-RevId: 828455246
Change-Id: I6cd08f7819bde27c32ddd1ff56cbd9b23b92134d
2025-11-05 07:17:47 -08:00
Yuval Tassa d5e953e707 Use sphinx.ext.extlinks for GitHub issue and PR links.
Added `sphinx.ext.extlinks` to the Sphinx configuration and defined `extlinks` for `:issue:` and `:pr:` roles, pointing to the MuJoCo GitHub repository. Updated `changelog.rst` to use these new roles, replacing `:github:issue:` and `:github:pull:` which are currently failing.

Also fix a formatting bug in the 3.3.7 changelog

PiperOrigin-RevId: 828403002
Change-Id: I7f0134e4dd555fc59a3fee090338de56aababe1c
2025-11-05 04:12:08 -08:00
Google DeepMind fe1b6b7c80 Refactor: Group autogenerated structs source in bindings.cc
This change modifies the code generation for structs in `bindings.cc`. Instead of placing each struct's constructor and member functions under individual markers, all autogenerated struct source code is now grouped together under a single `// {{ AUTOGENNED_STRUCTS_SOURCE }}` marker. This improves the organization of the generated file and simplifies the template.

Future work would move the rest of the structs into this pattern

PiperOrigin-RevId: 828390272
Change-Id: Iee9d0e8766db86b2c1d4296a37ac7a8e6e05428b
2025-11-05 03:26:09 -08:00
Google DeepMind 5b00b033af Refactor struct dependency sorting to use wrapped field data.
The `sort_structs_by_dependency` function now takes a dictionary of `WrappedStructData` and uses the pre-computed `typename` within `WrappedFieldData` for dependency analysis, instead of re-introspecting the AST. This change also includes populating the `typename` in various `WrappedFieldData` generation methods.

PiperOrigin-RevId: 828389481
Change-Id: Ie97c1a66e5e69bd148a928fda26afdaa09f56687
2025-11-05 03:23:35 -08:00
Matija Kecman 29c1a3a0a5 Cleanup WASM bindings generators so they all have a similar interface
PiperOrigin-RevId: 827965451
Change-Id: I657fc4d3a480fbc62124c84fe9ddc0900a91183f
2025-11-04 07:32:32 -08:00
Matija Kecman 776fc32eb4 Cleanup WASM bindings struct generation
PiperOrigin-RevId: 827949686
Change-Id: I4115e397f64963244e3c30a7eaff5be7534aadf2
2025-11-04 06:44:02 -08:00
Matija Kecman 4b79a58fa0 Add convenience methods to CodeBuilder and cleanup some WASM bindings code generation
PiperOrigin-RevId: 827916844
Change-Id: Ie382f2a5af3d7e3ec2c81cde5d6b768835da2365
2025-11-04 05:02:59 -08:00
Adrian Collister 740afe22b3 Append warnings to model compile errors.
PiperOrigin-RevId: 827903480
Change-Id: I2ad17bf4cea0dae0ab803fbb7baa9bd70eef303d
2025-11-04 04:15:07 -08:00
Matija Kecman 34e5eecba5 Autogenerate more of mjVFS and mjvGeom WASM bindings
PiperOrigin-RevId: 827898643
Change-Id: I95f9eaa129f663cbeb3606d286c2080c47cfbcc4
2025-11-04 04:00:13 -08:00
Matija Kecman f808632cf8 Rename WASM bindings function helper file
PiperOrigin-RevId: 827897836
Change-Id: Ifb13ebaf54dacabc2a3ed8a8ea4244ecea2a8f41
2025-11-04 03:57:03 -08:00
Matija Kecman 12a31674a3 Consolidate WASM bindings struct generator helper files into helpers/structs.py
PiperOrigin-RevId: 827889180
Change-Id: I5f8bf0e25d1af7b21b554672bd438bbcd04e62be
2025-11-04 03:23:24 -08:00
Matija Kecman 9b71fc728d Consolidate WASM bindings test files
PiperOrigin-RevId: 827888382
Change-Id: I4ded54cd49182de0b4243770e2507038ad6fac7a
2025-11-04 03:19:35 -08:00
Matija Kecman 2018b8c494 Disable WASM bindings benchmarks on Github CI
Updated the wasm/README.md to describe how to manually run the benchmark tests.

PiperOrigin-RevId: 827881670
Change-Id: I1d524851d9f3f8182ecbfcc649bb9a5a61d716ae
2025-11-04 03:00:29 -08:00
Matija Kecman 3d59b20b65 Simplified struct code generation for WASM bindings
PiperOrigin-RevId: 827878780
Change-Id: I97ab732eb11c63a6aaf7fa95add0b51bc0a56525
2025-11-04 02:51:11 -08:00
Matija Kecman c22d94e470 Various minor cleanups to WASM code generation
* Add newline function to code_builder
* Remove type aliases which made jump to definition less ergonomic
* Add types to constants

PiperOrigin-RevId: 827863199
Change-Id: Ib4390d398926466ecce491a3d0ebe308ed5e0cbe
2025-11-04 02:07:27 -08:00
Matija Kecman 10130297c0 Consolidate WASM bindings into a single C++ file.
PiperOrigin-RevId: 827850819
Change-Id: I23e099d4e72557d79354339953246ac4eeee7ca3
2025-11-04 01:37:32 -08:00
Sam Haves 7d7648f7ed Update UsdWriter to write any parts of MjSpec that are not from USD to the EditTarget.
This enables two workflows:
1) Users that parsed some other format into MjSpec, or built it programmatically can export animated USD easily with as minimal as possible interaction with USD.

2) Creating a spec from USD, then modifying the spec, should not cause a duplication of data when writing to USD.

PiperOrigin-RevId: 827627520
Change-Id: I02c8c14a18569547710e54f3704d52ac0bf70ce6
2025-11-03 13:29:46 -08:00
Yuval Tassa abc02b736e Minor fixes to viewer diagnostics
- When `mjData.nefc` was 0 (solver not run at all), we were plotting the stale diagnostics from the last run; now fixed.
- In the case where islands were used, the semantic of the plotted diagnostic `sqrt_nnz` (square root of Hessian nonzeros) is changed. It used to be the sum of square roots of solver nonzeros per island, it is now the square root of the sum of all nonzeros in all islands. The semantic `sqrt(sum(nnz_i))` was found to be more consistent than `sum(sqrt(nnz_i))`, in the sense that switching islanding on/off leads to smaller changes and is more in line with the interpretation of islanding as [block-diagonalization](https://mujoco.readthedocs.io/en/3.3.7/computation/#constraint-islands).

PiperOrigin-RevId: 827624908
Change-Id: I5fc86364ead585a4752a6d44823fb75cf6c7c318
2025-11-03 13:23:05 -08:00
Baruch Tabanpour 501e561563 Import NVIDIA/warp from GitHub.
PiperOrigin-RevId: 827602811
Change-Id: I42f96098df4665de60065409b454688f92e976d1
2025-11-03 12:24:28 -08:00
Sam Haves 9319956a16 Modify mujoco_to_usd to operate on SdfLayer intead of SdfAbstractData.
Since we don't do any on demand data loading for USD and always convert everything it should be safe to use the SdfLayer API instead of the SdfAbstractData API. This enables other codepaths such as the USD writer class to reuse the same logic to generate USD specification from an mjSpec.

PiperOrigin-RevId: 827431722
Change-Id: I60a581e0c9577164a4a66229ea9dcb8912afcf74
2025-11-03 04:16:37 -08:00
Alessio Quaglino 3a7aa84e53 Add quadratic stiffness to flex.
PiperOrigin-RevId: 827409919
Change-Id: I3dff8ea49fb1726fec4acf5b91138d6d52c4bfba
2025-11-03 03:01:38 -08:00
Taylor Howell d4f13b4abc Update mjwarp/index.rst.
PiperOrigin-RevId: 827397313
Change-Id: I427a0476eb1530b53539d787c0b79aaf45f889d5
2025-11-03 02:18:56 -08:00
Yuval Tassa ad49733db2 Improve error message for insufficient arena memory in _realloc_con_efc.
PiperOrigin-RevId: 826845370
Change-Id: I09467dd44a6f9f01b89ff6c1d74cde493e84eb1c
2025-11-01 05:54:56 -07:00
Taylor Howell f604588a36 Update theme_overrides_mjwarp.css to not render return type information.
PiperOrigin-RevId: 826821680
Change-Id: I2d8a08755631b85f910051ea395ae9081d4e3759
2025-11-01 03:59:42 -07:00
Erik Frey fbb95d5e8c Import NVIDIA/warp from GitHub.
PiperOrigin-RevId: 826571491
Change-Id: I294abc5aa3714345ab295636d12428293ea69285
2025-10-31 11:47:29 -07:00
Matias Manevi 4086261714 Add JavaScript bindings and WASM support
Co-authored-by: Matija Kecman <matijak@google.com>
Co-authored-by: Sebastian Noreña Rendón <sebas.norena@creativa77.com.ar>
Co-authored-by: Kyle Bayes <kylebayes@google.com>
PiperOrigin-RevId: 826479070
Change-Id: I25acf36e6c20b091d8492e10798d028ae66f6733
2025-10-31 07:21:18 -07:00
Sam Haves 57f7145806 Create mjpDecoder, mj_parse, and mju_decodeResource
- plugin system similar to mjpResourceProvider, but instead of loading a resource it converts an existing mjResource into an mjSpec.
  - The returned spec is then composed into the referencing spec.
  - This enables different file types to generate arbitrary specs, and allows us to separate format parsing from compilation code.

Follow up CLs will move some of the logic in src/engine for PNG, USD, KTX, OBJ loading into decoders.

The mj_parse function MjSpec from a given file, it's a more generic version of mj_parseXML.

In it's implementation, mj_parse as opposed to mj_parseXML will look for any registered decoder and
not assume we are striclty dealing with MJCF.

PiperOrigin-RevId: 826149497
Change-Id: I0ece26904280cb94bd5ded6dd5a565c539d60254
2025-10-30 12:54:40 -07:00
Matija Kecman f2badc05ac Add JavaScript bindings and WASM support
Co-authored-by: Matija Kecman <matijak@google.com>
Co-authored-by: Sebastian Noreña Rendón <sebas.norena@creativa77.com.ar>
Co-authored-by: Kyle Bayes <kylebayes@google.com>
PiperOrigin-RevId: 826109484
Change-Id: I327fd54122762bd2e239cc31c602a3eb73051c26
2025-10-30 11:11:52 -07:00
Matias Manevi 76e64d96bb Add JavaScript bindings and WASM support
Co-authored-by: Matija Kecman <matijak@google.com>
Co-authored-by: Sebastian Noreña Rendón <sebas.norena@creativa77.com.ar>
Co-authored-by: Kyle Bayes <kylebayes@google.com>
PiperOrigin-RevId: 826094938
Change-Id: Id2658a187bc078056f4410c71202696753319e64
2025-10-30 10:38:16 -07:00
Taylor Howell 10f4b36fb7 MuJoCo Warp documentation: Beta software.
PiperOrigin-RevId: 825958166
Change-Id: I1e90d78d7413956cfa84711336be26a23a18e5aa
2025-10-30 03:37:22 -07:00
Alessio Quaglino 37563a050e Remove obsolete docs references to convexhull.
Fixes #2912.

PiperOrigin-RevId: 825679563
Change-Id: I8ee14415fb1eb64ece5cf4f3c07d016126025364
2025-10-29 13:17:48 -07:00
Taylor Howell 3df784fc84 Updates for MuJoCo Warp documentation.
PiperOrigin-RevId: 825489001
Change-Id: I6ec4a0433f96da05befeb2b76793763e50a893d8
2025-10-29 04:42:46 -07:00
Google DeepMind d769440924 Store asset keys relative to the MJCF. This CL fixes cases when loading a spec with "from_zip" that fails on zipped folders that contain a root directory.
PiperOrigin-RevId: 825484553
Change-Id: I79c6f542edbd3ffd167d0b5cecc704c32c8d6824
2025-10-29 04:24:09 -07:00
Alessio Quaglino 010d919244 Add __setattr__ to _MjBindModel and _MjBindData.
This allows setting attributes with bind using a list of mjSpec objects as arguments.

PiperOrigin-RevId: 825456920
Change-Id: Ie6af956feab0a805175d7aaecf26e071401fbf05
2025-10-29 02:55:08 -07:00
Haroon Qureshi 80eb511620 Remove dependency on Window, Physics, and Renderer classes.
PiperOrigin-RevId: 825137441
Change-Id: I099a518ca9618698401d0330a6ef08278168f88e
2025-10-28 11:42:17 -07:00
Haroon Qureshi 4620b9f23a Merge HandleMouseEvents and HandleKeyboardEvents back into app.cc.
PiperOrigin-RevId: 825081195
Change-Id: I36445b8c452b15ca26056a52fd1844cf77083c0a
2025-10-28 09:44:42 -07:00