Commit Graph

4224 Commits

Author SHA1 Message Date
Taylor Howell ace8e52407 MuJoCo Warp documentation: Physics callbacks
PiperOrigin-RevId: 877837005
Change-Id: Ic2a44b75790ca43548245889c17ce2df8d9d4ac8
2026-03-03 02:38:44 -08:00
Kyle Bayes a06c091157 Fix repeated call to restrict pointer.
PiperOrigin-RevId: 877451707
Change-Id: I4849ccb8562ea1926173209da9934c11de64a109
2026-03-02 10:03:19 -08:00
Kyle Bayes d00ddea269 Merge mjc_ccdIteration into mjc_penetration.
PiperOrigin-RevId: 877432442
Change-Id: I6bffb36522f9e4f0e7b1023003e70df064e1ebb7
2026-03-02 09:17:56 -08:00
Alessio Quaglino bf74d01d93 Add collisions between flexes and SDF geoms.
The flex-SDF algorithm uses the same logic as mesh-SDF. Previous to this change, the flex was instead colliding with the convex hull of the mesh generated automatically with marching cubes from the SDF.

PiperOrigin-RevId: 876420302
Change-Id: I3bf6552b6b8e108ba4c4209bbcf10fe5f2b2fd90
2026-02-27 14:35:27 -08:00
Alessio Quaglino c2e67ab507 Refactor Mesh-SDF collision to use farthest point sampling and mjMAXCONPAIR.
Deleted MAXMESHPNT farthest point sampling instead of sorting by penetration distance is now used to select the best contact points, up to mjMAXCONPAIR. Deleted MAXSDFFACE, the BVH traversal now directly calls a function to process each leaf face against the SDF, instead of collecting face indices and processing them in a separate loop. This reduces memory by removing the need to store all intersecting face indices.

PiperOrigin-RevId: 876296914
Change-Id: I8068d634e2a01ffa9357d0c5381219d097e97abe
2026-02-27 09:42:16 -08:00
Baruch Tabanpour 67b6ab0589 Update mjx-warp docs.
PiperOrigin-RevId: 875966048
Change-Id: I333e8562f3db333f6c64af67cee1f735cb21232d
2026-02-26 17:26:31 -08:00
Baruch Tabanpour 07cda5a3c4 Refactor MJX warp RenderContext, get rid of brittle pytree owner pattern.
PiperOrigin-RevId: 875901011
Change-Id: I2ba0734d9ca001ff91361aab6412fe370919344b
2026-02-26 14:49:32 -08:00
Haroon Qureshi 07d7bc95e3 Expose vsm blur width parameter.
PiperOrigin-RevId: 875733943
Change-Id: Ic8cb423104d2e62ce295f6a2ab6fd67d548910a6
2026-02-26 08:23:30 -08:00
Sam Haves b71cdfb4ec Fix documentation describing relpose for weld equality.
The documentation incorrectly claimed the position elements in relpose described body2 relative to body1 when it instead is meant to describe the position of the anchor relative to body1.

PiperOrigin-RevId: 875722437
Change-Id: Ib3b1fd9d14976623b08511068ea9e11746a28b02
2026-02-26 07:53:59 -08:00
Alessio Quaglino 47a750d4a6 Restore mesh-SDF collisions.
This CL rolls back the change from changelist 794576123 since the previous version was more robust and stable. Compared to the original algorithm, this changes handles degenerate and very large triangles as well.

BEGIN_PUBLIC
Restore mesh-SDF collisions.
END_PUBIC

PiperOrigin-RevId: 875716983
Change-Id: If0de41dc7bbd60460779821d2338cf2d661f40d5
2026-02-26 07:39:34 -08:00
Sam Haves 0ec836b281 Rollback of Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 875705083
Change-Id: I21403d84abd56ef72de915bddc724fe3efa506e6
2026-02-26 07:04:39 -08:00
Haroon Qureshi 55d7226b06 Improve error handling of spec editor compilation.
PiperOrigin-RevId: 875703124
Change-Id: Idf4a90a48d75185ad03e4469cee9098104751d67
2026-02-26 06:59:31 -08:00
Copybara-Service 19b583a421 Merge pull request #3134 from kevinzakka:sensoracc-rnepost
PiperOrigin-RevId: 875703097
Change-Id: I564c1afa1cc1f88a712984c6714611056f6e26eb
2026-02-26 06:58:48 -08:00
Haroon Qureshi 137a504625 Add imgui stdlib target.
PiperOrigin-RevId: 875686702
Change-Id: Ie8ba8349c70da3313a1896b14a30d076f2068368
2026-02-26 06:13:38 -08:00
Haroon Qureshi a9675fbaa6 Add an Editor panel.
The editor panel allows you to add, remove, and modify spec elements
as well as recompiling and loading the spec.

