Commit Graph

5109 Commits

Author SHA1 Message Date
Kyle Bayes 06f12a9372 Set max in hill climbing support. When imax is the optimal index then this reduces from three iterations down to one.
PiperOrigin-RevId: 948334160
Change-Id: Ia12fbc853fc65f70c525a617cfdced6e98d30dca
2026-07-15 07:50:52 -07:00
Haroon Qureshi 52317058ba Add pan/tilt motions to mjv_moveCamera.
PiperOrigin-RevId: 948308546
Change-Id: I2724b889759e652ed50d03bf97f3c7125cd0eb56
2026-07-15 06:50:15 -07:00
Haroon Qureshi 1e85ce176f Migrate filament header documentation to docs.
PiperOrigin-RevId: 948294877
Change-Id: I6e110bbdc4d2e329a243f1b96d560698174de26b
2026-07-15 06:14:40 -07:00
Yuval Tassa b60609d2a1 Add links to numbered changelog entries.
PiperOrigin-RevId: 948257078
Change-Id: I7c9747debade178a94020cdf43ad1c3613a5c29a
2026-07-15 04:34:44 -07:00
Yuval Tassa 64d4b3bdb2 Fix changlelog item numbering
PiperOrigin-RevId: 948228547
Change-Id: I26eebaa4c8f4c0f30718b6e4391cf990a85bc30f
2026-07-15 03:25:32 -07:00
Haroon Qureshi fa36015bae Remove unneeded mjvScene argument from mjv_moveCamera.
PiperOrigin-RevId: 948204736
Change-Id: Ic9b116ce439b3153764af67c449a824aec1994dc
2026-07-15 02:26:04 -07:00
Copybara-Service 6c78c8664e Merge pull request #3340 from devshahofficial:devshahofficial/mjr-renderer-info
PiperOrigin-RevId: 948183711
Change-Id: I28b256eca22e86ec0ba05a4fa26458d678aca130
2026-07-15 01:37:11 -07:00
Yuval Tassa c69ef03083 Add zero-iteration early exit to the primal solvers, certified by the duality gap.
The primal cost has curvature of at least M in every zone, making it strongly
convex in the M-norm and bounding the suboptimality of any point by the
Fenchel duality gap at its constraint forces:

  cost(qacc) - cost* <= 0.5*grad'*M^-1*grad

Since M's factorization always exists, this certificate is evaluable before
the solver does any work: one triangular solve and one dot product. When the
warmstarted solution is already certified to satisfy the tolerance, CG and
Newton now return with zero iterations; for Newton this skips building and
factorizing the Hessian. If the certificate declines, Newton gets a second
exit after factorization: the Newton decrement, checked before the first
line search.

Because the gap bounds cost suboptimality, stiff constraints can convert it
into force errors of order sqrt(2*gap*stiffness). Newton solutions are
characteristically force-accurate, so Newton zero-iteration exits also
require the gradient criterion, preserving constraint-force accuracy at
rest; CG solutions are characteristically cost-accurate and exit on the gap
alone.

On a settling pile of 50 boxes (300 dofs, ~200 contacts), end-to-end time
per step drops 13% over a settle-then-rest run and 27% in the quiescent
limit, with Newton iterations falling from 0.98 to 0.40 per step.

Tests: WarmstartZeroIterations sweeps solver/cone/jacobian on a settled box,
asserting zero iterations, forward/inverse consistency, and agreement with a
tolerance=0 control solve from the same state. WarmstartZeroIterationsIslands
checks per-island exits with a kicked box next to a settled one.
RefsiteConservesMomentum now requests an exact solve (tolerance=0), since it
asserts momentum conservation tighter than the solver tolerance contract.
PiperOrigin-RevId: 947993735
Change-Id: I2fd855774bff619709b2c386f1ba2714286e0821
2026-07-14 17:24:08 -07:00
Yuval Tassa 1e66efd114 Add the Newton decrement as a termination criterion of the Newton solver.
After an accepted line-search step, the solver has already rebuilt the gradient
and Hessian and solved for the next search direction, so the Newton decrement
0.5*g'*H^-1*g -- the quadratic model's predicted cost improvement of the next
iteration -- costs one dot product. Terminating when it falls below tolerance
avoids running one more iteration only to observe a correspondingly small
actual improvement.

This is a C port of Alain's proposal in MJWarp:
https://github.com/google-deepmind/mujoco_warp/pull/1520

