Commit Graph

2595 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool 40ef08c8ed Don't pollute the global namespace when using mjpython.
Fixes #2265

PiperOrigin-RevId: 713442833
Change-Id: If155d9f57d4deef8b848478ebd8077a00417d5c5
2025-01-08 15:48:20 -08:00
Saran Tunyasuvunakool 357ea024c0 Remove unconditional mj_markStack in mjv_addGeoms.
Prior to commit 3f855f32d9, calling `mjv_updateScene` and `mjv_updateSceneFromState` on an "empty" `mjData` (one without a buffer but where all sizes are also zero) was a valid operation. The `mj_markStack` call requires free stack space, so a call to `mjv_addGeoms` on an empty `mjData` results in a stack overflow whenever `mjVIS_TENDON` is enabled.

Fixes #2305.

PiperOrigin-RevId: 713418586
Change-Id: I99b5de23fe94ba9aa86eeef0700c891976c9aecc
2025-01-08 14:32:44 -08:00
Yuval Tassa f912e8df16 Print sparsity structure of mjData.efc_AR
PiperOrigin-RevId: 713296073
Change-Id: Ifede6ea66dd1177f5e85c8498860decebaa65f06
2025-01-08 08:12:47 -08:00
Alessio Quaglino 6654d63438 Add spec lookup in the attached spec array using the compiler option pointer.
This enables to find the spec associated with the compiler option stored in the objects, which do not necessarily belong to the model that owns them.

PiperOrigin-RevId: 713259419
Change-Id: I579c770147ff07ed2a5edd20e7a795ee7cc27147
2025-01-08 05:44:00 -08:00
Yuval Tassa 8a5f092081 Allow CSR back-substitution to handle multiple vectors.
PiperOrigin-RevId: 713229673
Change-Id: I7a5b43fe966cf9e482bd41e2eea6c30dd3ffa1d4
2025-01-08 03:32:16 -08:00
Yuval Tassa 4d82ab5762 Add function to merge chains of indices.
PiperOrigin-RevId: 712863690
Change-Id: I15652bec03dc9ce90e230788bd12b44b1a2b8217
2025-01-07 04:42:11 -08:00
Yuval Tassa 1c69e64e6e Extend test comparing dense and sparse pipelines to all solvers.
PiperOrigin-RevId: 712862658
Change-Id: Ieb8515d32a225a098ab96055598a5d56bad7e476
2025-01-07 04:37:04 -08:00
Yuval Tassa 674d227050 Standardize names of sparse fill-in pre-counting functions
PiperOrigin-RevId: 712835830
Change-Id: I8e90dfa52af56ede917e1fd90b8d551898c244e5
2025-01-07 02:39:46 -08:00
Baruch Tabanpour 0be7e6a1f6 Fix #2306.
PiperOrigin-RevId: 712575320
Change-Id: Ia74ef0b31b4e7098647340760572a1f6368eab64
2025-01-06 10:28:12 -08:00
Alessio Quaglino f607d9554e Check that there are no pending keyframes while writing a spec.
This can happen when a body is detached without compiling or recompiling.

Also added error catching when trying to delete a body instead of detaching it.

Fixes #2327

PiperOrigin-RevId: 712526730
Change-Id: I4b48df83120fca12d475c85b3a54893841449653
2025-01-06 07:50:30 -08:00
Yuval Tassa b5df2c10bf Remove mjData.C_diag, no longer required as C is now lower triangular.
PiperOrigin-RevId: 712514204
Change-Id: I8293f65ebc09c6a8fed76b0e59d2e2a667e01a43
2025-01-06 06:58:19 -08:00
Yuval Tassa ac11e5faa6 Add CSR implementation of mj_factorI
PiperOrigin-RevId: 712498431
Change-Id: I13b52e53482ed97da8788875d4d95e2beb5ca7c1
2025-01-06 05:48:14 -08:00
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
Alessio Quaglino ee6f4837f3 Auto-generate 3D mesh from convex OBJ if dim=3 in flex.
This requires the user to explicitly specify an origin.

PiperOrigin-RevId: 712483526
Change-Id: Ie316a5eccb676bb918d4bb746795019145c10f5b
2025-01-06 04:35:59 -08:00
Alessio Quaglino 65048d6b8f Do not use fast lookup for frames.
Fast lookup is not possible since mjOBJ_FRAME > mjNOBJECT, which is the size of the objects maps used for the search.

Fixes #2328.

PiperOrigin-RevId: 712479460
Change-Id: I7bcfa75ff8a1e288183d60ed4a44cab5bc6f4173
2025-01-06 04:17:41 -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 e67599f517 Add weak deprecation notice include in XMLreference.
PiperOrigin-RevId: 710300945
Change-Id: I5a3dd066ef643d606d97ec36ffe1e797bb628659
2024-12-28 08:50:31 -08:00
Yuval Tassa 8dd360a2c0 Add some elements to test model.
PiperOrigin-RevId: 710067190
Change-Id: I478085b8177ea8ebfa4190db8eb722c306c9793e
2024-12-27 08:18:46 -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 ea98c57921 Clean up engine_core_smooth_benchmark_test.
PiperOrigin-RevId: 709573203
Change-Id: I461f259c33d74b3eaf0b6fe58124fe09418c5303
2024-12-25 07:44:25 -08:00
Yuval Tassa 273ced428a Add simple unit test for mjv_updateScene.
PiperOrigin-RevId: 709334033
Change-Id: I69adc1d3ad0565f3684346749a372894d12ce99a
2024-12-24 06:44:02 -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
Erik Frey 4d0865c2e8 Add light fields to mjx.Model, needed for Madrona.
PiperOrigin-RevId: 707996293
Change-Id: I238dac72b8f209955b2a1060571db3b14e355dd5
2024-12-19 12:42:09 -08:00
Copybara-Service 526637f118 Merge pull request #2276 from traversaro:reducetestboilerplate
PiperOrigin-RevId: 707613522
Change-Id: Ic945c6b057b77f3462dbdb758139af12133f6a8f
2024-12-18 11:22:59 -08:00
Kristian Hartikainen edec8c5e3a Copybara import of the project:
--
0e1aae484a1a6d2d52d0b99bf62f116d42ed9a1f by Kristian Hartikainen <kristian.hartikainen@gmail.com>:

