Commit Graph

1551 Commits

Author SHA1 Message Date
Yuval Tassa 410c73168c Add policies for global attribute conflict resolution upon attach
For example when loading parent_merge.xml:

```
WARNING: Attach conflict when attaching 'child' to 'parent_merge', policy is 'merge'
timestep: parent has 0.005, child has 0.002, taking the minimum
iterations: parent has 50, child has 100, taking the maximum
flag 'Damper': added from child
```

When loading parent_error.xml:

```
XML Error: Attach conflict when attaching 'child' to 'parent_error', policy is 'error'
timestep: parent has 0.005, child has 0.002
iterations: parent has 50, child has 100
Element 'attach', line 10
```
PiperOrigin-RevId: 933620810
Change-Id: Ib477863b5ef763474d27fb4be5a4148be1d5d500
2026-06-17 03:36:10 -07:00
Yuval Tassa 6f8bb5ef55 Refactor compiler warning handling.
Compiler warnings are now accumulated in a vector of strings within the mjSpec object. New API functions `mjs_numWarnings` and `mjs_getWarning` are added to access these warnings. The compiler's log handler now chains warnings to the global log handler, ensuring they are still displayed immediately. Call sites in `mj_loadXML`, `mj_compile`, and the Python and WASM bindings have been updated to use the new warning API.

PiperOrigin-RevId: 933361650
Change-Id: I47cab98a460c57b0898c0a1a43fce2a5b9648eb1
2026-06-16 16:28:33 -07:00
Yuval Tassa 55d7ff49ec Fix broken link in docs.
PiperOrigin-RevId: 933054777
Change-Id: Ic862992051200bff1b742025926961a7c2087ffa
2026-06-16 06:24:16 -07:00
Copybara-Service eb6c2eea91 Merge pull request #3331 from kevinzakka:fix-dependabot-security-alerts
PiperOrigin-RevId: 932472549
Change-Id: Ib0830dfefca386ae338f427d675a9d5e148efd2e
2026-06-15 08:21:26 -07:00
Yuval Tassa 67a1ea6dca Track authored flags for global attributes
PiperOrigin-RevId: 931585539
Change-Id: Ifdc8c59de6c5a553daf6e0af09d8192aff6b0610
2026-06-13 02:58:32 -07:00
Kevin Zakka 426aecc4bc Bump doc deps and restrict lint workflow permissions 2026-06-11 17:51:08 -07:00
Yuval Tassa 58f6d52491 Introduce new logging API, fixes #858
PiperOrigin-RevId: 930744288
Change-Id: I6ec1203b55c031390f3eef23192e2337508ce886
2026-06-11 14:36:57 -07:00
Matija Kecman edbe6a6f74 Fix memory and resource leaks in failing resource provider open callbacks
When an mjpResourceProvider's open callback returns 0 (failure), MuJoCo does
not invoke the corresponding close callback. Previously, several resource
provider implementations allocated heap memory or system file handles before
encountering an error, failing to clean them up before returning 0. This change addresses these leaks across the codebase and clarifies the API contract.

PiperOrigin-RevId: 929803942
Change-Id: Ib7344033726895cdf037a8d9356ffc183c78c2d3
2026-06-10 06:08:17 -07:00
Haroon Qureshi e6e5229126 Format header to conform to style guide.
Also moves some types to the mjrender.h header.

PiperOrigin-RevId: 929189125
Change-Id: I19e5598210898c0defb663c60d7ecfb9a19bcd38
2026-06-09 07:43:16 -07:00
Yuval Tassa 986d73c062 Fix non-unit normals in mesh convex hull compiler.
PiperOrigin-RevId: 928777934
Change-Id: I43d7adcf4c5781b57f0af9805a8ce01ebc2e3872
2026-06-08 14:40:11 -07:00
Yuval Tassa 828052e6f4 CG solver: Replace PRP+ with Hager-Zhang update
Replace the Polak-Ribière-Plus (PRP+) conjugate direction update with the Hager-Zhang  formula in `mj_solPrimal`.

While this change has negligible effect under float64, it leads to a significant 17.5% throughput speedup over PRP+ under float32 (measured via `engine_cg_convergence_test`). This performance gain is driven by:
* A 9.4% reduction in CG iterations per step.
* A 12.1% reduction in line search evaluations per step.

The full output of the comparison is