Also includes utilities for handling vertically split panels.

PiperOrigin-RevId: 875658785
Change-Id: I18b10971d587db5eb1e65a033e1dc042faac7f1d
2026-02-26 04:51:02 -08:00
Yuval Tassa 7232ec3b47 Refactor constraint tree iteration and island assignment.
- Simplified constraint tree discovery with a unified iterator.
- Filling in a new `efc_tree` array to avoid calling tree discovery again in the constraint phase.
- Implemented dof skipping in the dense case for efficiency.

PiperOrigin-RevId: 875440387
Change-Id: Id44a5a6fe2a80edaaf30935506a023a307e21303
2026-02-25 18:48:59 -08:00
Haroon Qureshi b7e192e514 Expose VSM EL options.
PiperOrigin-RevId: 875368470
Change-Id: Ic6e05c82b57ffa3b1ff49baf4e3cd2c9480c9ba2
2026-02-25 15:36:55 -08:00
Kevin Zakka 43cde9716c Fix mj_sensorAcc returning zero after mj_step1 by clearing flg_rnepost in mj_step2.
Fixes #3133.
2026-02-25 14:04:33 -08:00
Haroon Qureshi 42d843a0fd Separate mjModel/mjData ImGui table helper from mjSpec ImGui table helper.
There are enough differences between how the two are structured that
having separate implementations makes things easier to implement
despite some minor code duplication.

PiperOrigin-RevId: 875287973
Change-Id: Id49e089e5e1944291ce79e79f8cb71d048a942cc
2026-02-25 12:37:31 -08:00
Taylor Howell 53fadd9d63 Improve nJmom by counting number of dofs for slidercrank and site transmissions
PiperOrigin-RevId: 875233737
Change-Id: I2cf3afad7e29e176a4f5a917dd35cfad99b2b0a3
2026-02-25 10:41:24 -08:00
Sam Haves b907ffedaa Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 875194599
Change-Id: I2cccc683d69a217f1817e70d16bc1815e366d00c
2026-02-25 09:13:09 -08:00
Haroon Qureshi abdea379af Allow the shadow type and map size to be configured in data.
PiperOrigin-RevId: 875179785
Change-Id: I638c8c8c9e45dd58f393684a09f2ab4871911f7a
2026-02-25 08:35:01 -08:00
Yuval Tassa 0c66585e39 Fix typos and minor corrections in MuJoCo documentation and comments.
PiperOrigin-RevId: 875163889
Change-Id: Ic604d6235bf9cb999058f191e3ee41e47ec1a567
2026-02-25 07:56:31 -08:00
Google DeepMind 940cab2508 Rename MuJoCo WASM output artifacts to mujoco.*.
This change updates the Emscripten build to output files named `mujoco.js`, `mujoco.wasm`, and `mujoco.d.ts` instead of `mujoco_wasm.*`. The internal CMake target name remains `mujoco_wasm` to avoid conflicts. The package name in `package.json` is also updated to `mujoco`. New enum tests are added.

PiperOrigin-RevId: 875140314
Change-Id: Ie03e0d1db2d03dd8582d5bfcb260b3d33549c2c9
2026-02-25 06:50:37 -08:00
Haroon Qureshi 757758dd2e Rename all filament mjr_ functions to mjrf_.
Rename stubs.cc to mjr_compat.cc. This library acts like a
"compatibility layer" that allows the filament renderer to
be implemented behind the mjr API.

