Commit Graph

2439 Commits

Author SHA1 Message Date
Yuval Tassa 7e9ac58ff9 Migrate mjd_inverseFD mass Jacobian from qM to M
PiperOrigin-RevId: 942268237
Change-Id: I0ecfe161867ce9930cd6366d778077df2cd3197f
2026-07-03 15:35:52 -07:00
Taylor Howell 17feb4a64e Update Studio to close window
PiperOrigin-RevId: 942216322
Change-Id: I96b4665016df0acb0c5dec9caae27eeb9a87f874
2026-07-03 12:11:01 -07:00
Yuval Tassa 5618666a7d Add body/simple attribute to control simple body optimization.
PiperOrigin-RevId: 942164766
Change-Id: I1e83bb99b6a1955917eb9b2e9bed0dc7b8e6a161
2026-07-03 09:09:30 -07:00
Yuval Tassa 14c0b0c92b Recompute sameframe flags in mj_setConst.
The `body_sameframe`, `geom_sameframe`, and `site_sameframe` flags are now recomputed within `mj_setConst` based on the current model geometry. This allows these flags to be updated if the model's body/geom/site frames are modified after the initial compilation. Tests are added to verify the correct recomputation and its effect on forward kinematics. The compiler also checks that its initial computation matches the result of `mj_setConst`.

Fixes #3029, #1628.

PiperOrigin-RevId: 941758649
Change-Id: I7b995f8c67ad305bca5b52732436ba578c905d73
2026-07-02 10:49:00 -07:00
Yuval Tassa 2d283b5e9d Allow self-attach in MJCF
PiperOrigin-RevId: 941676717
Change-Id: I9ff8fc89716bc14b438a41e2b4075bbe5fdb83cf
2026-07-02 06:51:46 -07:00
Yuval Tassa cdc35dec38 Reformat MJCF array in xml_native_reader.cc.
Undo mistaken auto-format of the schema table, revert it to be more human-readable.

PiperOrigin-RevId: 941628625
Change-Id: Ifc51996da9a7df9d1a03392a0ade256fb8b1c151
2026-07-02 04:45:46 -07:00
Yuval Tassa 0e58c48504 Clean up MJCF attach code.
PiperOrigin-RevId: 941603845
Change-Id: I94f275e2073b1eb81cfabdc0bed80021c6f15b1c
2026-07-02 03:45:39 -07:00
Yuval Tassa f8462a156d Refine line search convergence criteria.
The line search now requires a negative cost (improvement) in addition to a small derivative to declare convergence, preventing premature termination when no actual improvement has been made.

Follows the proposal in github.com/google-deepmind/mujoco_warp/pull/1471

PiperOrigin-RevId: 941579503
Change-Id: I8fcd20f7b959e50d77cd5d6de0a3c6d95f86b9e1
2026-07-02 02:56:24 -07:00
Haroon Qureshi fb259a5edd Implement RenderableManager.
Similar to LightManager, the RenderableManager manages
renderables based on an mjModel and its mjData.

PiperOrigin-RevId: 941510745
Change-Id: I97b44cc857f136aa7c90ceb85a42e299fc759b73
2026-07-02 00:03:05 -07:00
Yuval Tassa c6c3ec3149 Add "frame" attribute to <attach> element.
The `<attach>` element now supports a "frame" attribute, allowing users to specify either a "body" or a "frame" to attach to, but not both. The XML parser has been updated to handle this new attribute and the mutual exclusivity constraint.

PiperOrigin-RevId: 941245904
Change-Id: I4c0edeed5f3a9e456aed96c373b1647fe79841d9
2026-07-01 12:49:55 -07:00
Georg Ostrovski bb80b55ae1 Fix data race in mju_getLogConfigPtr lazy init
The lazy init of log_config used a single atomic flag (env_checked) with
a load-then-store pattern, allowing two threads to both enter the init
path and concurrently write to the non-atomic log_config.topics field.

Replace with a two-phase atomic init: an atomic exchange on
env_init_claimed ensures exactly one thread enters the init, while
env_init_done (with acquire/release semantics) signals completion and
provides the happens-before edge that makes log_config writes visible to
other threads.