```
================================================================
1/4: HZ + float64
================================================================

CG Convergence: 2humanoid100.xml
  1000 Newton steps, 100 evaluation points
  nv = 654, nq = 756
  metric: ||qacc_cg - qacc_newton|| / ||qacc_newton||

  Warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  3.8532e-01 |  1.4285e+00 |       5.00 |    22368
      10 |  2.0809e-01 |  9.9315e-01 |      10.00 |    44591
      20 |  6.4977e-02 |  2.3410e-01 |      20.00 |    89417
      40 |  5.2839e-03 |  2.1916e-02 |      40.00 |   180984
      80 |  3.9709e-05 |  3.0010e-04 |      80.00 |   364241
     160 |  3.2498e-09 |  3.5480e-08 |     160.00 |   730131
  -------+-------------+-------------+------------+---------

  No warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  9.0740e-01 |  5.0045e+00 |       5.00 |    22123
      10 |  3.9506e-01 |  2.1927e+00 |      10.00 |    44879
      20 |  1.2496e-01 |  6.8911e-01 |      20.00 |    90341
      40 |  1.2846e-02 |  6.9533e-02 |      40.00 |   182869
      80 |  1.0288e-04 |  8.6457e-04 |      80.00 |   368312
     160 |  5.9820e-09 |  5.0903e-08 |     160.00 |   738479
  -------+-------------+-------------+------------+---------

  Tolerance sweep (iterations = 100, warmstart):
         Tol |    Mean Err |     Max Err | Mean Iters |  Max Iters |   Solver us | LS evals
  -----------+-------------+-------------+------------+------------+-------------+---------
       1e-04 |  1.1297e-02 |  8.9331e-02 |      34.88 |         51 |   131002.94 |    12052
       1e-06 |  1.0907e-03 |  7.7468e-03 |      50.87 |         72 |   184172.44 |    16700
       1e-08 |  1.1485e-04 |  1.0085e-03 |      66.82 |         91 |   232189.34 |    20194
       1e-10 |  1.1357e-05 |  8.1547e-05 |      81.97 |        100 |   276114.42 |    23264
       1e-12 |  3.7695e-06 |  2.8592e-05 |      90.47 |        100 |   299526.58 |    24964
           0 |  3.5019e-06 |  2.8592e-05 |     100.00 |        100 |  2062208.36 |   456276
  -----------+-------------+-------------+------------+------------+-------------+---------
  Total solver time: 3185214.08 us, avg time per iter: 74.9445 us

  Pipeline mode (consecutive mj_step, tolerance = 1e-8):
  1000 steps, nv = 654
  Steps/s          : 380
  us/step (total)  : 2630.0
  us/step (constr) : 2103.7  (80.0%)
  CG iters/step    : 63.28
  LS evals/step    : 190.75
  us/iter          : 33.24

================================================================
2/4: PRP+ + float64
================================================================

CG Convergence: 2humanoid100.xml
  1000 Newton steps, 100 evaluation points
  nv = 654, nq = 756
  metric: ||qacc_cg - qacc_newton|| / ||qacc_newton||

  Warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  3.8533e-01 |  1.4285e+00 |       5.00 |    22228
      10 |  2.0808e-01 |  9.9315e-01 |      10.00 |    44873
      20 |  6.4978e-02 |  2.3410e-01 |      20.00 |    89349
      40 |  5.2895e-03 |  2.1916e-02 |      40.00 |   179827
      80 |  4.0188e-05 |  3.0010e-04 |      80.00 |   363740
     160 |  3.2891e-09 |  3.5480e-08 |     160.00 |   733905
  -------+-------------+-------------+------------+---------

  No warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  9.0740e-01 |  5.0045e+00 |       5.00 |    22590
      10 |  3.9506e-01 |  2.1927e+00 |      10.00 |    45093
      20 |  1.2496e-01 |  6.8911e-01 |      20.00 |    90393
      40 |  1.2846e-02 |  6.9533e-02 |      40.00 |   182422
      80 |  1.0288e-04 |  8.6457e-04 |      80.00 |   367264
     160 |  5.9811e-09 |  5.0903e-08 |     160.00 |   739556
  -------+-------------+-------------+------------+---------

  Tolerance sweep (iterations = 100, warmstart):
         Tol |    Mean Err |     Max Err | Mean Iters |  Max Iters |   Solver us | LS evals
  -----------+-------------+-------------+------------+------------+-------------+---------
       1e-04 |  1.1325e-02 |  8.9941e-02 |      34.95 |         52 |   129456.81 |    12060
       1e-06 |  1.0910e-03 |  7.7469e-03 |      50.85 |         72 |   181004.51 |    16687
       1e-08 |  1.1488e-04 |  1.0085e-03 |      66.83 |         91 |   228183.13 |    20189
       1e-10 |  1.1401e-05 |  8.1547e-05 |      81.98 |        100 |   269635.40 |    23259
       1e-12 |  3.8040e-06 |  2.8592e-05 |      90.52 |        100 |   293811.25 |    24967
           0 |  3.5543e-06 |  2.8592e-05 |     100.00 |        100 |  2051927.47 |   456000
  -----------+-------------+-------------+------------+------------+-------------+---------
  Total solver time: 3154018.57 us, avg time per iter: 74.1895 us

  Pipeline mode (consecutive mj_step, tolerance = 1e-8):
  1000 steps, nv = 654
  Steps/s          : 382
  us/step (total)  : 2616.6
  us/step (constr) : 2091.8  (79.9%)
  CG iters/step    : 63.57
  LS evals/step    : 193.35
  us/iter          : 32.91

================================================================
3/4: HZ + float32
================================================================

CG Convergence: 2humanoid100.xml
  1000 Newton steps, 100 evaluation points
  nv = 654, nq = 756
  metric: ||qacc_cg - qacc_newton|| / ||qacc_newton||

  Warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  3.6748e-01 |  1.2281e+00 |       5.00 |    19239
      10 |  2.0034e-01 |  6.8689e-01 |      10.00 |    39001
      20 |  6.1972e-02 |  1.9859e-01 |      20.00 |    80112
      40 |  4.0704e-03 |  1.5797e-02 |      40.00 |   168211
      80 |  2.4380e-05 |  1.5803e-04 |      79.45 |   347735
     160 |  7.7413e-07 |  4.4732e-06 |     157.27 |   704210
  -------+-------------+-------------+------------+---------

  No warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  9.3385e-01 |  4.9648e+00 |       5.00 |    19272
      10 |  3.6117e-01 |  1.9618e+00 |      10.00 |    37982
      20 |  9.7490e-02 |  5.1451e-01 |      20.00 |    76502
      40 |  9.5924e-03 |  5.5088e-02 |      40.00 |   162782
      80 |  6.7689e-05 |  5.1113e-04 |      79.91 |   344281
     160 |  1.5541e-06 |  7.6955e-06 |     157.30 |   697076
  -------+-------------+-------------+------------+---------

  Tolerance sweep (iterations = 100, warmstart):
         Tol |    Mean Err |     Max Err | Mean Iters |  Max Iters |   Solver us | LS evals
  -----------+-------------+-------------+------------+------------+-------------+---------
       1e-04 |  1.5891e-02 |  1.2929e-01 |      32.56 |         50 |   136254.00 |    10980
       1e-06 |  1.5719e-03 |  1.0990e-02 |      47.42 |         68 |   193566.00 |    15418
       1e-08 |  1.6260e-04 |  1.0680e-03 |      62.70 |         86 |   252661.00 |    20162
       1e-10 |  1.5664e-05 |  1.0999e-04 |      78.10 |        100 |   311535.00 |    24509
       1e-12 |  2.8152e-06 |  1.5236e-05 |      90.39 |        100 |   356814.00 |    27902
           0 |  2.4989e-06 |  1.5025e-05 |      99.05 |        100 |  1980580.00 |   436825
  -----------+-------------+-------------+------------+------------+-------------+---------
  Total solver time: 3231410.00 us, avg time per iter: 78.7726 us

  Pipeline mode (consecutive mj_step, tolerance = 1e-8):
  1000 steps, nv = 654
  Steps/s          : 349
  us/step (total)  : 2862.7
  us/step (constr) : 2379.3  (83.1%)
  CG iters/step    : 61.97
  LS evals/step    : 199.01
  us/iter          : 38.39

================================================================
4/4: PRP+ + float32
================================================================

CG Convergence: 2humanoid100.xml
  1000 Newton steps, 100 evaluation points
  nv = 654, nq = 756
  metric: ||qacc_cg - qacc_newton|| / ||qacc_newton||

  Warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  3.6753e-01 |  1.2281e+00 |       5.00 |    19052
      10 |  2.0028e-01 |  6.8689e-01 |      10.00 |    38761
      20 |  6.1737e-02 |  1.9863e-01 |      20.00 |    79937
      40 |  4.0915e-03 |  1.5821e-02 |      39.99 |   168159
      80 |  2.4360e-05 |  1.5808e-04 |      79.59 |   348385
     160 |  7.8367e-07 |  4.1549e-06 |     157.04 |   700760
  -------+-------------+-------------+------------+---------

  No warmstart (tolerance = 0):
   Iters |    Mean Err |     Max Err | Mean Iters | LS evals
  -------+-------------+-------------+------------+---------
       5 |  9.3385e-01 |  4.9648e+00 |       5.00 |    19494
      10 |  3.6117e-01 |  1.9618e+00 |      10.00 |    38480
      20 |  9.7485e-02 |  5.1451e-01 |      20.00 |    77213
      40 |  9.5904e-03 |  5.5078e-02 |      40.00 |   162472
      80 |  6.7647e-05 |  5.1087e-04 |      79.87 |   342990
     160 |  1.4979e-06 |  7.2291e-06 |     157.92 |   699052
  -------+-------------+-------------+------------+---------

  Tolerance sweep (iterations = 100, warmstart):
         Tol |    Mean Err |     Max Err | Mean Iters |  Max Iters |   Solver us | LS evals
  -----------+-------------+-------------+------------+------------+-------------+---------
       1e-04 |  1.5998e-02 |  1.3172e-01 |      32.49 |         50 |   135111.00 |    10953
       1e-06 |  1.5878e-03 |  1.1052e-02 |      47.33 |         67 |   190914.00 |    15418
       1e-08 |  1.5901e-04 |  1.0680e-03 |      62.65 |         84 |   250609.00 |    20215
       1e-10 |  1.5953e-05 |  1.1116e-04 |      78.01 |        100 |   307067.00 |    24562
       1e-12 |  2.8520e-06 |  1.5174e-05 |      90.27 |        100 |   353010.00 |    27931
           0 |  2.5161e-06 |  1.5129e-05 |      99.39 |        100 |  1999478.00 |   438790
  -----------+-------------+-------------+------------+------------+-------------+---------
  Total solver time: 3236189.00 us, avg time per iter: 78.9045 us

  Pipeline mode (consecutive mj_step, tolerance = 1e-8):
  1000 steps, nv = 654
  Steps/s          : 298
  us/step (total)  : 3352.8
  us/step (constr) : 2832.0  (84.5%)
  CG iters/step    : 68.43
  LS evals/step    : 226.33
  us/iter          : 41.39
```

