Commit Graph

4777 Commits

Author SHA1 Message Date
Copybara-Service 46d2405b42 Merge pull request #3288 from davidhozic:fix/strchr-const-char
PiperOrigin-RevId: 923297843
Change-Id: I13b07c6cf0f611a8b3ee797dac94b35ce8d9deb4
2026-05-29 03:16:33 -07:00
Copybara-Service 9af965f241 Merge pull request #3120 from Ashutosh0x:fix/safe-overflow-msvc
PiperOrigin-RevId: 923296001
Change-Id: I037dcc55c91d6eb68b3e63b34a0e059c796b5116
2026-05-29 03:12:40 -07:00
Yuval Tassa df6942eb39 Support float32 precision for mjtNum in Python bindings.
PiperOrigin-RevId: 922959317
Change-Id: I384b3bdeabdc4d3f66c71cae41dabfaf51387be7
2026-05-28 13:56:58 -07:00
Kyle Bayes b612d352d4 Fix GitHub Actions for threading.
PiperOrigin-RevId: 922926969
Change-Id: I968e6b130b6125dbc0ec65ba913d04292270b563
2026-05-28 12:57:16 -07:00
Google DeepMind 9436972a22 Import NVIDIA/warp 1.13.0 from GitHub.
PiperOrigin-RevId: 922893824
Change-Id: Ib91ffb03257c614c48feda096822f723323be54d
2026-05-28 11:51:39 -07:00
Kyle Bayes b935d4153c Add new mju_threadpool API function, and delete old threading API.
PiperOrigin-RevId: 922838541
Change-Id: Id9f7e0fb298ffde61fcc49a802dc78971858ce51
2026-05-28 10:11:44 -07:00
Ashutosh0x 50ec8e84de test: intercept mju_warning in overflow regression test 2026-05-28 21:46:15 +05:30
Copybara-Service a22fc2423a Merge pull request #3295 from tkelestemur:tarik/fix-mjx-codegen-python311
PiperOrigin-RevId: 922794565
Change-Id: Ibd42328d739d3882e5c418cf69fc9787572cdb4a
2026-05-28 08:44:28 -07:00
Taylor Howell cae5a608d5 Import NVIDIA/warp 1.13.0 from GitHub.
PiperOrigin-RevId: 922749092
Change-Id: Ide815e4224e64af69e7c3a58102508bc81d22770
2026-05-28 07:00:59 -07:00
Alessio Quaglino 4c381635e1 Add mjs_makeFlex to the MuJoCo C and Python APIs.
- Add mjs_makeFlex C API that wraps mjCFlexcomp::Make(), creating
  a flex with auto-generated bodies, joints, and equality constraints
  from parameters (type, dim, dof, count, cellcount, spacing, scale,
  radius, mass, inertiabox, equality, rigid, flatskin, elastic2d,
  pos, quat, origin, file, vfs).
- Add Python binding body.make_flex() in specs.cc with keyword args.
- Refactor flex_spec_provision.py to use make_flex() instead of XML
  string templating + separate spec + attach. Eliminates textwrap
  dependency.
- Merge user_flexcomp into user_model BUILD target to resolve
  circular dependency.

PiperOrigin-RevId: 922725304
Change-Id: Ice13787c45f3173407fec659f9590a6453bc65dd
2026-05-28 05:59:20 -07:00
Sam Haves b9fb817af8 Lexically normalize resource path in mjz_decoder resource provider.
PiperOrigin-RevId: 922654438
Change-Id: Ieb46230a2aba46a5e711bc5b24aec982f71e56ca
2026-05-28 02:56:45 -07:00
Copybara-Service f755d718d3 Merge pull request #3293 from kevinzakka:studio-live-parallel-prefetch
PiperOrigin-RevId: 922417778
Change-Id: Ia839747c4af0e705962308dc84e9a7c3926fc910
2026-05-27 16:47:18 -07:00
Tarik Kelestemur 106f1c5dbb fix mjx codegen and rerun 2026-05-27 17:50:31 -04:00
Kyle Bayes 4035c66428 Fix multiccd edge bug that occurs in certain situations.
PiperOrigin-RevId: 922251109
Change-Id: I74c08ae49d5dfd2a41b2dcd28eb9f2b5ba113216
2026-05-27 11:32:45 -07:00
Alessio Quaglino f6c85287bf Optimize mj_flex performance.
Two performance optimizations for interpolated flex objects:

