Commit Graph

4007 Commits

Author SHA1 Message Date
Haroon Qureshi 2fd9b5e92f Partial roll back VFS refactor due internal breakages
PiperOrigin-RevId: 862210191
Change-Id: Ia15a345a267bcef4b593d507d54f1668da0c0611
2026-01-28 06:40:11 -08:00
Yuval Tassa 19ff06155a Refactor sensor computation into per-sensor functions.
PiperOrigin-RevId: 862180688
Change-Id: I9f3f4da8ca8abed778965fd3970171276ee4570d
2026-01-28 05:04:59 -08:00
Yuval Tassa 1d2d0b1c37 Remove batching optimization from GEOM* sensors
PiperOrigin-RevId: 861938606
Change-Id: Ibb135a4d99cab9ce23a04f844f7c730e8f3b31c8
2026-01-27 16:44:10 -08:00
Yuval Tassa 5fb47df197 Add mjData flags marking lazily evaluated pipeline stages
PiperOrigin-RevId: 861763477
Change-Id: Ib613c56949264573a16306800658f868d2aa7665
2026-01-27 09:45:06 -08:00
Alessio Quaglino ba32568138 Move flex vertex-edge adjacency to mjModel.
PiperOrigin-RevId: 861717037
Change-Id: I2ad8090b0318cb04b43d13966cb42260c82ef930
2026-01-27 07:41:47 -08:00
Haroon Qureshi 669e9b7484 Add an "offscreen" mode that allows users to render studio to a texture
then uses SDL to blit the texture into the window.

PiperOrigin-RevId: 861697047
Change-Id: Ib949b4ade0c79d867ba74ce013bc2b6fa2571f56
2026-01-27 06:48:16 -08:00
Yuval Tassa dce2ed00ea Change not required, issue was addressed in e48da1e38c
PiperOrigin-RevId: 861680910
Change-Id: Iea5c7190bf826c9254eb1bd2f78b0098073cba20
2026-01-27 06:03:04 -08:00
Yuval Tassa e787f8717d Change not required, issue was addressed in e48da1e38c
PiperOrigin-RevId: 861680071
Change-Id: I374f091cd2686737e53234ca0edc8703897fbd4a
2026-01-27 06:01:14 -08:00
Haroon Qureshi 75715ab966 Update logic for dealing with file dialogs.
This in preparation for an upcoming change that uses native file dialogs instead
of our very basic ImGui file dialog.

PiperOrigin-RevId: 861671041
Change-Id: I9b00c05efdda5e37ffe15048a2ccf66f6eca89d9
2026-01-27 05:31:01 -08:00
Haroon Qureshi ad482a57bb Add a headless OpenGL renderer target.
PiperOrigin-RevId: 861642051
Change-Id: Ie0b880a2d3d85205dcd41bca5dc270efd35b7767
2026-01-27 04:08:33 -08:00
Haroon Qureshi fe16255602 Add mjz support to studio.
PiperOrigin-RevId: 861627355
Change-Id: Iafd291965ca78d03fdc1efe0e40dabcd4f2dacc4
2026-01-27 03:22:58 -08:00
Haroon Qureshi 32a4412e2b First-pass implementation of a spec loader for zipped assets.
PiperOrigin-RevId: 861625990
Change-Id: I65cf601cd9aa3aab4915a5a247dda00a6a9aa3db
2026-01-27 03:18:30 -08:00
Haroon Qureshi e43ed60d29 Allow GUI to be rendered to texture as well.
Update SetFrameBuffer to allow users to customize which swap chain
(window or offscreen) to use for rendering both the main mjvScene
as well as the GUI.

PiperOrigin-RevId: 861624061
Change-Id: Ife7bfc447afb007016300438fc5f88a8e4cfa0f6
2026-01-27 03:12:05 -08:00
Haroon Qureshi 0ddbb46fa1 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 861550939
Change-Id: I070eb4bcc2982466c8f368f7918005538baa5185
2026-01-26 23:53:29 -08:00
Matija Kecman e977b0d660 Fix GIL deadlock in Python viewer methods
Removed the GIL lock in set_figures, clear_figures, set_texts, clear_texts, set_images, and clear_images