Fix typo in `changelog.rst`

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/2298 from hartikainen:patch-1 0e1aae484a1a6d2d52d0b99bf62f116d42ed9a1f
PiperOrigin-RevId: 707528220
Change-Id: Ie3bc28cf7a8456e4ba8bfc405ab7190a84d5a69e
2024-12-18 06:31:09 -08:00
Alessio Quaglino 644dfc7fb5 Fix assigning bytes to texture data.
PiperOrigin-RevId: 706747323
Change-Id: I6b0ee67d4f35db3a149ba8d9979546d3c712bb8b
2024-12-16 10:05:23 -08:00
Levi Burner a7eb6efd4e Copybara import of the project:
--
3a95b62f59e81bfef0f076afb173ecc14b27943d by Levi Burner <leviburner@gmail.com>:

rollout prototype native threadpool for comparing to python threads

--
efd8be1124ac839b902de45973a3ca8b9f2215e6 by Levi Burner <leviburner@gmail.com>:

copy mjpcs threadpool into python bindings

--
75603eea3e8362e354a9675e8a6cd14e56ec3d28 by Levi Burner <leviburner@gmail.com>:

rollout use threadpool as translation unit

--
06b90febd021663f6cc81fd7895e4d6e2008ed97 by Levi Burner <leviburner@gmail.com>:

rollout add chunk_divisor parameter

--
298ab2f3c0d6e12530832c3cdbf784dd92d54806 by Levi Burner <leviburner@gmail.com>:

rollout add native threading test

--
169cf9978e7abad6edd1392b8e6aab995e4f8f10 by Levi Burner <leviburner@gmail.com>:

rollout exchange chunk_divisor arg for chunk_size

--
265af851d74432d261277d3dbda11cdef1841bc8 by Levi Burner <leviburner@gmail.com>:

rollout fix cosmetics

--
1e8bffa88bf36190501b334bef31147e23db39f7 by Levi Burner <leviburner@gmail.com>:

make native rollout a class instead of a function

--
ba788214b047577f58c41ce0ab6c62c277cd8b0d by Levi Burner <leviburner@gmail.com>:

rollout update docs and changelog

--
e4cb7732319e04cba2ab2c2ad848c659f6309808 by Levi Burner <leviburner@gmail.com>:

rollout don't register atexit handler for Rollout objects

--
5a08d2efdbbbb01d4b1231ff9a36a1dc44f4d9ee by Levi Burner <leviburner@gmail.com>:

rollout nthread kwarg, rename shutdown_pool to close, fixups

--
f622378543596a208339af0208fa3a70bf2a8007 by Levi Burner <leviburner@gmail.com>:

rollout add missing .close() calls

--
50f3ebca43c53eac03f03943c34bb1e46967bd4f by Levi Burner <leviburner@gmail.com>:

rollout return immediately

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/2282 from aftersomemath:rollout-threaded 50f3ebca43c53eac03f03943c34bb1e46967bd4f
PiperOrigin-RevId: 706744277
Change-Id: I1ab2263b7d6ce30cf1908aec8fd5f2eb976a19e6
2024-12-16 09:57:08 -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
Yuval Tassa 3ca97248a3 Fix comparison in engine_core_constraint_test.
(was comparing number to itself)

PiperOrigin-RevId: 705053943
Change-Id: I3d179ab4bb2ed1bc1b74b4edec7ce1114ad16b37
2024-12-11 04:11:13 -08:00
Yuval Tassa 049a260102 Remove superfluous newlines in Schema exception messages.
PiperOrigin-RevId: 704781176
Change-Id: Ie23ac2deab4a5173e1e7a60ffe9e751fe054a2dc
2024-12-10 11:18:51 -08:00
Yuval Tassa f4593d5d79 Highlight XML strings using pygments in mjSpec notebook.
PiperOrigin-RevId: 704751058
Change-Id: Iaf7fae7f13ef12d59bac762170a6dfca01494164
2024-12-10 10:06:52 -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 a7fed25fdd Document how to save MjSpec to XML. Fixes #2075
PiperOrigin-RevId: 704712337
Change-Id: I51c1a14c5c48ffc8e37d9e31162a3e70a3b10313
2024-12-10 08:05:01 -08:00
Copybara-Service 83c0ac148c Merge pull request #2277 from traversaro:patch-43
PiperOrigin-RevId: 704676667
Change-Id: I9e0161afc7a6b9f45464498aad35337d1d9f9eaa
2024-12-10 06:05:56 -08:00
Copybara-Service 4a40e3fd15 Merge pull request #1721 from stonfute:main
PiperOrigin-RevId: 704632980
Change-Id: Iaf90ef7443dd1c519a6df237dfbc4c33c28f179e
2024-12-10 03:17:08 -08:00
Baruch Tabanpour f3b3024291 Add pyink and isort config. Reformat.
PiperOrigin-RevId: 704533915
Change-Id: I37e9fd51261bd166b725c7460fc65d02fed2b391
2024-12-09 21:10:50 -08:00