Commit Graph

598 Commits

Author SHA1 Message Date
Yuval Tassa 7eb8231fda Represent only the lower triangle in Newton solver's reduced dof-dof matrix.
PiperOrigin-RevId: 712488529
Change-Id: Iad91c72654376539791d7856765a0d0ac9088251
2025-01-06 04:58:55 -08:00
Yuval Tassa daed8f46c8 Don't assume compressed input in mju_transposeSparse, allow NULL pointer for matrix values, to only transpose the structure.
PiperOrigin-RevId: 712472432
Change-Id: I6dd34583ab181f0c9677c55230cecdf0aed46f9e
2025-01-06 03:51:35 -08:00
Yuval Tassa 94230a8bee Fix bad indent.
PiperOrigin-RevId: 712267512
Change-Id: I3463b0f53b808b726ff0fe5ea46ec8d30164eac4
2025-01-05 09:12:50 -08:00
Yuval Tassa abe8ffdee7 Enable AVX for inlined mju_dotSparse.
PiperOrigin-RevId: 711858423
Change-Id: Id2d06a9e87085e9f810779fba4e8ed9c19a4cba9
2025-01-03 14:42:00 -08:00
Kyle Bayes 340c0d7c97 Fix a box-box bad collision in NativeCCD.
PiperOrigin-RevId: 711773153
Change-Id: I8a526ef5933be19d863e67f40edeb95b0b1249cd
2025-01-03 09:23:57 -08:00
Yuval Tassa 63e2836f63 Expose mj_printSparsity in engine_print.h.
This is useful for debugging sparse operations.

PiperOrigin-RevId: 711765082
Change-Id: I532a5218da0f921dd4b04730d0b12c5136e7ca65
2025-01-03 08:51:46 -08:00
Yuval Tassa 923f75fd23 Use only lower triangle in CSR back-substitution.
PiperOrigin-RevId: 711686157
Change-Id: I4fc98cdfb927e5608ce3a99ea34890ce556fcfd7
2025-01-03 02:33:59 -08:00
Yuval Tassa 6c880eb0fa Clean up mju_sqrMatTDSparse
PiperOrigin-RevId: 711486739
Change-Id: I5f9145dcd8522a9cb372cbdf60611d7d05cb524e
2025-01-02 12:02:10 -08:00
Yuval Tassa 4510c6d290 Further speedup to CSR back-substitution using dof_simplenum.
PiperOrigin-RevId: 711440268
Change-Id: I81cd9a6a8b8ec78d08cfbc34f60a9216ea753833
2025-01-02 09:04:51 -08:00
Yuval Tassa 69c9ac074a Remove mjData.qLDiagSqrtInv, add corresponding argument to mj_solveM2.
- `qLDiagSqrtInv` is only required for the dual solvers. It is now computed as-needed rather than unconditionally.
- `mj_solveM2` now requires a new input array `sqrtInvD` which contains the square root of the inverse diagonal D (formerly saved in `qLDiagSqrtInv`).