PiperOrigin-RevId: 861245200
Change-Id: I52f21d82f9813752c7cb357213c24ea6188583db
2026-01-26 10:11:16 -08:00
Yuval Tassa 5fc6ed4eda Make XML schema dropdown titles clickable links.
PiperOrigin-RevId: 861182944
Change-Id: I01fec8f102a87f8daf65ad5ba5ed3a09c0022cd0
2026-01-26 07:26:27 -08:00
Yuval Tassa 7f8084ae1d Rename XML reference icons to avoid anchor issues.
Before this change:
`https://mujoco.readthedocs.io/en/latest/XMLreference.html#body-site-m`

After this change:
`https://mujoco.readthedocs.io/en/latest/XMLreference.html#body-site`

PiperOrigin-RevId: 861180069
Change-Id: I6f15906c8be463825248487021f9f46fc82a95da
2026-01-26 07:16:08 -08:00
Alessio Quaglino 54ace777c1 Add convenient plugin assignment in Python bindings.
PiperOrigin-RevId: 861168536
Change-Id: I274fbf3460d475434f837ab58bf5e2b0988369fd
2026-01-26 06:37:31 -08:00
Haroon Qureshi bdb553ff8a Add a ModelPlugin that can be used to load and update models.
PiperOrigin-RevId: 861077626
Change-Id: I3ef4989cfbfff3632c5915c00ebda1e7a48716e8
2026-01-26 01:24:43 -08:00
Alessio Quaglino e933081ff1 Optimize flexvert Jacobian computation.
The dense Jacobian arrays `J0_dense` and `J1_dense` are now zeroed only once before the vertex loop. Inside the loop, only the entries that were actually used are zeroed out after being added to the sparse Jacobian, allowing for efficient reuse of the dense arrays across all vertices.

PiperOrigin-RevId: 860799056
Change-Id: Ia61daae5eeb2f4dbc0c5d8c0064622a881e92b7a
2026-01-25 05:22:44 -08:00
Yuval Tassa e48da1e38c Fix __muloti4 linker error on Clang 13
Add `-rtlib=compiler-rt` linker flags for the Clang 13 CI build.

Clang 13 generates calls to __muloti4 (a 128-bit overflow-checked multiplication intrinsic) for signed 64-bit multiplication with overflow detection. This symbol is provided by LLVM's compiler-rt but is missing from GNU's libgcc, which is the default runtime library on Ubuntu.

Related issues:

- https://github.com/llvm/llvm-project/issues/14841
- https://github.com/abseil/abseil-cpp/issues/841
- https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244169

PiperOrigin-RevId: 860529686
Change-Id: If58dc0328aa1dd87aef8ea02da555f57ad96b02c
2026-01-24 08:15:56 -08:00
Alessio Quaglino e9c61694e1 Align flex_vert0 to the XY plane during model initialization if dim=2.
PiperOrigin-RevId: 860435368
Change-Id: Ida616e1e69c224f7c0dbad2a10dd59e64cbadf49
2026-01-24 00:50:01 -08:00
Alessio Quaglino 769109630f Move flexvert_J and flexedge_J sparsity pattern to mjModel.
PiperOrigin-RevId: 860392796
Change-Id: Ie1264f2df5bf04b5794a3c7d8ad1a92524a6a567
2026-01-23 22:00:14 -08:00
Alessio Quaglino 7da271c687 Add vertex equality option.
PiperOrigin-RevId: 860299454
Change-Id: I7befd8e5f4c8bac6d74684a96a9cc3cee9ae1e29
2026-01-23 16:30:05 -08:00
Yuval Tassa a5de40b400 Replace mjtSize with size_t for size calculations in engine.
Use unsigned size_t instead of signed mjtSize for size multiplications to avoid Clang's overflow-checking intrinsic. This is semantically correct as size calculations are inherently unsigned.