PiperOrigin-RevId: 928590104
Change-Id: I1a96730f50f444d6141d8978feb3519009daf320
2026-06-08 08:54:07 -07:00
Alessio Quaglino 7a7dc7ccad Add support for loading 1D flex components from OBJ line segments.
The obj_decoder plugin is updated to parse line segments ('l') from OBJ files and represent them as degenerate triangles. The user_flexcomp compiler now supports flex dimensions of 1, using these parsed line segments to define the 1D flex elements. The compile sample's error reporting is also improved.

PiperOrigin-RevId: 928566870
Change-Id: I6920729d1b1d5aeb391401c3245ebb1d4784c190
2026-06-08 08:03:30 -07:00
Yuval Tassa ea2d785e0a Improve quality of maxhullvert coarse convex hulls using Qhull's Q9 option.
PiperOrigin-RevId: 928417339
Change-Id: I59ecd454f063f2e32e1c3ce08eb4a18506ddf8c8
2026-06-08 01:56:24 -07:00
Taylor Howell 2e43279ac3 MuJoCo Warp documentation: remove parallel linesearch
PiperOrigin-RevId: 927417172
Change-Id: I43f72ec0be89e9370b6e7699a8080d8ecf02b4ab
2026-06-05 12:05:58 -07:00
Yuval Tassa 45d5f2ed5f Improve link in light/directional docs
PiperOrigin-RevId: 926006386
Change-Id: Idfd3eae6c127f29919587ae88aa4291c290e2944
2026-06-03 07:12:04 -07:00
Yuval Tassa 7b9b88060e Refactor mj_fullM. This change is part of the deprecation of mjData.qM.
PiperOrigin-RevId: 925669464
Change-Id: I4889c66591bc1df4c31135a13776052aad491f7a
2026-06-02 17:22:55 -07:00
Yuval Tassa 062b0f1ea6 Remove deprecated mju_{error,warning}_{i,s} functions.
PiperOrigin-RevId: 925204136
Change-Id: Ia877d08a135092db8037d04e6a237e81325a1d7c
2026-06-02 01:59:05 -07:00
Yuval Tassa 4548e81e4d Rename efc_diagApprox -> efc_diagA.
The field now stores either an approximate or exact diagonal of the constraint matrix A, so the name is made more general.

