Commit Graph

357 Commits

Author SHA1 Message Date
Yuval Tassa 2707eadc00 Refactor mj_crb and mj_tendonArmature to use CSR M.
PiperOrigin-RevId: 774077388
Change-Id: Id57118a5d66c074766f5c69fd3b889ebc625cbf7
2025-06-21 04:49:06 -07:00
Yuval Tassa e23b39fbfa Increase test tolerance in engine_solver_test
PiperOrigin-RevId: 773647308
Change-Id: I11605518c4bb1d257763b7f3334de358bacc194c
2025-06-20 04:48:09 -07:00
Kyle Bayes 56b88b59f0 Support 0-simplex in GJK code, and refactor code for efficiency and readability.
PiperOrigin-RevId: 764197889
Change-Id: Ie0d57474060a34a6b908be0386094f442cda448a
2025-05-28 04:19:13 -07:00
Alessio Quaglino 7edbdd0ad6 Remove the Shell plugin and integrate it into the engine.
PiperOrigin-RevId: 760688502
Change-Id: Ia70988d42b7edf571d7cb4a4f48f8fc50b51667d
2025-05-19 10:51:25 -07:00
Yuval Tassa 45fc15b844 Speed up sparse supernode detection by combining it with transposition.
PiperOrigin-RevId: 760673008
Change-Id: I6d66580e675fd86e5b974859383f93f87482ca16
2025-05-19 10:14:15 -07:00
Yuval Tassa ced630181d Replace mjv_sceneState and related code with mjv_copy{Model,Data}
PiperOrigin-RevId: 760662776
Change-Id: I512bda9187fbc19ade6924b91d5cb2275078de42
2025-05-19 09:51:58 -07:00
Yuval Tassa 8268c6d1ff Add mjv_copyData
PiperOrigin-RevId: 760642972
Change-Id: I16227fd91bf42618fda684b15b3650758ae29b13
2025-05-19 08:59:43 -07:00
Yuval Tassa ee8abdf854 Speed up mju_sqrMatTDSparse
PiperOrigin-RevId: 759593417
Change-Id: I0168e1f96333769d09d61e835560910d43aac608
2025-05-16 06:42:17 -07:00
Yuval Tassa e1baa15776 Remove unnecessary argument in mju_mulSymVecSparse
PiperOrigin-RevId: 758688536
Change-Id: Ife1099b948215363ddaa6d0b0edcf3492edcddcc
2025-05-14 08:12:15 -07:00
Yuval Tassa d8bebdc675 Remove unnecessary diagnum argument in mj_solveLD and mj_factorI
PiperOrigin-RevId: 758669364
Change-Id: Icfefc4a7a1e7d28da373725358ccf9d5f589f689
2025-05-14 07:13:27 -07:00
Yuval Tassa dd28b887d4 Rename C sparse structure to M in mjdata, improve docstrings.
PiperOrigin-RevId: 758636638
Change-Id: If78acc423601d2911f514929b27f7b6d0af9ef58
2025-05-14 05:26:19 -07:00
Alessio Quaglino 2386dfd7da Add touch sensor for estimating the surface contact stresses from the SDF.
PiperOrigin-RevId: 758556339
Change-Id: Ib56d76fab084b530fd68d61a29294cb6f1d05f3f
2025-05-14 00:45:58 -07:00
Yuval Tassa 627fffdef9 Switch mjData.{qH,qLD} from full ("M") to reduced ("C") inertia matrix structure.
PiperOrigin-RevId: 758273074
Change-Id: If1a2e663ea70044694af985e0119afd6d58115ac
2025-05-13 10:20:32 -07:00
Yuval Tassa 436b5a8e1f Add mju_addToSymSparse
- Internal engine function to add a symmetric sparse matrix to a dense matrix.
- Also minor refactors to related functions.

PiperOrigin-RevId: 757954336
Change-Id: I8d8a48bcbbd5d6c618ae097a87df2bc1e6f5ef1d
2025-05-12 16:19:43 -07:00
Yuval Tassa 755564a348 Remove unused code related to legacy island implementation.
Also fix a docstring.

PiperOrigin-RevId: 757939564
Change-Id: I3a970fd38c63886d34cd23b1fb45617a9ce5c147
2025-05-12 15:39:16 -07:00
Yuval Tassa 9ac5fff41d Move local function to top of test file.
PiperOrigin-RevId: 757722664
Change-Id: Ief7d8ca9fda990bf582ca0feaa4b645f0a4bb6e7
2025-05-12 05:36:38 -07:00
Taylor Howell 9accc7ae51 Update mj_energyPos.
PiperOrigin-RevId: 757678945
Change-Id: If236b9e8f376a2673abc87e818326e9188f6c15a
2025-05-12 03:14:43 -07:00
Yuval Tassa ecb769fc3a Refactor islands to be memory contiguous.
PiperOrigin-RevId: 755803476
Change-Id: I41972b07e0d5ef5d0117c94f565b93367b87458b
2025-05-07 05:06:27 -07:00
Yuval Tassa 7742f62803 Add mju_mulSymVecSparse, private engine function
Multiply sparse symmetric matrix (only lower triangle represented) by vector