PiperOrigin-RevId: 947768034
Change-Id: I94e5c71a4e2b4a7775611edd1dad254bba2633b4
2026-07-14 10:30:18 -07:00
Kyle Bayes 2444defc63 Support arbitrary large meshes in multiccd by reusing EPA memory.
PiperOrigin-RevId: 947709621
Change-Id: Idc4f168434b9d0a8555c0bed989adb0e99770a78
2026-07-14 08:48:25 -07:00
Yuval Tassa 0afafacfc5 Add fixed-size 6x6 dense LU factorization with benchmark.
mju_factorLU6/mju_solveLU6: same algorithm as mju_factorLU/mju_solveLU
with compile-time size, allowing full unrolling. At n=6, factor+solve is
25% faster than the runtime-sized version (93 vs 124 ns), and fixed-size
LU factorization is faster than generic dense Cholesky (55 vs 61 ns):
at this size, runtime-n loop overhead outweighs Cholesky's 2x flop
advantage. See new lu_benchmark_test. Results agree with the generic
version to rounding, not bitwise: the compiler may fuse (FMA) the
unrolled version differently.

Also add two DenseLU tests: a pivoting-required matrix with zero
diagonal, and fixed-vs-generic agreement.

PiperOrigin-RevId: 947705056
Change-Id: I24c54c9510964aa376886e9dd721890eda9889d3
2026-07-14 08:38:19 -07:00
Copybara-Service b7af32ac87 Merge pull request #3363 from ebms03:fix-resolve-plugin-segfault
PiperOrigin-RevId: 947628510
Change-Id: Ied0fcd3bb30267a133f1c6f6d6799c9236bc6845
2026-07-14 05:47:35 -07:00
Yuval Tassa 23cc383372 internal change
PiperOrigin-RevId: 947585050
Change-Id: Iaf9b60523b06d3cfd513ec661296eb39f4709442
2026-07-14 03:59:35 -07:00
Yuval Tassa 0ce8f7b06b Replace functionally opaque Viscous Pause with functionally transparent "Viscous posing mode" toggle.
PiperOrigin-RevId: 947527204
Change-Id: I122a9730fa22ac9e8809762046a89fb0a774d827
2026-07-14 01:50:13 -07:00
Michael Moss 3c6080b1c0 Add a CMake deps cache to improve build reliability and speed.
PiperOrigin-RevId: 947522108
Change-Id: I4aa11c08c5ee47a8ab0fc023038d84b46775c9b6
2026-07-14 01:38:03 -07:00
Yuval Tassa 796b803ecf Calibrate float32 tolerances for several engine tests.
PiperOrigin-RevId: 947501998
Change-Id: I939aaf3db7d8b7cbd04d7bb4885d10e0191e579a
2026-07-14 00:51:48 -07:00
Yuval Tassa 6afe13573b Fix single-precision (mjUSESINGLE) CMake builds.
PiperOrigin-RevId: 947367737
Change-Id: If2b56c9d4b4c214c858f6d8b588443f6bd4896ee
2026-07-13 19:02:26 -07:00
ebms03 07c14a7c1a Update user_model_test.cc
typo
2026-07-13 20:46:07 +02:00
ebms03 fc5ed199a6 Update user_model_test.cc
Remove trailing whitespace
2026-07-13 17:03:51 +02:00
ebms03 fb4686d049 Update CMakeLists.txt
Remove trailing whitespace
2026-07-13 16:58:55 +02:00
Copybara-Service 9b053d68e9 Merge pull request #3395 from google-deepmind:dependabot/pip/mjx/pip-26.1.2
PiperOrigin-RevId: 946997660
Change-Id: I3edb881bcdbd6f9b089be164da77b14060f4a334
2026-07-13 06:13:22 -07:00
Yuval Tassa dddb2767c6 Include gap in body_margin, fixing mid-phase pruning of in-gap contacts.
The mid-phase BVH descent filter prunes body pairs using body_margin,
which was compiled as the max over geom margins, excluding gap. Broadphase
and the leaf-level test both use margin+gap, so any multi-geom body relying
on gap could silently lose its in-gap contacts when raw AABBs don't
overlap. Single-geom bodies take the leaf-leaf path and were unaffected.