PiperOrigin-RevId: 860213177
Change-Id: I837aa6556335478969d4977492d0f231419f020a
2026-01-23 12:35:13 -08:00
Yuval Tassa 68537e1e32 Replace mjtSize with size_t for size calculations.
Use unsigned size_t instead of signed mjtSize for size multiplications to avoid Clang's overflow-checking intrinsic. This is semantically correct as size calculations are inherently unsigned.

PiperOrigin-RevId: 860172221
Change-Id: I3b6cb720db8771b8f266f1927e2980ac7514538b
2026-01-23 10:51:43 -08:00
Yuval Tassa 30b903b6c0 Migrate mjModel size fields from int to mjtSize.
This change updates all size-related members within the `mjModel` struct from `int` to `mjtSize`. This allows MuJoCo to handle models with a larger number of elements. Corresponding changes were made to macros, function signatures, and I/O routines to accommodate the new `mjtSize` type.

PiperOrigin-RevId: 860144595
Change-Id: I701c6d607715d240766b6210a9773cd9e4258c59
2026-01-23 09:41:49 -08:00
Taylor Howell 4a64017a5f Add documentation for MJX API
PiperOrigin-RevId: 860108133
Change-Id: I85469efcfe49d320ef8b89c9d174f33499a22b31
2026-01-23 07:53:17 -08:00
Google DeepMind c55c9a7bf1 Replace printf with mju_error in WASM bindings.
PiperOrigin-RevId: 860099912
Change-Id: Ia6a24da9301099aa976bb7a38beb9da15074a43d
2026-01-23 07:26:13 -08:00
Sam Haves 2582a83ac3 Add equalityJointAPI to mjcPhysics.
PiperOrigin-RevId: 860081702
Change-Id: Ifd961dcb2a8e0f5d885e9e9dadc0153b03cb5f4d
2026-01-23 06:28:29 -08:00
Google DeepMind e1992e62d7 Add mj_loadBinary binding to WASM.
This change adds an Emscripten binding for loading binary MuJoCo models (`.mjb`) from the virtual filesystem. The new binding, `mj_loadBinary`, takes a filename and an `MjVFS` object, enabling the loading of models that reference assets within the VFS.

PiperOrigin-RevId: 859740455
Change-Id: I9f9d8bbba0b57422e2356867e4282a1b04566475
2026-01-22 13:08:00 -08:00
Google DeepMind 61f13cd8f1 Add custom Emscripten binding for mj_saveModel.
Also adds support to unpack nullable string args

PiperOrigin-RevId: 859702186
Change-Id: Ia9e10f447ecf17b1dd74dd64d988790107a438a6
2026-01-22 11:36:13 -08:00
Taylor Howell 5ae6b5fe31 Fix MjSpec.add_texture gridlayout argument to accept strings and character lists
PiperOrigin-RevId: 859599919
Change-Id: If785f36010a7437b354ec0ce7db30c2b7ec69fe6
2026-01-22 07:28:16 -08:00
Haroon Qureshi bab468703c Display error message when requested file does not exist.
PiperOrigin-RevId: 859583121
Change-Id: Id9969e486499a70769e325161c3cd2c204006d9a
2026-01-22 06:34:35 -08:00
Matija Kecman 98593259e7 Internal change
PiperOrigin-RevId: 859578296
Change-Id: If4dd4ca68ab9750693e5f6ff20ea0c78d6b93464
2026-01-22 06:20:47 -08:00
Alessio Quaglino 54dd623650 Add vertex-based flex constraints (dim=2).
PiperOrigin-RevId: 859552050
Change-Id: I61d4b9dc40f041c5b930e5f8810a803e8bccb87a
2026-01-22 04:54:53 -08:00
Haroon Qureshi 2cc2e579f1 Refactor model loading APIs.
There are three ways to load a model: from a file, from a buffer, or an
"empty" model. Instead of overloading a single function to do all three,
provide three separate functions.

Also disable model loading functions that will not work for emscripten.

PiperOrigin-RevId: 859051341
Change-Id: I71557d31d0e7c9c6882895c36116d300f19e255d
2026-01-21 05:25:08 -08:00
Haroon Qureshi e2180ff744 First-pass of a plugin system for GUI elements.
Refactor filament's debug drawing to be one such plugin.