PiperOrigin-RevId: 924244954
Change-Id: I62b2f76531fb88b7b3bf96e6769940197596702b
2026-05-31 04:54:11 -07:00
Yuval Tassa cd6db9ebe2 Improve CG solver precision and stability under float32 via line search refactor
Fixes #2313

This CL combines two complementary improvements to the Conjugate Gradient (CG) solver, significantly improving numerical precision, stability, and efficiency, particularly in single precision (float32).

1. Line Search Cost Evaluation Refactor: Previously, solver improvement was calculated by subtracting absolute costs: cost(alpha) - cost(0). In highly converged states or single precision, this is susceptible to catastrophic cancellation. We refactor PrimalSearch to compute the cost delta directly, dramatically improving precision.

2. Improved Solver Termination Condition: Near the float32 precision limit, line search deltas can occasionally be slightly negative due to numerical noise. Previously, any value below m->opt.tolerance (including negative values) triggered termination, halting the solver and locking in destabilizing steps. We update the termination condition to require positive improvement (0 < improvement < m->opt.tolerance), allowing the solver to continue iterating and recover stability.

Together, these changes yield substantial improvements, see reduced tolerances herein.

PiperOrigin-RevId: 924229669
Change-Id: Ic0bbefaed090f3a8b1e79ab8d45422c3e86fb56c
2026-05-31 04:00:09 -07:00
Yuval Tassa 96bf8aea81 Move island-specific sparse matrices from arena to stack.
PiperOrigin-RevId: 923850345
Change-Id: I9683d7554b15b7cd8c45a8dce7814640aa266452
2026-05-30 03:09:46 -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
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
Google DeepMind af4be63cd8 Add xmacros for MjSpec.
PiperOrigin-RevId: 922169069
Change-Id: I01426596e49196996dfa324d5ab3849a90de2e3a
2026-05-27 09:12:35 -07:00
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
Taylor Howell d63a89f896 MJX documentation: update feature parity section
PiperOrigin-RevId: 921452813
Change-Id: Ic33c20688b9875e0d2be8563377a1e009da51fa6
2026-05-26 07:23:24 -07: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
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
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
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
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 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
Yuval Tassa 6aa738e75b Add Expand/Collapse All buttons to XML schema documentation.
PiperOrigin-RevId: 918454244
Change-Id: Idcd2cec39ccaf90fd2d6265aaa364dd6bfb79254
2026-05-20 08:06:11 -07:00
Yuval Tassa 7b83f96e49 Prevent visited docs links from changing color.
PiperOrigin-RevId: 918445755
Change-Id: I4884c7f349ef39fab2678ba68eae422e6140b0a2
2026-05-20 07:48:24 -07:00
Yuval Tassa bdf00966f9 Add compiler timing diagnostics to mjsCompiler, printed by compile.cc
For example, `compile mujoco_menagerie/robotis_op3/scene.xml` now outputs