PiperOrigin-RevId: 946967548
Change-Id: I6d92baa296f1a83be68b4dbfd64a96d1c7efd3c4
2026-07-13 05:04:55 -07:00
Yuval Tassa f5f9d9efb7 Fix bug in mesh normal scaling for nonuniform mesh scales.
PiperOrigin-RevId: 946937791
Change-Id: I1b8a0ad4d573842ef9f76572dea25668dd319b52
2026-07-13 03:57:00 -07:00
Google DeepMind fbf031a7d5 Replace functionally opaque Viscous Pause with functionally transparent "Viscous posing mode" toggle.
PiperOrigin-RevId: 946298154
Change-Id: Ia06dd6346ac1002000f2d0b1cf9498ffb0d5f8bd
2026-07-11 13:47:48 -07:00
Haroon Qureshi 94132c75c7 Remove dead code.
PiperOrigin-RevId: 946289927
Change-Id: I4dc493b522f33c281511a8e6ad407e734e50734f
2026-07-11 13:13:32 -07:00
Yuval Tassa 724a6c6623 Replace functionally opaque Viscous Pause with functionally transparent "Viscous posing mode" toggle.
PiperOrigin-RevId: 946286636
Change-Id: I3e542b12bb57c67f3f194d7bcfdffe39de4f2b94
2026-07-11 13:00:59 -07:00
Yuval Tassa 892d889793 Fix numerical instability in elliptic contact line search.
Reformulate the cost difference calculation (`ellipticCostDif`) to use mathematically equivalent formulas that avoid subtracting large, nearly equal values (cancellation errors) in single precision at high normal forces.

This is a C port of Alain's formulation in MJWarp:
https://github.com/google-deepmind/mujoco_warp/pull/1512

Also adds an integration test (`EllipticLineSearchPrecisionDiagnostics`) that reproduces the precision issue under large normal forces in the sliding regime, and asserts that the solver does not produce large negative improvements in either precision. This test failed before the change.

PiperOrigin-RevId: 946137815
Change-Id: Ia8fc1c4823b5fee770140c8989b9465737d22ad7
2026-07-11 03:04:33 -07:00
Yuval Tassa 4a03a61734 Fix engine_util_sparse_test on MSVC
error C2466: cannot allocate an array of constant size 0