PiperOrigin-RevId: 752926934
Change-Id: I5aaae1266256aa88aee8c25e242b7a7c51ea8dd7
2025-04-29 16:33:54 -07:00
Yuval Tassa 1766a388cc Improve warmstarting if island structure exists.
PiperOrigin-RevId: 752901506
Change-Id: I062d14df7da7d9dc1a2c1c30a16d0db7215af336
2025-04-29 15:18:14 -07:00
Yuval Tassa 8078a45727 Add private functions mju_blockDiag and mju_blockDiagSparse
PiperOrigin-RevId: 752815446
Change-Id: Ia7f73160315ce57b78a2c34bc781f00e1b0f05c4
2025-04-29 11:31:03 -07:00
Kyle Bayes 9e72874801 Remove EPA tolerance in the discrete case in nativeccd.
PiperOrigin-RevId: 750649926
Change-Id: I8ab317cd6b227c9486a2916ae9c6445906c23401
2025-04-23 10:52:14 -07:00
Yuval Tassa c2ac0d724e Add mju_gather and mju_scatter, private engine functions.
PiperOrigin-RevId: 750245294
Change-Id: I3a14ccdd55a324d3fe206e388fb2a513772f5f5e
2025-04-22 10:33:33 -07:00
Kyle Bayes b1f8d444f2 Fix bug in replaceSimplex3 in nativeccd.
PiperOrigin-RevId: 746014344
Change-Id: I93b32ab5f67ee48ab72238de53f7cda07638cb79
2025-04-10 07:04:27 -07:00
Yuval Tassa 25126e88c7 Move mju_cholFactorCount to engine_util_solve.
PiperOrigin-RevId: 746011856
Change-Id: If9812251420053644f4eca81adb5116d370ee524
2025-04-10 06:56:31 -07:00
Kyle Bayes 85b323c7fb Remove square roots when possible in EPA improving numerical precision.
PiperOrigin-RevId: 745559836
Change-Id: I3f8b23406e93ccfc4bc3499bfbed829b35462a74
2025-04-09 06:18:51 -07:00
Taylor Howell 96dda6ea75 Add tendon actuator force limits and tendon actuator force sensor.
PiperOrigin-RevId: 745096883
Change-Id: Ib9acb727fbbfc6b0b0323ee6a889053a7a878056
2025-04-08 05:16:35 -07:00
Kyle Bayes 58234b2217 Replace mjMAXVAL with numerical max limit where necessary in nativeccd.
PiperOrigin-RevId: 744693156
Change-Id: I72c3122701be281d468291dfc2ad1e4bb1da5a1c
2025-04-07 05:59:02 -07:00
Yuval Tassa d05251af2a Add tendon armature
PiperOrigin-RevId: 743939992
Change-Id: I587214f5d6fabbc0cc273c33d82decbe9ad8f919
2025-04-04 07:44:04 -07:00
Kyle Bayes 08d22baea1 Fix bug in horizon code in nativeccd where parallel faces are included in horizon.
PiperOrigin-RevId: 742687622
Change-Id: I4a180cb9c7451e0a2c22ffd77b7b6f6fd68836a4
2025-04-01 07:21:14 -07:00
Kyle Bayes 9ecec6f238 Fix bad contact from passing through polytope2 in nativeccd.
PiperOrigin-RevId: 742666700
Change-Id: I76034579b4e663f9abfa265ec3e2bc608f631f59
2025-04-01 06:11:20 -07:00
Yuval Tassa 05f3e914b0 Improve armature documentation
PiperOrigin-RevId: 742583729
Change-Id: I18d1c95a91f4d70b842c680d4a0f4d0b04476894
2025-04-01 01:16:58 -07:00
Kyle Bayes d6943731b2 Fix bug in nativeccd multiccd.
PiperOrigin-RevId: 740495321
Change-Id: I7eaa0da8514e27c233d49567c276d1d238808d1f
2025-03-25 14:56:21 -07:00
Yuval Tassa c931565fdc Add internal functionmj_tendonDot: time derivative of tendon Jacobian for one tendon.
Notes:
- Currently always uses dense math, even for sparse models. This should be easy to change in the future.
- Does not support geom wrapping. This is possible but harder, requires derivatives of mju_wrap.
PiperOrigin-RevId: 740378741
Change-Id: Id39ef2c4bfbb7ee11ec33c97d7d83140441cdab2
2025-03-25 09:36:30 -07:00
Kyle Bayes 12b40b948e Remove MuJoCo stack calls in nativeccd.
1. There is now thread local static memory for use with a conservative max number of iterations needed for contact.
2. For possible needs of high precision contact recovery with large iteration numbers (i.e. ellipsoid-ellipsoid collisions), there are callbacks to allocate memory when needed.