```
Compile 1 (cold cache):
  total:      317.2 ms
  assets:     284.8 ms (wall clock)
    load:     616.1 ms
    hull:      26.4 ms
    poly:     137.8 ms
    inert:    177.8 ms
    bvh:      568.2 ms
    octr:       1.6 ms
    tex:       25.3 ms
  other:       32.4 ms

Compile 2 (warm cache):
  total:       79.9 ms
  assets:      54.5 ms (wall clock)
    load:     888.5 ms
    hull:       0.0 ms
    poly:       0.0 ms
    inert:      0.0 ms
    bvh:        0.0 ms
    octr:       0.0 ms
    tex:       21.4 ms
  other:       25.3 ms
```

PiperOrigin-RevId: 917850214
Change-Id: Iaec86230bec0faf2e47820e20cbff61de5b2621e
2026-05-19 08:28:47 -07:00
Yuval Tassa f712eed4ce Allow flex sleeping
PiperOrigin-RevId: 917817500
Change-Id: Ia3bd5e52e7c2eaa3f70c81352d82c130b1d357f6
2026-05-19 07:15:27 -07:00
Yuval Tassa 71d1014e70 Add mjENBL_DIAGEXACT for exact constraint diagonal. Fixes #2472
PiperOrigin-RevId: 916932908
Change-Id: Id23ac39b5cd996afc52990719a4e07c0cc7de600
2026-05-17 16:47:54 -07:00
Yuval Tassa 04042d8bf3 Move square root of Delassus matrix from stack to arena
PiperOrigin-RevId: 916852244
Change-Id: I4379553f808d0b238a1421606f806ea2d0a33d7c
2026-05-17 11:21:55 -07:00
Taylor Howell 072125c49c MJX (impl='warp'): nconmax -> naconmax
PiperOrigin-RevId: 915407157
Change-Id: Ie43c06164d6d942c2a4bb60b3d09fcb5c4c87a35
2026-05-14 06:52:45 -07:00
Yuval Tassa c56d662d27 Update link to Newton physics engine in changelog.
PiperOrigin-RevId: 915262716
Change-Id: I801267e760b8b5eeb534f71b4789e5a7fb8c35b1
2026-05-14 00:01:06 -07:00
Yuval Tassa 17fbc0aeef Update colors and legend in margin/gap figure.
PiperOrigin-RevId: 914857514
Change-Id: Ida36393bd4cd706bf81b8b7000ddd34f088fc936
2026-05-13 07:43:41 -07:00
Yuval Tassa 7bfdbad80b Make PGS solver constraint visitation order time-independent.
PiperOrigin-RevId: 914741347
Change-Id: I7889a42543e9a9f3ff883e25ee9eafaceedc29e1
2026-05-13 02:34:30 -07:00
Yuval Tassa a4e49f2dff Margin and gap redesign (breaking change)
PiperOrigin-RevId: 914329812
Change-Id: I905665e4c1965bdb8b90587e5b1277cfbfe5cce0
2026-05-12 09:43:43 -07:00
Alessio Quaglino f9f1db1e0a Replace the banded Cholesky solver for implicit flex interpolation
with a preconditioned Conjugate Gradient (CG) solver that operates
on the full system matrix.