Also adds mj_atomic_exchange_bool to engine_crossplatform.h (both MSVC
and GCC/Clang variants).

PiperOrigin-RevId: 941202181
Change-Id: I59b6801c7b4b8b0e1647d82d2aeb534a90fb66fb
2026-07-01 11:24:36 -07:00
Matija Kecman 58d6910afa Refactor StepControl and GUI to return change status.
StepControl methods SetSpeed, SetNoiseParameters, and SetPauseState now return a boolean indicating whether the state was actually changed. The GUI functions NoiseGui and StepControlGui also return a boolean reflecting if any parameters were modified. Noise parameters are now directly managed by StepControl rather than being stored in UxState. The StepControlEvent message has been expanded to include all step control parameters. Keyboard event handling has been slightly refactored to better align with event-based updates.

PiperOrigin-RevId: 940656342
Change-Id: I3701623a2fdcfc4c084b5db0ae19048669040de4
2026-06-30 14:21:00 -07:00
Yuval Tassa 584ccd73d5 Improve error/warning display in studio.
PiperOrigin-RevId: 940299502
Change-Id: I8b13e2f984627a638a01b52f7dadca43f2c2ca80
2026-06-30 01:12:22 -07:00
Sam Haves 4e1795b9a4 Add special case support for MJB and TXT files to mj_encode.
PiperOrigin-RevId: 939875974
Change-Id: I57fc753871b348a7f6342aca0a892e74acb74173
2026-06-29 09:32:50 -07:00
Sam Haves d83ef0b6b9 Change mj_encode return type to 64-bit (mjtSize)
This supports encoding files larger than 2GB.

PiperOrigin-RevId: 939828697
Change-Id: If60d36c61475ced20b4eb58408ffb37e25bf3db7
2026-06-29 07:41:52 -07:00
Taylor Howell 1e04c568e8 Studio launcher
PiperOrigin-RevId: 939814201
Change-Id: If3fb1a1a9f9114835452fce63f39931db7818db3
2026-06-29 07:07:54 -07:00
Yuval Tassa 7c706b273a Report nnz(J) for CG solver.
PiperOrigin-RevId: 939806054
Change-Id: Icb2955511e33be046a4665fb39bce2546d6d4e3d
2026-06-29 06:49:23 -07:00
Haroon Qureshi 79f6deac99 Update bounds when updating the mesh.
PiperOrigin-RevId: 938628053
Change-Id: Ibd3d952d62614fc1eb049893937e6fb2d661da56
2026-06-26 09:25:06 -07:00
Yuval Tassa c7b1171846 Improvements to studio profiler
PiperOrigin-RevId: 938503994
Change-Id: I3a12647feea4c761dd8f8ba239f92355ceccfba1
2026-06-26 03:49:08 -07:00
Haroon Qureshi 07e292bc6b Make mjrf types opaque in header.
PiperOrigin-RevId: 938409081
Change-Id: I8b9680dcb04f56aadf9ffd601b08025fc624c656
2026-06-25 23:41:49 -07:00
Yuval Tassa 463b0fb27f Add ImGui overlay utility and PAUSE/realtime overlays to Studio.
PiperOrigin-RevId: 937834952
Change-Id: I3f3a0500a89b34e2e03b2fe88344b928edeafe8f
2026-06-25 01:45:01 -07:00
Yuval Tassa b6a0db7a17 Add Atkinson Hyperlegible Mono font support
PiperOrigin-RevId: 937799904
Change-Id: I89e4652cc45afdd9a55b3042395c4a56c70289fb
2026-06-25 00:16:39 -07:00
Yuval Tassa 0402bae176 Replicate the controls from the toolbar into the collapsible options sections and provides an option to hide the toolbar.
PiperOrigin-RevId: 937290592
Change-Id: I08f1f4880fd0b06123e817cb9ae7a3281daa8063
2026-06-24 06:09:24 -07:00
Haroon Qureshi 3d09a46d61 Use bulbradius as the vsm_blur_width as well.
PiperOrigin-RevId: 937286692
Change-Id: I03502da45951f90979b8f8d58915c80656a5eac7
2026-06-24 06:00:31 -07:00
Haroon Qureshi 3e33f93ddc Remove unused material instances before rendering frame.
Also ensure material texture hashes are unique so that the material
cleanup works correctly.