1. Hoist loop-invariant stride calculations in `mju_cellLookup` out of nested loops.
   This reduces multiplications from 16 to 6 (linear) and 54 to 12 (quadratic)
   per vertex.

2. Extract and consolidate optimized 3D interpolation logic into a new
   reusable utility `mju_evalBasisArray` in `engine_util_misc.c`. This function
   uses nested loops and precomputed 1D shape functions to avoid expensive
   dynamic `phi` calls and branching, and leverages stack-buffered outputs to
   eliminate compiler pointer-aliasing barriers. We propagate this optimization
   to both kinematics (`mju_interpolate3D`) and constraint setup
   (`engine_core_constraint.c`).

Together these changes yield a ~50% overall speedup in `mj_fwdKinematics` for interpolated flexes with ~10k vertices in the collision meshes and ~10 nodes in the deformation grid.

PiperOrigin-RevId: 922198093
Change-Id: I9c804e65cd532e2f9ac6e9a71d01c30cd64186fa
2026-05-27 10:05:30 -07:00
Google DeepMind af4be63cd8 Add xmacros for MjSpec.
PiperOrigin-RevId: 922169069
Change-Id: I01426596e49196996dfa324d5ab3849a90de2e3a
2026-05-27 09:12:35 -07:00
Haroon Qureshi 36ea0c466f Support multiscene, multiview rendering.
Update Renderable so that it can switch its own draw states (material
instance, shadow casting, reflection textures, etc.) per render request.
This allows us to use the same Renderable with different effects from
different views within the same frame.

PiperOrigin-RevId: 922102817
Change-Id: I1cf02fddb7a00345a741db1bee88e716517765f4
2026-05-27 06:54:58 -07:00
Matija Kecman c0b8aa9dec Make studio python more like studio C++
- C++ Platform UX: Added a "Copy Camera" button to copy XML camera definitions to clipboard.
  - C++ Platform UX: Extracted `SetSpeedIndex` and `GetExpectedLabelWidth` into reusable platform helpers.
  - C++ Platform UX: Fixed combo box widths and removed auto-hide tab bar flag from dockspace.
  - C++ Studio App: Deduplicated label width and speed index logic by adopting platform helpers.
  - C++ Studio App: Updated the toolbar layout to use a 2-column table.
  - Python Bindings: Added pybind definitions for `set_camera_index`, `set_speed_index`, and `camera_to_string`.
  - Python Studio App: Aligned toolbar UI with C++ using a 2-column table and fixed immediate theme switching.
  - Python Studio App: Added a Help menu displaying the MuJoCo version and Stats toggle.
  - Python Events: Added `-`/`=` shortcuts for simulation speed and `Esc`/`[`/`]` shortcuts for camera selection.

PiperOrigin-RevId: 922097319
Change-Id: Iec74afe37bf5c7a1ebf1cab4141e47fff5fe9274
2026-05-27 06:42:59 -07:00
Ashutosh0x 0607dc450c security: fix integer overflow in safeAddToBufferSize on MSVC
The MSVC fallback path in safeAddToBufferSize() performed unchecked
arithmetic (type_size*nr*nc) on attacker-controlled values read from
.mjb binary model files. This could cause integer overflow, leading
to an undersized heap allocation followed by a heap buffer overflow
when data is copied into the buffer.

The fix adds manual overflow detection using SIZE_MAX/INTPTR_MAX
comparisons, matching the behavior of the existing __builtin_*_overflow
path used on GCC/Clang.

Also adds a regression test that crafts a binary model buffer with
overflow-inducing size fields and asserts safe rejection.
2026-05-27 17:01:01 +05:30
Michael Moss 79aeceeaa3 Update MuJoCo version to 3.10.0 following the 3.9.0 release
PiperOrigin-RevId: 922027849
Change-Id: I52dd7fb5eeb962c2670ab5dbbe7ce192ac9332c5
2026-05-27 03:50:22 -07:00
Michael Moss 237c17e485 Update changelog for the 3.9.0 release.
PiperOrigin-RevId: 922002472
Change-Id: I92489261c59cff10b29def784698868e67aa43da
2026-05-27 02:47:19 -07:00
Alessio Quaglino f6cd0234fd Change tactile sensor normal component to report penetration depth.
The normal component of the tactile sensor now reports the maximum penetration depth at each taxel, instead of a derived normal force. The depth is negated so that positive values indicate penetration.