The previous approach extracted flex DOFs into a reduced banded system,
factored it separately, and overwrote the global solve. This required
precomputed bandwidth (makeFlexBandwidth), parent-joint detection,
coupling corrections, and a FlexInterpContext struct — and only worked
for standalone flex trees without parent joints.

The new CG solver uses the already-factored global system (M - h*qDeriv)
as a preconditioner and adds the flex stiffness contribution via
matrix-free products (mjd_flexInterp_mulKD/mulK). This handles any
kinematic configuration — including flexes attached to articulated
chains or with parent joints — without sparsity pattern restrictions.

Before (`bunny_multicell`):
```
 Simulation time      : 50.80 s
 Steps per second     : 197
 Realtime factor      : 0.20 x
 Time per step        : 5080.3 µs

 CG iters / step      : 3.16
 Contacts / step      : 31.04
 Constraints / step   : 124.15
 Degrees of freedom   : 178
 Dynamic memory usage : 0.4% of 100M
```

After:
```
 Simulation time      : 9.52 s
 Steps per second     : 1051
 Realtime factor      : 1.05 x
 Time per step        : 951.7 µs

 CG iters / step      : 3.21
 Contacts / step      : 30.90
 Constraints / step   : 123.61
 Degrees of freedom   : 178
 Dynamic memory usage : 0.3% of 100M
```

PiperOrigin-RevId: 913758038
Change-Id: If5aa617b2d535c86aec9bd71c9e0003a2b38bdd7
2026-05-11 10:11:51 -07:00
Copybara-Service 044f294c7c Merge pull request #3243 from thowell:readthedocs
PiperOrigin-RevId: 913616905
Change-Id: I41452fc8823b96c8d15b8909b17fb13e69bf1f15
2026-05-11 03:54:33 -07:00
Michael Moss 28548ce51c Update MuJoCo version to 3.9.0 following the 3.8.1 release
PiperOrigin-RevId: 913596257
Change-Id: Ib8b27fd2224e38560a209054c1d508a9bba21bbf
2026-05-11 02:58:56 -07:00