PiperOrigin-RevId: 937206048
Change-Id: Ibed53457ee271f4faae3bcac5fb479b5ce9fc352
2026-06-24 02:46:33 -07:00
Haroon Qureshi 29b49991a2 Rename mjrf_getSamplerType to mjrf_getTextureSamplerType.
PiperOrigin-RevId: 937193469
Change-Id: I56f856e257fa1cf99b643f794139ef85817a0bb9
2026-06-24 02:18:07 -07:00
Yuval Tassa 080668df42 Add "(default)" to conflict warnings in user resolver.
When reporting conflicts between parent and child elements during attachment, the warning message now indicates if a value is derived from the default rather than being explicitly authored in the XML. This improves clarity in conflict resolution warnings.

PiperOrigin-RevId: 936724265
Change-Id: I68c677b19020c19bf0260f5b3b77fe6ca3661bb9
2026-06-23 09:44:29 -07:00
Haroon Qureshi 5637f74327 Add plugin for adding mjvGeoms to the scene.
PiperOrigin-RevId: 936709560
Change-Id: I69a01fc50e2d4b013d260d524515719c434bbf5f
2026-06-23 09:16:41 -07:00
Haroon Qureshi 557a2241f4 Add PreStep and PostStep plugin callbacks.
PiperOrigin-RevId: 936665884
Change-Id: Ie04562b02bfd61a62f9de77b3cef0fff534bf547
2026-06-23 07:49:29 -07:00
Haroon Qureshi 94a912d349 Allow plugins to request loading models by path.
PiperOrigin-RevId: 936638157
Change-Id: If594c6a9abac5eb0d62e7d6dce4dc2f558989969
2026-06-23 06:50:41 -07:00
Yuval Tassa c499f7f2b0 Add Nesterov momentum with O'Donoghue-Candès restarts to PGS solver (~2x speedup)
Benchmark on `2humanoid100.xml` (nefc=1785, nv=654):

```
Convergence at fixed iteration count (mean relative error vs Newton):
  20 iters: 2.98e-03 vs 1.54e-02 (5.2x better)
  40 iters: 8.14e-05 vs 2.60e-03 (32x better)
  80 iters: 1.17e-07 vs 1.77e-04 (1500x better)

Pipeline throughput (tolerance=1e-8, islands disabled):
  Nesterov: 243 steps/s, 46 iters/step
  Baseline: 151 steps/s, 95 iters/step
  Solver speedup: 1.8x, overall step speedup: 1.6x

Pipeline throughput (tolerance=1e-8, islands enabled):
  Nesterov: 306 steps/s, 442 iters/step
  Baseline: 175 steps/s, 966 iters/step
  Solver speedup: 2.1x, overall step speedup: 1.7x
```

