Kyle Bayes
0eec09dd60
Add runtime assertions to mji functions.
...
PiperOrigin-RevId: 933106771
Change-Id: I523cdceb89c90611f27983731c49fd4887034431
2026-06-16 08:36:32 -07:00
Kyle Bayes
d9b677b49b
Refactor remaining primitive and convex collision code to use mjPreContact instead of mjContact. Introduce internal struct mjcPair in engine_collision_driver.c for readability and extensibility for flex objects. This is a no-op.
...
PiperOrigin-RevId: 933105275
Change-Id: Id862b01774df63dcdb42629a5b7dd12019f12ffd
2026-06-16 08:33:09 -07:00
Kyle Bayes
b469144a81
Modify mjc_FlexSDF to support mjPreContact directly.
...
PiperOrigin-RevId: 933068825
Change-Id: I328d64bb05270067ce146908b0df3ca83f10ed9b
2026-06-16 07:04:16 -07:00
Haroon Qureshi
0ea9c7cb3a
Expose function for determining if tendons should be drawn using a catenary.
...
PiperOrigin-RevId: 931170146
Change-Id: Ia3352a3e2bdc5e4df932e9d476e1e34200b62df1
2026-06-12 08:45:22 -07:00
Yuval Tassa
a070535c65
Fix GCC -Wformat-truncation error in legacy log adapter
...
Widen snprintf buffer from 1024 to 2048 bytes in mju_defaultLogHandler
to avoid truncation warning when formatting "func: subject".
PiperOrigin-RevId: 930823501
Change-Id: I0b2246f23c44e983bea76976b684d2efdfdff29c
2026-06-11 17:23:43 -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
Yuval Tassa
a2abaf7aef
Render perturbation box as a wireframe.
...
PiperOrigin-RevId: 930707140
Change-Id: Iab3577c8b45a235870f57001d38b6b1cd8acd170
2026-06-11 13:31:16 -07:00
Kyle Bayes
6957966c7d
Terminate early without contact in EPA if upper < lower on first iteration.
...
PiperOrigin-RevId: 929828707
Change-Id: Ide1106c14ae6eb003a9bbc238609b4bfdde221b0
2026-06-10 07:02:00 -07:00
Kyle Bayes
118baada7c
Remove engine threading fallback.
...
PiperOrigin-RevId: 929825049
Change-Id: Iff959f8d22ed082ff470c3eec426351964c2e89d
2026-06-10 06:54:19 -07:00
Kyle Bayes
2c5b8cae6c
Correct projected origin on face when the magnitude of face->v becomes very small in EPA.
...
PiperOrigin-RevId: 929768876
Change-Id: I5daf0203e998aa1489d9ce4c78cbf0764a8963e3
2026-06-10 04:48:18 -07:00
Adrian Collister
74d1459a4a
Enable contact sensors to work with Flex.
...
The sensor engine now correctly retrieves body IDs for contacts involving Flex elements by using mj_flexBody when a geom ID is -1. This allows contact sensors to detect and report forces/torques on bodies involved in Flex contacts.
PiperOrigin-RevId: 928607416
Change-Id: Ia815e1b3345bcfb393c9c4a829dc98959f2da50c
2026-06-08 09:31:42 -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
Kyle Bayes
ac7f198536
Tune constants for nativeccd to perform better with single precision.
...
PiperOrigin-RevId: 928549147
Change-Id: Ic28c60f73e92bb1b9578c56f790b6cda94875907
2026-06-08 07:21:17 -07:00
Kyle Bayes
318880126f
Provide better dedupe logic in multiccd in edge collision case.
...
PiperOrigin-RevId: 928519426
Change-Id: I67531d1c346b1b38c098eaf32c3b13fa7d0c8eaf
2026-06-08 06:07:31 -07:00
Yuval Tassa
6c33e16bf1
Canonicalize mjVisual macros to include type and dimension.
...
PiperOrigin-RevId: 928506110
Change-Id: If5d031f9d87892f13486ae9ccde23c16131212de
2026-06-08 05:30:57 -07:00
Haroon Qureshi
543165a6cc
Expose hsv2rgb as internally public function.
...
PiperOrigin-RevId: 928464175
Change-Id: I57ef75f28663b0da89b9af7bf730d82b965093bf
2026-06-08 03:44:50 -07:00
Haroon Qureshi
b17b5f7918
Expose mjv_flexBodyIdAndPoint as a helper function.
...
Use the above in studio rather than a custom implementation.
PiperOrigin-RevId: 928432476
Change-Id: I99d772c4baf7260abbf9ac8f6d8032704f1ba769
2026-06-08 02:28:39 -07:00
Kyle Bayes
558366f364
Always normalize in planeNormal to reduce rounding errors in single precision.
...
PiperOrigin-RevId: 926002329
Change-Id: I682f3b90249e60838c2432231b3181e57c565c28
2026-06-03 07:04:12 -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
Kyle Bayes
3a5626bc27
Align GJK internal memory to avoid misalignment segfaults when compiled as single precision. This is effectively a no-op under double precision.
...
PiperOrigin-RevId: 925389982
Change-Id: I7117779669965ebf72cb77ccbece419acf9b1b96
2026-06-02 09:15:26 -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
Alessio Quaglino
91c92279d2
Enable interior nodes for interpolated flex shell mode.
...
Previously shell mode required cellcount=1 along at least one axis. This CL
adds support for cellcount > 1 in all three axes by pinning interior grid nodes
to the parent body and reconstructing their positions from boundary nodes via
Transfinite Interpolation (TFI).
PiperOrigin-RevId: 924314800
Change-Id: I8c2438f4866dd4133feed65f535a1ab69f0c9188
2026-05-31 10:36:01 -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
3a6e0ee9b3
Reduce effect of infinite planes on center and extent statistics
...
PiperOrigin-RevId: 923868757
Change-Id: I3630d29f05a19e0767549284abbe8a8d9386894b
2026-05-30 04:12:07 -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
Yuval Tassa
5d782a2bb8
Fix memory overallocation in sparse primal solvers.
...
PiperOrigin-RevId: 923586079
Change-Id: I8d484b840063c0a7a8a79c5bdc9074a57d2ee55f
2026-05-29 13:51:47 -07:00
Kyle Bayes
c7d340be4f
Cap box<->box collisions.
...
PiperOrigin-RevId: 923312868
Change-Id: I801d76cf1d1d7b9ed1535d3e3c723a5e8af4162a
2026-05-29 03:52:57 -07:00
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
Kyle Bayes
b612d352d4
Fix GitHub Actions for threading.
...
PiperOrigin-RevId: 922926969
Change-Id: I968e6b130b6125dbc0ec65ba913d04292270b563
2026-05-28 12:57:16 -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
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
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
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
David Hozic
57e27f94f3
Fix compilation error
2026-05-26 14:50:11 +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
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
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
f712eed4ce
Allow flex sleeping
...
PiperOrigin-RevId: 917817500
Change-Id: Ia3bd5e52e7c2eaa3f70c81352d82c130b1d357f6
2026-05-19 07:15:27 -07:00
Copybara-Service
a1056676a0
Merge pull request #3276 from dparikh79:fix/3275-boxqp-symmetric-lower-matvec
...
PiperOrigin-RevId: 917279467
Change-Id: If4117b1e2147679336becb558e0f87621555dfc7
2026-05-18 09:36:01 -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
Dhruvil
71072c025d
Honor lower-triangle contract for H in mju_boxQP.
...
mju_boxQP documents that only the lower triangle of the Hessian H is
read, but the gradient and search-direction updates inside
mju_boxQPoption still called the dense mju_mulMatVec, which reads the
upper triangle as well. This violated the documented contract and
prevented callers from safely leaving the upper triangle uninitialized.
Add a file-local mulMatVecSym helper that computes res = H*vec while
reading only the lower triangle of H (mirroring the convention of the
existing mulVecMatVecSym quadratic-form helper), and use it in place of
mju_mulMatVec in both call sites. Extend the BoxQP test suite with
UpperTrianglePoisoned, which fills the strict upper triangle of H with
NaN and verifies that the solver produces the same result as on the
clean symmetric input.
Reported by @lshdlut.
Fixes #3275
2026-05-17 13:56:53 -04:00
Alessio Quaglino
71ddeb3efc
Add fast path for flex derivative computation in centered flexes.
...
Introduce a fast path in mj_addFlexDerivatives for centered flexes where all nodes are attached to bodies with only 3 translational DOFs and no DOF-contributing ancestors. This allows for a direct scatter of K*vec, avoiding the overhead of sparse Jacobian construction and multiplication.
PiperOrigin-RevId: 916063477
Change-Id: I824728a5bdc3b975b04b46ecf22994922e307a8c
2026-05-15 10:13:22 -07:00
Alessio Quaglino
093b92acc1
Add bounds check for cached node indices in passive mesh.
...
The global node indices stored in face_gidx are now checked to ensure they are within the valid range of node numbers, raising an error if any index is out of bounds.
PiperOrigin-RevId: 916025763
Change-Id: I1d2dcb11603137c337493541066b62b2ed2854c0
2026-05-15 08:50:49 -07:00
Alessio Quaglino
9fb548cadb
Optimize flex bending edge computation by caching face states.
...
In `mj_flexPassive`, precompute and cache face positions, global indices, and corotational quaternions for all faces. This avoids redundant calls to `mju_flexGatherFaceState` for each bending edge, as each face can be part of multiple bending edges. This gives a 3-4x speedup in mj_passive.
PiperOrigin-RevId: 915912918
Change-Id: I3e1c00cf2d989f85398a0750a0faf359249cfe01
2026-05-15 03:32:01 -07:00