PiperOrigin-RevId: 921980899
Change-Id: Ide4103c0aff465e25a81cfdda650f6a0e2da9e0b
2026-05-27 02:00:34 -07:00
Kevin Zakka 249e9c08b8 MuJoCo Live: pre-fetch model assets in parallel before compilation.
The prefetcher asks mju_getXMLDependencies for the transitive asset
list, fetches every URL with Promise.all, and primes the bytes into the
WASM-side FetchCache. When the compiler runs, every resource it opens
is already in memory. Cold-load on a typical Menagerie model drops from
~9 s to ~2 s.
2026-05-26 16:01:48 -07:00
Kevin Zakka 6f9725a1da Make mju_getXMLDependencies read XMLs through the resource provider.
The function called tinyxml2's LoadFile directly, which only works on
the OS file system. Reading through mju_openResource lets it work
against any registered backend (VFS, HTTP, github:, ...).
2026-05-26 16:01:48 -07:00
Michael Moss 583aa5ad4f Update dependencies ahead of the 3.9.0 release.
PiperOrigin-RevId: 921512490
Change-Id: Iac2e4e52dde5ca7aeda62f033fcc03aadcaeb904
2026-05-26 09:30:49 -07:00
Taylor Howell d63a89f896 MJX documentation: update feature parity section
PiperOrigin-RevId: 921452813
Change-Id: Ic33c20688b9875e0d2be8563377a1e009da51fa6
2026-05-26 07:23:24 -07:00
Copybara-Service e03bf07134 Merge pull request #3230 from google-deepmind:dependabot/pip/mjx/pytest-9.0.3
PiperOrigin-RevId: 921431196
Change-Id: Ie23587578d88a1d3d909e50b68108a2ee7934d09
2026-05-26 06:32:39 -07:00
David Hozic 998f9960f9 Revert indexer_xmacro.h change 2026-05-26 14:51:48 +02:00
David Hozic 57e27f94f3 Fix compilation error 2026-05-26 14:50:11 +02:00
David Hozic da0bf9af17 Fix incorrect type for Python view of MjModel/tex_adrr 2026-05-26 14:48:03 +02:00
Yuval Tassa 393c1e4217 Migrate mjtByte to mjtBool for boolean-valued fields.
PiperOrigin-RevId: 921408093
Change-Id: Icb00457836359779f0f72fc02d6a7c0dc9f6bd23
2026-05-26 05:35:49 -07:00
Copybara-Service 3cabb2eb8e Merge pull request #3257 from google-deepmind:dependabot/pip/mjx/pip-26.1
PiperOrigin-RevId: 921402236
Change-Id: I40e4f10e72deb3b4195b9520305b7da220fbe08a
2026-05-26 05:20:14 -07:00
Taylor Howell ddff7e3e2e MuJoCo Warp documentation: update feature parity section
PiperOrigin-RevId: 921334977
Change-Id: I1c20e30cde81ae18830cae894ac5aee99ac0dcb8
2026-05-26 02:37:05 -07:00
Yuval Tassa 7667e7110e Introduce mjtBool for boolean types.
PiperOrigin-RevId: 920201340
Change-Id: I3b19c11a00357e06a1df08b8819832955c37f9ff
2026-05-23 09:13:54 -07:00
Baruch Tabanpour 466d068089 MuJoCo Studio: Support Ctrl+Option+Left Click Drag for perturbation
Support Ctrl+Option+Left Click Drag (maps to Ctrl+Alt+Left Click Drag in the application) to apply point force perturbations (translation) on the robot in the WebGL live viewer. This matches the Mac experience in the native MuJoCo simulate app and provides a fallback for Mac users where Right Click is difficult to trigger.