PiperOrigin-RevId: 739187134
Change-Id: I3d210f75218922d969c78465da3fe50da4fe3080
2025-03-21 08:20:51 -07:00
Yuval Tassa de48f4178f Add missing term in mj_jacDot
PiperOrigin-RevId: 735686836
Change-Id: I813ca46f71e368ddc97a6d2e540102137b31dbcf
2025-03-11 03:01:29 -07:00
Kyle Bayes 4d024f9421 Convert internal representation of vertices to double. Also replace remove duplicate vertices with fast hash implementation.
PiperOrigin-RevId: 734516595
Change-Id: Ic78556688d5f2b75d69cd286b8d060e2cdeb7c48
2025-03-07 05:17:49 -08:00
Yuval Tassa 0f563ecf31 Switch mjData.{qH,qLD} from reduced ("C") to full ("M") inertia matrix structure. No performance impact of extra zeros because of existing "simple dof" skipping mechanism.
PiperOrigin-RevId: 733523931
Change-Id: Ic8d8a152dda5532331c239cb6b4ce7d8d09b7fff
2025-03-04 17:34:35 -08:00
Kyle Bayes fbe0990b17 Fix bugs in nativeccd with collisions with margin.
PiperOrigin-RevId: 730903745
Change-Id: I45ddb674f32cb1f28ff37c587ea953ec595241b3
2025-02-25 08:51:21 -08:00
Alessio Quaglino 14c8dc62f0 Add termination character to flattened plugin attributes if empty.
Fixes #2450.

PiperOrigin-RevId: 730521722
Change-Id: Iec3fa377c65693d782eeb766a144a1c89096d1f3
2025-02-24 11:07:18 -08:00
Kyle Bayes 024616345d Support edge contacts with multiccd in nativeccd.
PiperOrigin-RevId: 730489114
Change-Id: I02847d84bbc15a1526391d5e1b7109ab83ea4a59
2025-02-24 09:48:43 -08:00
Kyle Bayes ae1c3b7ec0 Support multi-contact with meshes in nativeccd. Contacts are pruned to up to 4 per geom.
PiperOrigin-RevId: 730457036
Change-Id: Ib2368f3a7def4fdb94673620df3603e372c35745
2025-02-24 08:14:04 -08:00
Yuval Tassa 81b1948b46 Clean up engine_derivative_test.cc
PiperOrigin-RevId: 730166629
Change-Id: I3418be9f7b289f4109ae43c221b89199d2ccf325
2025-02-23 10:59:20 -08:00
Alessio Quaglino c52d1b3941 Remove the particle composite (replaced by replicate).
PiperOrigin-RevId: 730089997
Change-Id: If8d18fb56ae01241e76f84dbf7951e034026d829
2025-02-23 03:14:11 -08:00
Alessio Quaglino 0fcd20f0da Remove grid from composite types.
Replaced it with flexcomp in the models.

PiperOrigin-RevId: 730070619
Change-Id: Icbc69e4c6784c6252743f689a1eafb6482d0c393
2025-02-23 01:31:41 -08:00
Yuval Tassa b516edae1b Rename inertia factorization routines:
```
mj_factorI -> mj_factorI_legacy
mj_solveLD -> mj_solveLD_legacy
mj_factorIs -> mj_factorI
mj_solveLDs -> mj_solveLD
```

PiperOrigin-RevId: 728246367
Change-Id: I3bc7804cb96faac2ae5419ba9abfc3c1648ed4c6
2025-02-18 09:42:05 -08:00
Yuval Tassa fb07e0d1f7 Convert qLD to CSR format.
PiperOrigin-RevId: 728196818
Change-Id: I31bdf32e251293284426ed345019f27fd051a0e1
2025-02-18 07:14:45 -08:00
Yuval Tassa e39a5df06a mju_compressSparse(): add option to compress away small elements.
PiperOrigin-RevId: 726010576
Change-Id: Ib6458037a5cf9a9d82abb364b7dda7aab2f36807
2025-02-12 05:08:20 -08:00
Yuval Tassa 5ee0654830 Roll back recent change to mjData.qLD until some issues are resolved.
PiperOrigin-RevId: 724389161
Change-Id: I1b30ab0950ab5c5e611b1c6fc3bf3f42f964939c
2025-02-07 10:21:42 -08:00
Yuval Tassa c27d3758c2 Convert qLD to CSR format.
PiperOrigin-RevId: 723955038
Change-Id: I30c3dc7f59739e89ae5fff8841432bc74717ec1b
2025-02-06 08:59:35 -08:00