PiperOrigin-RevId: 945988439
Change-Id: Iceb4c536665a4bb42a603a17c41b083a4b6abeea
2026-07-10 18:28:23 -07:00
dependabot[bot] bc3f17107e Bump pip from 26.1 to 26.1.2 in /mjx
Bumps [pip](https://github.com/pypa/pip) from 26.1 to 26.1.2.
- [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/pip/compare/26.1...26.1.2)

---
updated-dependencies:
- dependency-name: pip
  dependency-version: 26.1.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-10 20:38:40 +00:00
Yuval Tassa d6650f84e5 Remove engine_util_container and its test.
PiperOrigin-RevId: 945701044
Change-Id: I6ca3d4fc87cdcd9e3fc14ee49b3aa441a70cd8bd
2026-07-10 07:26:05 -07:00
Yuval Tassa 0cb3fad654 Add missing tests to cmake
PiperOrigin-RevId: 945700668
Change-Id: If501d188562d0ff5e50b3fc6950f05f0d9a4a040
2026-07-10 07:24:50 -07:00
Yuval Tassa e6452e2c88 Rename testspeed argument npoolthread to nenginethread.
PiperOrigin-RevId: 945698744
Change-Id: Ida6d5ab24c88441fb05c778e8507d6369eb74f1c
2026-07-10 07:19:21 -07:00
Yuval Tassa ff629889da Increase default sleep_tolerance from 1e-4 to 1e-3.
PiperOrigin-RevId: 945696845
Change-Id: I77caa0b6c0966da986451ff9eee5aecaf4e30106
2026-07-10 07:14:37 -07:00
Haroon Qureshi 40feb498a1 Clear material instance assignments at start of frame.
PiperOrigin-RevId: 945623848
Change-Id: I983efa6a14d25e2cb0f46b8bd529086d84247a50
2026-07-10 03:56:52 -07:00
Taylor Howell f6f80cd0a0 Import google-deepmind/mujoco_warp from GitHub.
PiperOrigin-RevId: 945593266
Change-Id: Ic08842caabb92bc32974892ffae98e3295827094
2026-07-10 02:37:52 -07:00
Copybara-Service cb28d0c7d1 Merge pull request #3381 from tkelestemur:tarik/mjx-warp-put-model-nworld
PiperOrigin-RevId: 945578693
Change-Id: I873e4f47551d02f506d3af37040e1014fa0edb61
2026-07-10 02:02:02 -07:00
Yuval Tassa 2f650a7beb Studio: extract TimelineScrubberGui and add it to the toolbar.
The code for the timeline scrubber widget has been moved from `App::ModelOptionsGui` into a new method `App::TimelineScrubberGui`. This new method is now called in both `App::ModelOptionsGui` and `App::ToolBarGui`, replacing the thread count slider in the toolbar.

PiperOrigin-RevId: 945565640
Change-Id: I6d5cab0b2397e8b32a2b335e8a709bb9e19bdb48
2026-07-10 01:26:48 -07:00
Sam Haves dc7581acfa Add pluggable resource writing to MuJoCo
Extend mjpResourceProvider with an optional write callback (write)
so that mj_encode, mj_saveXML, and mj_saveModel can write to any
registered provider.

PiperOrigin-RevId: 945202741
Change-Id: I37903425260932e555f4a8c2392c4ff8c2e6cc06
2026-07-09 10:47:48 -07:00
Michael Moss bdeb7e7c4d Revert addition of Clang-19 and 20 from Linux Compilers matrix.
PiperOrigin-RevId: 945098838
Change-Id: I1bd4aa48f52a7555c581096e4e3ebb45fbf9408e
2026-07-09 07:12:40 -07:00
Google DeepMind faf0dabc32 Fix damper kv inheritance from default classes in XML native reader
Ensured dampers correctly read inherited values from gainprm[2].

PiperOrigin-RevId: 945086959
Change-Id: I10900f3ad057036115da88ad6d649d3d058e7373
2026-07-09 06:44:22 -07:00
Kyle Bayes ac29b596fb Autogenerate src files for doc line numbers.
PiperOrigin-RevId: 945067341
Change-Id: I8980a6157e06d1c1e21c6aa45a389b2cca09a363
2026-07-09 05:50:55 -07:00
Michael Moss f04b0fcd3d Update the GitHub Linux Compilers matrix.
PiperOrigin-RevId: 945004453
Change-Id: I939bfd0d4ac55397d65bea207b05d60be3ac8238
2026-07-09 03:00:19 -07:00
Saran Tunyasuvunakool ce3fc0ccfb Replace history slider with a custom timeline scrubber.
Introduces a new timeline widget in the Studio UI, replacing the previous integer slider for simulation history. The new widget displays the current and maximum simulation times, formatted with appropriate units (µs, ms, s), alongside the actual step number, and allows scrubbing through the history via a custom-drawn spine and knob.

This change also modifies the history recording logic to record every solver step rather than only every rendered frame. This enables the step forward/backward buttons to navigate exactly 1 solver step at a time.

This change also fixes `SimHistory::SetIndex()` range checks in `sim_history.cc` to clamp `offset_` against `1 - size_` (`Size()`) rather than total vector capacity (`history_.size()`).

PiperOrigin-RevId: 944671699
Change-Id: Iaa34668a1e257e5c0c1840c827370d81c4935b3d
2026-07-08 13:35:07 -07:00
Omar Rayyan 040872fd65 Copybara import of the project:
--
a5221e754c88580d103bfc7bfaf1ed32927ca499 by omar rayyan <olr7742@nyu.edu>:

Fix .mjz loading in simulate

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/3384 from omarrayyann:fix-mjz-simulate a5221e754c88580d103bfc7bfaf1ed32927ca499
PiperOrigin-RevId: 944573851
Change-Id: Ifba77ee9f9b97a7d8c0b0a47ac82d390a273672b
2026-07-08 10:30:54 -07:00
Yuval Tassa 18147c50c8 Studio: Only show PAUSE overlay when info overlay is active.
PiperOrigin-RevId: 944428518
Change-Id: I8ba9bc24795ad4d3e35884c88cef12a0df910dec
2026-07-08 04:48:30 -07:00
Alessio Quaglino fb6d1cf18f Support pinned flex vertices with bending
The flexcomp compiler previously rejected pins on dim-2 flexes with
bending (elastic2d bend/both). Allow them: mj_flexPassiveBend treats a
pinned vertex (body without 3 free slide dofs) as static -- zero
velocity, and no bending force applied to it (the reaction is carried
by the pin) -- while its position still enters every neighbor's
bending force, which is exactly what the pin constrains.

PiperOrigin-RevId: 944410969
Change-Id: Ib0a69c8d5fb6f64d3e2a76af3b6b2c7be1898191
2026-07-08 04:02:31 -07:00
Tarik Kelestemur 4e5778433b Add batch_sizes model batching for MJX Warp 2026-07-07 18:06:30 -04:00
devshahofficial d23ff84c59 Add renderer info query API 2026-07-07 11:44:46 -07:00
Haroon Qureshi c4c2cad503 Implement SceneDecorator class.
Helper class that creates "decor" renderables using an mjvScene.

PiperOrigin-RevId: 943915073
Change-Id: Iae1efbe376dc21430387b10d7200451187522828
2026-07-07 08:41:03 -07:00
Haroon Qureshi 4ab8617429 Get mjrfContext from the ModelObjects.
PiperOrigin-RevId: 943888955
Change-Id: Icfe6230e531a100ad5a09efe582977fd3de8f076
2026-07-07 07:44:47 -07:00