PiperOrigin-RevId: 919767954
Change-Id: I4a1d1c05784a8257d13f64f738af5b4841a615b3
2026-05-22 11:14:46 -07:00
Saran Tunyasuvunakool 5c21c8d28b Minor restyling of the loading screen.
PiperOrigin-RevId: 919744412
Change-Id: I3e4aa0b59d100ac85e8f915d7d733b2b3ea1ecea
2026-05-22 10:26:04 -07:00
Yuval Tassa ab0e0091d5 Standardize "DO NOT EDIT" comments in generated files.
PiperOrigin-RevId: 919718422
Change-Id: I2cba07d75d37d45f3f30b23d049c944b080248ad
2026-05-22 09:34:45 -07:00
Kyle Bayes 8469198ba5 Remove multiccd enable flag from mjSpec Colab.
PiperOrigin-RevId: 919716011
Change-Id: I746271990db1e213fee33b38e639db78bbf97a1a
2026-05-22 09:29:26 -07:00
Haroon Qureshi 8ae51e104d Move DrawTextAt from imgui_bridge to imgui_widgets.
PiperOrigin-RevId: 919508805
Change-Id: Ie311b88164d8c2ff7a8452ec2f1b8be7e7d9770e
2026-05-22 00:52:54 -07:00
Haroon Qureshi 3499adacae Store skin and flex meshes separately.
PiperOrigin-RevId: 919490079
Change-Id: I45473ee59e22465732fb4b470a94c2944fed9c37
2026-05-22 00:09:49 -07:00
Haroon Qureshi 88b8b58429 Add support for transparent PBR materials.
PiperOrigin-RevId: 919477028
Change-Id: I75cc311fc73dd5fe26b72ba8d49fd421fda455e3
2026-05-21 23:35:53 -07:00
Baruch Tabanpour 5b73846a1e Upgrade MuJoCo Live loading screen
PiperOrigin-RevId: 919112273
Change-Id: I0ffdf908e32d4197e007ebcc2d9f5136b59cf6b3
2026-05-21 10:03:40 -07:00
Yuval Tassa 15d27b363f Compile-time size assertions for MuJoCo basic types
PiperOrigin-RevId: 919107499
Change-Id: I07fcba4f33c77a2a1e68528dba6d399af94d0220
2026-05-21 09:55:04 -07:00
Matija Kecman 585be6cee5 Fix wireframe rendering
PiperOrigin-RevId: 919100432
Change-Id: I2931d793ab9639bdaaad11f6d77a77aa14e43b8a
2026-05-21 09:41:59 -07:00
Yuval Tassa 88a293b5e4 Update docs to correctly reference mjtype.h
PiperOrigin-RevId: 919071817
Change-Id: I829de7a22a49e6df604b0acf601a13f67ef5fbab
2026-05-21 08:44:11 -07:00
Yuval Tassa 2810edd27a Rename mjtnum.h to mjtype.h, move enum types to mjtype.h
PiperOrigin-RevId: 919020039
Change-Id: I441295c0baa0b7456f78239fbd5478d32ffc07c1
2026-05-21 06:43:29 -07:00
Kyle Bayes ad96acfb16 Add internal mj_narrowphase for batch processing of potential geom pair collisions.
PiperOrigin-RevId: 918988042
Change-Id: I871dcdf42f8105e2c8a57e275a3775ea46c69e65
2026-05-21 05:16:35 -07:00
Saran Tunyasuvunakool 7c47a89cd0 Add asset file download indicator to the loading screen.
This provides visual feedback to the user while loading large models.

PiperOrigin-RevId: 918708877
Change-Id: I77ea475cce6d9718e6cf8b33cb72b3f524a6ee63
2026-05-20 16:26:40 -07:00
Kyle Bayes 7174d33f08 Introduce mjPreContact, a minimal struct passed into the collision functions.
PiperOrigin-RevId: 918533795
Change-Id: I2b5af05c1479b25d5c2cfdc690321a26fce6ede6
2026-05-20 10:47:46 -07:00
Haroon Qureshi 53b3137a12 Separate Light management into a separate class.
PiperOrigin-RevId: 918508291
Change-Id: I9cadc1b612006a0450f8a2fd9088d56cc2e610a3
2026-05-20 10:01:15 -07:00