PiperOrigin-RevId: 859002002
Change-Id: Ibe9000dec19fce648eef6d57170ce435b9a8c6ff
2026-01-21 02:47:09 -08:00
Haroon Qureshi bf05bb1885 Make quit button work.
PiperOrigin-RevId: 858624789
Change-Id: Ibdd572b60273424f3b7e9bb6a9d117d2a0538227
2026-01-20 09:28:48 -08:00
Haroon Qureshi a0accc493a Fix camera select logic.
PiperOrigin-RevId: 858599199
Change-Id: I25f1a74ac145c73bb225d6df8e86aa82d88ebb4b
2026-01-20 08:18:29 -08:00
Taylor Howell 23c56ec4bb mjSpec python bindings for add functions: accept size with 1, 2, or 3 parameters
PiperOrigin-RevId: 858494291
Change-Id: I8a02dcac1d2419fbc728607907425b401cf66da4
2026-01-20 02:39:04 -08:00
Haroon Qureshi de47cf0e6f Don't mipmap sRGB textures.
PiperOrigin-RevId: 858148054
Change-Id: Ic115b7431901549e1c636eb20414641c37cf3e8a
2026-01-19 05:26:27 -08:00
Matija Kecman 654b393060 Add a boxing utility which can surround a bunch of UI and render it in a box.
The ImGui table API cell padding variables can be used to adjust the positioning of the UI in the box.

PiperOrigin-RevId: 858137824
Change-Id: I1ce1519c0abd67bc5fafc30f9a18dfcf18c2a313
2026-01-19 04:48:50 -08:00
Taylor Howell d173ee5bee MuJoCo Warp documentation: option-ccd-iterations -> option-ccd_iterations
PiperOrigin-RevId: 858100397
Change-Id: I358875ba56e6769fda75dba72377286c40771716
2026-01-19 02:42:04 -08:00
Sam Haves 799f8a300e Add parsing benchmark simulating many textures.
PiperOrigin-RevId: 857883857
Change-Id: Ia428ff8aeba4fbaae67a6337d0856cd2b19af2e6
2026-01-18 11:17:45 -08:00
Taylor Howell bb4df33adf Import google-deepmind/mujoco_warp from GitHub.
PiperOrigin-RevId: 857298931
Change-Id: Icbaddaea8140198c3673124d5994a01d3c92ed69
2026-01-16 14:11:39 -08:00
Taylor Howell 9ba545b8b0 MuJoCo Warp documentation: Memory.
PiperOrigin-RevId: 857148640
Change-Id: I7f21bebb2186a5dd4287a8d2ee9b430f823b9051
2026-01-16 07:13:38 -08:00
Haroon Qureshi 77d1ac10fe Fix scaling issues on HDPI monitors.
PiperOrigin-RevId: 857024487
Change-Id: I7d3db9ff754374053bcd33ba93c7466253afb58c
2026-01-16 01:17:38 -08:00
Sam Haves c08e1d9e6e Add MjcEqualityAPI as a base class for MuJoCo constraints and MjcEqualityWeldAPI for representing weld constraints.
This change introduces two new USD API schema:
* MjcEqualityAPI - base API for representing MuJoCo equality constraints in USD, this will typically be applied to joints such as UsdPhysicsFixedJoint.
* MjcEqualityWeldAPI - extends MjcEqualityAPI for MuJoCo's weld equality constraints with an attribute for torqueScale.

The usd_decoder is updated to parse UsdPhysicsFixedJoints and convert the new schema attributes into the appropriate mjsEquality data fields.

PiperOrigin-RevId: 856723634
Change-Id: I0982fd3168b643f8e91d87bb5ae5933e526b63a1
2026-01-15 10:44:27 -08:00
Taylor Howell d86acd7e12 MuJoCo Warp documentation: Warmstart.
PiperOrigin-RevId: 856608941
Change-Id: Iae1bd0a3916d98affff4d5dbb442f9d951622e52
2026-01-15 04:50:27 -08:00