PiperOrigin-RevId: 710805133
Change-Id: I0622d6a8da3882916824e9c10bad9223c122c321
2024-12-30 15:24:36 -08:00
Yuval Tassa ec322641b7 Fix bug in mj_mulM2.
PiperOrigin-RevId: 710756899
Change-Id: I30c0725859ba0f1a59750dc89eebb9eba84fa71b
2024-12-30 11:14:56 -08:00
Yuval Tassa e42370c982 Avoid allocation and copying in implicit solver's addJTBJSparse
PiperOrigin-RevId: 710679558
Change-Id: Ie75fdcd1127ff619c2668f568ab6a8a11e079dda
2024-12-30 04:19:10 -08:00
Yuval Tassa 8cb253b6ca Fix typos.
PiperOrigin-RevId: 710678815
Change-Id: Iab6f603f8f4d782ac7f34140add39e1f37625167
2024-12-30 04:15:29 -08:00
Yuval Tassa 0336114a88 Add restrict to output variable in mj_solveLDs.
PiperOrigin-RevId: 710358020
Change-Id: Ia63048161d7622f21954e98346b7ff4e37ecb342
2024-12-28 16:05:18 -08:00
Yuval Tassa a8a9607712 Inline mju_dotSparse in engine_util_sparse.h
PiperOrigin-RevId: 709577108
Change-Id: I76547122b5780bec76a12384effcb66315f84e13
2024-12-25 08:09:42 -08:00
Yuval Tassa 3f855f32d9 Fix stack allocation leak in mjv_addGeoms()
PiperOrigin-RevId: 708356387
Change-Id: If3d227028ea8f809390911b578878d985d9d7b1a
2024-12-20 10:11:18 -08:00
Yuval Tassa b26d6f0466 Disable tendon catenary visualization when tendon is actuated. Add note about catenary visualization.
PiperOrigin-RevId: 706161179
Change-Id: Ifaf571e039306309869078d1a0bcf9a69f1fe9de
2024-12-14 01:54:40 -08:00
Kyle Bayes ec230fa4b6 Prune face linear map in EPA.
PiperOrigin-RevId: 705138358
Change-Id: I835ce7094d066b19ee39af48e0b83b51f7a0954e
2024-12-11 09:44:19 -08:00
Yuval Tassa 2691887500 Add engine-internal convenience macro for allocating typed arrays, improve error message.
PiperOrigin-RevId: 705126655
Change-Id: I2bd8fada6d33a919d2fb82297f93ac57958355a4
2024-12-11 09:04:44 -08:00
Kyle Bayes a364308d5a Use GJK to recover contact points for sphere and capsule geoms in nativeccd.
PiperOrigin-RevId: 704727907
Change-Id: Iff641b6a32637c48e9892dbaa60826617c54ed06
2024-12-10 08:53:27 -08:00
Yuval Tassa 1c4c7b012c CSR implementation of mj_solveLD.
PiperOrigin-RevId: 704316200
Change-Id: Ibaff0284e40b3ebbe43bb489b6211ce739270e27
2024-12-09 09:34:17 -08:00
Yuval Tassa 537fc2ff45 Use diagonal index to speed up mju_solveLUSparse.
PiperOrigin-RevId: 704303282
Change-Id: I72c3fbcd31a5564fc792b73efe9d12a151b4d60f
2024-12-09 08:53:25 -08:00
Yuval Tassa 3a14ada308 Store index of diagonal element for C and D in mjData.
PiperOrigin-RevId: 704287869
Change-Id: I15d1faa0b5c3ff54721f692ec6329726456ec318
2024-12-09 08:01:30 -08:00
Yuval Tassa 0ba717a653 Print supernode values in mj_printData
PiperOrigin-RevId: 702677257
Change-Id: Icecc5dd8604fcadc02bba5fc69c9fd5fd4fbd825
2024-12-04 04:41:10 -08:00
Yuval Tassa 0e7d2ef6df Fix bug in box-sphere collider. Fixes #2206
PiperOrigin-RevId: 702627603
Change-Id: Ie6015b7fa6f8507459325d692581b0f5f83aa159
2024-12-04 01:19:27 -08:00
Gabe Oppenheimer c90a63a926 Update the version number to 3.2.7 following the 3.2.6 release.
PiperOrigin-RevId: 702103729
Change-Id: Id5581cc823a17360e7bb98ac0aa4342020c1aefa
2024-12-02 15:30:52 -08:00
Alessio Quaglino 300450f8b8 Add circle to flexcomp and remove rope and loop from composite.
Add pulley example to show a circle use case.

Switch on flex edge rendering by default (no effect when flex skin is rendered).

PiperOrigin-RevId: 700738379
Change-Id: I8469bbf194de01c8dab66c9a51c49879013df141
2024-11-27 10:14:25 -08:00
Alessio Quaglino 203602b01f Move computation of flex_vert0 to user_mesh.cc.
This removes the dependency of flex_vert0 from mj_flex and mjData.

PiperOrigin-RevId: 700382297
Change-Id: I0b6d023c2e1ba14fa92417b65bfc288f37c223ae
2024-11-26 10:17:16 -08:00
Alessio Quaglino 7e46e21ef3 Add mju_mat2Rot.
This function extracts the 3D rotation from an arbitrary 3x3 matrix by refining the input quaternion. It is based on the paper "A robust method to extract the rotational part of deformations" by Müller, Matthias, Jan Bender, Nuttapong Chentanez, and Miles Macklin.

PiperOrigin-RevId: 700006006
Change-Id: I77550993233dea9cdf68601762a3ae7ded749bdf
2024-11-25 09:19:10 -08:00
Yuval Tassa 1d64362adc Add mjv_copyModel to copy mjModel, skipping large arrays not required for abstract visualization.
This functionality is meant for fast copying of `mjModel` when synchronizing the visualization state, as in the Python passive viewer.

PiperOrigin-RevId: 699199743
Change-Id: I13a5160063eb09139ec1aee9c4969bc1c6f547f1
2024-11-22 09:38:08 -08:00
Yuval Tassa cedd602bc1 Compress dense rows in mjData.actuator_moment
PiperOrigin-RevId: 698516133
Change-Id: Idd861c2b63d77748a6282d72f8241eaeeb88006c
2024-11-20 14:10:28 -08:00
Yuval Tassa 1767c11d46 Direct assignment of mjData.moment_rownnz
This allows for better sanitizer coverage, errors will be caught upon read rather than upon use.