PiperOrigin-RevId: 875114054
Change-Id: I5c47581cacbcadff4c78d2ad15728cc1c3a394ad
2026-02-25 05:43:50 -08:00
Alessio Quaglino 22e3217fc0 Replace TriangleMeshDistance with custom BVH-based SDF computation.
The `mjCOctree::ComputeSdfCoeffs` function has been replaced by `mjCOctree::ComputeSdf`. The new implementation removes the dependency on the `triangle_mesh_distance` library. Instead, it uses a provided `mjCBoundingVolumeHierarchy` to perform closest point queries on the mesh. The signed distance is computed by finding the closest triangle face via the BVH and determining the sign based on the dot product of the vector from the closest point on the triangle to the octree vertex and the triangle's normal.

Optional Laplacian smoothing has been added to the SDF coefficients. This helps smooth out potential discontinuities at octree level boundaries.

PiperOrigin-RevId: 875093374
Change-Id: I6fa53243a2dda107ccf255bc6b876ca5a4554d4f
2026-02-25 04:47:46 -08:00
Taylor Howell 52ed96bc3a Move tendon sparsity fields from mjData to mjModel
PiperOrigin-RevId: 875087590
Change-Id: I1a5489d2d2011795ee38b09d547e68acd72e3cc7
2026-02-25 04:32:11 -08:00
Matija Kecman 253494739a Read the clear color from the model if available
PiperOrigin-RevId: 875079722
Change-Id: Id5a9c359d19f46d1c0bb5fbf5043db0ee4b1b9b6
2026-02-25 04:09:27 -08:00
Kyle Bayes 84205f7dd0 Isolate libccd logic in mjc_penetration.
PiperOrigin-RevId: 875073780
Change-Id: I71bd39695aa667110fffff47f34cd98faa562cc6
2026-02-25 03:53:34 -08:00
Kyle Bayes cd8bfb90c3 Improve polygon creation logic in compiler.
PiperOrigin-RevId: 875070301
Change-Id: I06e851f3450035fff68b99997406d6ea471ce3b8
2026-02-25 03:40:07 -08:00
Taylor Howell d0fc1c2c83 MuJoCo Warp documentation: SDF plugins
PiperOrigin-RevId: 875063400
Change-Id: Iefa014e3c046a965722c633df0b19771ab481375
2026-02-25 03:16:54 -08:00
Haroon Qureshi ae7efead09 Show MuJoCo version in the help menu.
PiperOrigin-RevId: 875061430
Change-Id: I4d4ce32eebd8ca4af4622e9b4d1cd50d180d0b96
2026-02-25 03:11:13 -08:00
Yuval Tassa 27dc92b056 Fix typo in modeling.rst.
PiperOrigin-RevId: 875053694
Change-Id: Idb6d09d2713f2cc2a09d2b0912a227fe9ac9396a
2026-02-25 02:51:26 -08:00
Yuval Tassa 40e0007849 Restructure numeric constants table in API docs
Break the monolithic numeric constants table into 6 sub-grouped tables:
Version, Engine constants, Array sizes, Visualization, Rendering, UI constants.

Fix stale values: mjMAXUITEXT (500->300), mjMAXUIMULTI (20->35),
mjMAXUIEDIT (5->7), mjMAXUIRECT (15->25).

Add missing constants: mjMAXLIGHT, mjMAXMATERIAL.

Fix placeholder description for mjMAXFLEXNODES.

PiperOrigin-RevId: 875010581
Change-Id: Id47846de4d98b62cb96087b72ecd28358d5db9c7
2026-02-25 00:54:35 -08:00
Google DeepMind a83fa7299d Add support for loading XML models with VFS in WASM bindings.
PiperOrigin-RevId: 874756898
Change-Id: If2c30aef4c690cf0852587261ca32a3b91448621
2026-02-24 13:09:20 -08:00
Alessio Quaglino 09c7633a76 Add caching for flex stiffness computation.
This change introduces methods to cache and load the computed stiffness matrix and nodal masses for flex elements. The cache key is generated based on material properties (Young's modulus, Poisson's ratio), interpolation order, and the bounding box of the flex. This avoids redundant expensive computations when compiling models with identical flex definitions.