PiperOrigin-RevId: 936610759
Change-Id: I2978e8bd545971d9151005623967e5cf0ad125cc
2026-06-23 05:52:14 -07:00
Haroon Qureshi 5cef2472d5 Remove custom step_fn for StepControl::Advance.
PiperOrigin-RevId: 936609234
Change-Id: I606cf4d71d856cbd260900d63b22c719974c977d
2026-06-23 05:49:20 -07:00
Taylor Howell 027cfd1201 simplify camera projection sensor
PiperOrigin-RevId: 936571266
Change-Id: I5647e61fcc81ba6eb482dd95d3c40438f478bb18
2026-06-23 04:17:38 -07:00
Haroon Qureshi da2f0ebd7b Add prestep/poststep callbacks to StepControl.
PiperOrigin-RevId: 936567801
Change-Id: I62d4d657791fe68101e63c2050adb63929128acf
2026-06-23 04:07:26 -07:00
Haroon Qureshi 7f66f42568 Make Renderer own the scenes.
PiperOrigin-RevId: 936547976
Change-Id: Iec87426a9ae255cdbd3efadc7b602d4183679c81
2026-06-23 03:15:48 -07:00
Haroon Qureshi 2800a682e4 Remove unused render_flags parameters.
PiperOrigin-RevId: 936528056
Change-Id: Iae8545ec1d71bc7d5a20c46394104fb1db369d5d
2026-06-23 02:29:25 -07:00
Yuval Tassa 5d043d8f72 Minor tweaks to studio GUI style parameters.
PiperOrigin-RevId: 936508032
Change-Id: I93806ba3d0569b5ee01e95384f7f835a201b8253
2026-06-23 01:46:31 -07:00
Yuval Tassa afccd36dd4 Add threading support to PGS
PiperOrigin-RevId: 936252614
Change-Id: I6762245cc2dbdb95568f0a927c26b575dc494b51
2026-06-22 14:29:17 -07:00
Michael Moss 5700829122 Update MuJoCo version to 3.10.1 following the 3.10.0 release
PiperOrigin-RevId: 936044969
Change-Id: If0ebcc192419302da01741ebabb2b7dd3d7f7baf
2026-06-22 07:25:02 -07:00
Yuval Tassa e2528cbd93 Rename "Stats" window to "Info" and remove "Stats" dock.
PiperOrigin-RevId: 936026479
Change-Id: I72e4f2cba6df255d5446faedc81727b39ef735bc
2026-06-22 06:38:03 -07:00
Yuval Tassa bf59ca6a1b Make the info overlay position fixed (bottom left)
PiperOrigin-RevId: 935868629
Change-Id: I26b8d50f276b05c9869ea0f6cc5c3033ab6ef2f9
2026-06-21 23:39:55 -07:00
Yuval Tassa d5db39c762 Fix various bugs related to value bounds in studio UI.
PiperOrigin-RevId: 935855305
Change-Id: I14b41fc751dc04d35beada0dd5d1f0bfddf9af34
2026-06-21 23:01:57 -07:00
Michael Moss 3cb05726c4 Add MuJoCo Studio icons to the Mac and Windows apps.
PiperOrigin-RevId: 935655979
Change-Id: I4cb34a5592959c24764e8c63db0cac055d5c5dfb
2026-06-21 09:40:01 -07:00
Yuval Tassa 2cacf17071 Defer texture destruction in ImguiBridge to prevent use-after-free.
PiperOrigin-RevId: 935327326
Change-Id: I12a148b71abbe50581c7977a1f6dc5e220c40e81
2026-06-20 09:46:52 -07:00
Yuval Tassa 9ac0b283dc Menu reorg in studio
- Added "Info" and "Profiler" to the "View" menu.
- Deleted the obsolete "Charts" menu entirely
- Removed the "Stats" toggle item from the "Help" menu.

PiperOrigin-RevId: 935314037
Change-Id: I01ee30cbba5c1b4aa54c2940b0265401cc965c07
2026-06-20 08:43:09 -07:00
Saran Tunyasuvunakool 6039d4680a Modify the UI appearance of MuJoCo Studio.
PiperOrigin-RevId: 935247135
Change-Id: I4c35cf2f0cdfa36aa6d3c65c52a752edab266531
2026-06-20 03:34:21 -07:00
Haroon Qureshi d93c102190 Move mjrfilament.h to mujoco/include.
PiperOrigin-RevId: 934931460
Change-Id: I63bf34b3a7197b277ea7a5caf3d84d840f6210a1
2026-06-19 08:01:05 -07:00
Michael Moss 0dc37fd77b Add RPATH to fix mujoco_studio library loading error on Linux.
PiperOrigin-RevId: 934768602
Change-Id: I0b54ee1b3ed1a1ed85bcc88b36443539056275b1
2026-06-19 00:21:48 -07:00
Haroon Qureshi 4ec843d70d Use int instead of mjtGeom for public API.
PiperOrigin-RevId: 934766146
Change-Id: Iefaf32834ecbe12fe03c932ff593153277fc8f48
2026-06-19 00:13:32 -07:00
Michael Moss e7ef6528b7 Enable MuJoCo Studio build and packaging on macos.
Also:
- Packages MuJoCo Studio as MuJoCoStudio.app in the MuJoCo.dmg.
- Fixes a Filament compile issue.
- Patches libwebp to fix compile error related to universal builds and forces
  it to build as static.
- Removes the separate, obsolete "build_studio" step.
PiperOrigin-RevId: 934564785
Change-Id: I50c83283b5e138062e37d53926a5a77fdf99dbfa
2026-06-18 15:03:20 -07:00