PiperOrigin-RevId: 698458735
Change-Id: I3003f3a122b83bbf42a6510260abbb8353c56a40
2024-11-20 11:24:36 -08:00
Taylor Howell a1b18e707a Compress actuator_moment memory using nJmom <= nu x nv.
PiperOrigin-RevId: 698446692
Change-Id: I49c9633e12129a1e690724db82d1f11204e41d9c
2024-11-20 10:53:07 -08:00
Kyle Bayes 0cb35a0fe1 Populate missing fields in mjCCDStatus in GJK code.
PiperOrigin-RevId: 696965759
Change-Id: Idf0799a44876e95fc8d688dd39663a34f1808b27
2024-11-15 12:24:37 -08:00
Kyle Bayes f91588a171 Fallback to polytope3 if tetrahedron from GJK has the origin on a face (most likely due to a numerical issue).
PiperOrigin-RevId: 696872633
Change-Id: I58edb0fdc30ad472c8f1338df728e8d42c25fc39
2024-11-15 06:53:00 -08:00
Kyle Bayes 0a0de6615d Back out of gjkIntersect when convergence fails due to algorithm oscillating between two support points. Also, fix related bug in box support function.
PiperOrigin-RevId: 696482893
Change-Id: Icedaf5489b761b8bf03ec30558b5d1128668a647
2024-11-14 05:12:32 -08:00
Yuval Tassa 536c60a0ac Print arena usage percentage in mjData print.
PiperOrigin-RevId: 696464274
Change-Id: Ib794148e037521118138bd72c021dbe086c9681a
2024-11-14 03:52:41 -08:00
Kyle Bayes 0e8cca93e1 Refactor nativeccd interface.
- Update mj_ccd interface for multi-contacts,
- Support GJK cutoff distance, and
- Remove mjc_fixNormal from nativeccd (causes bug with cylindar box collisions).

PiperOrigin-RevId: 696185362
Change-Id: I4828b7ee1bde078268220172a4937cd553f6187e
2024-11-13 10:28:45 -08:00
Kyle Bayes eb77d5b933 Fix bug in mesh hillclimbing support function.
PiperOrigin-RevId: 695710616
Change-Id: I2127aee584c13efb44d70cc4e267354ca0b80bf0
2024-11-12 06:36:55 -08:00
Yuval Tassa 414b677eb8 print memory footprint of model and data
PiperOrigin-RevId: 694088011
Change-Id: I3b743df2a59f554414b440aebfa6bf0d0e29b2d8
2024-11-07 05:56:02 -08:00
Yuval Tassa 18f88efe17 Contact visualization: if penetration is deeper than height, extend cylinder to show computed depth.
PiperOrigin-RevId: 693869892
Change-Id: I1c873e3803286d6a636336246f498552617e978b
2024-11-06 14:46:31 -08:00
Kevin Sayed 276f5b04cd Bump MuJoCo version to 3.2.6.
PiperOrigin-RevId: 693472991
Change-Id: Ic202f52dd42c55c43ba05ca21b5cc6a4024b0c72
2024-11-05 14:13:08 -08:00
Taylor Howell a51f346059 Use sparse (uncompressed) actuator_moment in mj_transmission.
PiperOrigin-RevId: 692179704
Change-Id: Ic30ac5a98dc13de2028e378df65dc88ba3912bf5
2024-11-01 08:06:28 -07:00
Yuval Tassa c9f78ad8a8 Rename nnzJ to nJ in mjData.
This naming is more consistent.

PiperOrigin-RevId: 691858223
Change-Id: Ife3db822afa0b51b30d0792548b35b3742da388a
2024-10-31 10:43:10 -07:00
Kyle Bayes 18682aac6a Fix function definition formatting.
PiperOrigin-RevId: 691782530
Change-Id: Ib1611285e77e274b17074d5f09ede00cdc0c6f0f
2024-10-31 06:45:41 -07:00
Alessio Quaglino 94bbf297fc Replace flex_xvert0 with flex_vert0
`flex_xvert0` stored the Cartesian position of the vertices in `qpos0`. This array was unused, so it is now replaced with `flex_vert0`, which still contains the positions of the vertices, but normalized on the bounding box of the flex so that the coordinates are in `[0,1]^m->flex_dim`. This will be useful in the future for using different interpolation methods for computing flex deformations.

PiperOrigin-RevId: 691779361
Change-Id: I5c4223103cd4558f4e268fe3e8d8177541e4754f
2024-10-31 06:30:36 -07:00
Yuval Tassa 70d944b458 micro-optimization to mju_mulMatTVecSparse
PiperOrigin-RevId: 691431137
Change-Id: I95f94ff38ae911194b21aa220af35c7374af9739
2024-10-30 08:41:18 -07:00
Taylor Howell ce5f8b4728 Fix typo in mju_muscleDynamics comments.
PiperOrigin-RevId: 690949399
Change-Id: I8102fb72cce909786eab0771467c7f6f751792bf
2024-10-29 03:31:28 -07:00
Yuval Tassa 864b805a6e Fix multiple bugs related to connect and weld constraints with site semantics. Fixes #2179
The introduction of site specification to connects and welds in 3.2.3 conditionally changed the semantics of `mjData.eq_obj1id` and `mjData.eq_obj2id`. These changes were not properly propagated in several places leading to incorrect computations of constraint inertia, readings of affected force/torque sensors and runtime enabling/disabling of such constraints.

PiperOrigin-RevId: 690670420
Change-Id: I55ee8a013cbee8457f8d6c7f33c2981aedafbab6
2024-10-28 10:44:04 -07:00
Copybara-Service d95befaddd Merge pull request #2180 from pschmutz:schmutz/error_handling_when_loading_plugins
PiperOrigin-RevId: 690567811
Change-Id: I2d2c4e37e74ab4d97c0add5633feb766ef66dd08
2024-10-28 05:11:14 -07:00