PiperOrigin-RevId: 874689771
Change-Id: I6d1e299baf294a984b507e2a2602b2c068610536
2026-02-24 10:45:23 -08:00
Copybara-Service f383e60721 Merge pull request #3130 from MatiasManevi:fix-wasm-demo
PiperOrigin-RevId: 874640066
Change-Id: Ib869283e36343f41cb13cce7405aca3a1584b76e
2026-02-24 09:04:11 -08:00
Google DeepMind 94acdb33bd Fix Impl.CPP memory leaks due to mjModel/mjData not clearing from pytree.
PiperOrigin-RevId: 874622402
Change-Id: I38a00633dea77d940e4b0422f93e9456ad84daf9
2026-02-24 08:17:06 -08:00
Haroon Qureshi 1d6ff2cece Display Bodies as a tree in Spec Explorer.
Display all other elements under "Elements" or "Assets" group.

Show properties for mjSpec, mjModel, and mjData for selected
elements.

PiperOrigin-RevId: 874614195
Change-Id: I128c2bec844983ac5d35a3a0b1e58b8a5b0109cb
2026-02-24 07:57:44 -08:00
Alessio Quaglino 5fc580a8ba Refactor SDF coefficient computation into mjCOctree.
The logic for computing Signed Distance Function (SDF) coefficients using TriangleMeshDistance is moved from `mjCPlugin::Make` in `user_mesh.cc` to a new method `mjCOctree::ComputeSdfCoeffs` in `user_objects.cc`. This encapsulates the SDF computation within the octree class.

PiperOrigin-RevId: 874572414
Change-Id: Ia2365c9c4527a252ff1d1bb43fe2c2593761e471
2026-02-24 06:03:59 -08:00
MatiasManevi c791f950cb Enable COOP/COEP headers for wasm Vite dev servers 2026-02-23 18:41:47 -03:00
Sam Haves 82e92cbcaa Remove PluginTest and make MujocoTest load plugins.
MujocoTest now loads plugins from MUJOCO_PLUGIN_DIR if set.
PluginTest is removed; all tests use MujocoTest directly.
testspeed binary loads plugins from MUJOCO_PLUGIN_DIR.

This is in preparation for moving common asset format parsing (obj, msh, stl, etc.) where we will always want to load those plugins.

PiperOrigin-RevId: 874194428
Change-Id: Id90805a9ba5de4627911b56d8b9c4ab4e1b29310
2026-02-23 12:15:22 -08:00
Taylor Howell 6ec808e2ce Fix attach for spatial tendon. Fixes #3119.
PiperOrigin-RevId: 874067521
Change-Id: If8d415278dde2bccf269cc90e8c176e3d7edefa6
2026-02-23 07:38:43 -08:00
Michael Moss a043df6bdf Update supported Python versions and remove obsolete 3.9 references.
PiperOrigin-RevId: 874063785
Change-Id: Ia4b2956b632aae5f0211fa766b6d413edcba8fe2
2026-02-23 07:29:47 -08:00
Taylor Howell 37e993f67e Improve upper bound for nJmom by computing maximum number of dofs for tendon transmissions
PiperOrigin-RevId: 874057077
Change-Id: I83736719cc2d91a899cd5997ea4a91d21cf06c9e
2026-02-23 07:11:31 -08:00
Taylor Howell 2bf9539234 MJX put_data with impl='warp'
PiperOrigin-RevId: 874017611
Change-Id: I23a25727d41cd888d90f2ea15b2b534eba5583be
2026-02-23 05:20:07 -08:00
Yuval Tassa ba0a5fe4db Fix section underline length in MJWarp docs
PiperOrigin-RevId: 873954878
Change-Id: I40b668b24d04721d8fd4bb61bb5ac7b902ea31f1
2026-02-23 02:25:10 -08:00
Taylor Howell 6b9e0b9e15 MJX API documentation: add Any to exclude-members
PiperOrigin-RevId: 873954713
Change-Id: Iafbdb571c4e5b0491d7d91159e84874c58c01a71
2026-02-23 02:24:06 -08:00
Yuval Tassa 9d6d9089e5 Improve solver parameter documentation, in particular for frictional constraints.
PiperOrigin-RevId: 873364458
Change-Id: Ie4da21abc2ee54d9eaaefc81b3d2624a520ad96e
2026-02-21 09:14:56 -08:00
Taylor Howell c428f675e7 MuJoCo Warp documentation: Update installation instructions
PiperOrigin-RevId: 873032865
Change-Id: I7f75de9ed0d9239b47bc80b321f213aa4014fda6
2026-02-20 12:45:23 -08:00