Alessio Quaglino
a02a27d4a4
Combine all mjs_attach functions into one.
...
PiperOrigin-RevId: 742702092
Change-Id: I89e35c59ada017cd061e2031584eeea71776743d
2025-04-01 08:05:58 -07:00
Alessio Quaglino
c0a7ea1edb
Added the element type mjOBJ_SPEC for mjSpec.
...
PiperOrigin-RevId: 742678572
Change-Id: I95a382ac58b5bc88c2aa5c07210549a1d5e2f538
2025-04-01 06:51:49 -07:00
Alessio Quaglino
86c970bc23
Add error checking in mjs_setFrame.
...
Also raise error if the frame is not found in the mjCBody copy constructor.
Fixes #2543 .
PiperOrigin-RevId: 742624013
Change-Id: I4999b3165c97f8d079412214d027ca7a8dae8cb3
2025-04-01 03:34:48 -07:00
Taylor Howell
0abf184d49
Align comment in mjmodel.h.
...
PiperOrigin-RevId: 741214316
Change-Id: I449c4a6e1c70b30d60636e11f26fb0bc8653f2a5
2025-03-27 11:05:46 -07:00
Alessio Quaglino
157b074116
Add signature to mjSpec and mjModel and use it to perform safe bind to mjModel and mjData.
...
PiperOrigin-RevId: 740378879
Change-Id: If14b326942529494f172e7aedcae30195798b458
2025-03-25 09:37:49 -07:00
Tom Power
be64747166
add mjs_detachDefault to delete a default class from mjSpec
...
PiperOrigin-RevId: 738452369
Change-Id: I5a53a6dc8f89e1e8136aeefc09d7d9b7b7204e1f
2025-03-19 10:31:04 -07:00
Alessio Quaglino
209d2bd2c5
Added functionality for user payload data in mjSpec.
...
PiperOrigin-RevId: 738343134
Change-Id: I6217362ced9993afcd5a2914c78718ffe3bf753a
2025-03-19 04:36:00 -07:00
Alessio Quaglino
1bf24e9f67
Do not overwrite existing parent frames for worldbody elements when attaching an mjSpec to a frame or a site.
...
PiperOrigin-RevId: 737662046
Change-Id: I7028c21c803c01845ae1d53cb476f7b3df172313
2025-03-17 10:21:38 -07:00
Yuval Tassa
bd9d30adc7
Improve documentation of mj_saveLastXML fixes #2075
...
PiperOrigin-RevId: 735672207
Change-Id: I951b8be9cf12a2a4965a40bb8db4de4ddda18570
2025-03-11 01:57:46 -07:00
Alessio Quaglino
e04e0e5c3d
Rename "facetexcoord" to "elemtexcoord" in mjsFlex element for consistency.
...
PiperOrigin-RevId: 734153759
Change-Id: Ic17d7c8a6e53fba04da511d405c815a723c5e55b
2025-03-06 08:28:36 -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
Yuval Tassa
c72c83aa3b
Allocate qM CSR matrix structure on mjData (currently empty).
...
PiperOrigin-RevId: 733247419
Change-Id: I814e574e3161875e89433a6e03f2c9e200d8b1d6
2025-03-04 02:37:47 -08:00
Alessio Quaglino
7651cb1b33
Copy texture coordinates from OBJ into flex. Fixes #2464 .
...
PiperOrigin-RevId: 732109960
Change-Id: I506b3540ab5d489ce8f10d0c473919611ccb654a
2025-02-28 06:04:19 -08:00
Kevin Sayed
06e217df7e
[MJ3.3.1] Bumping internal version number.
...
PiperOrigin-RevId: 731876412
Change-Id: I1c0f4a18bbc2e0bf80e01512ea196841848220af
2025-02-27 14:53:28 -08:00
Kevin Sayed
9996500de9
update the version number to 3.3.0 instead of 3.2.8
...
PiperOrigin-RevId: 731397143
Change-Id: I54089f1678097acf7e4998958effb396da1e47be
2025-02-26 11:42:55 -08:00
Kyle Bayes
ed16f2daf2
Set nativeccd as default.
...
PiperOrigin-RevId: 731343200
Change-Id: I315779017b676f3d118e0d38ee53a515272f50b8
2025-02-26 09:15:15 -08:00
Alessio Quaglino
ce82b63155
Add mjs_attachFrameToSite.
...
This is required in preparation of changing the spec.attach behavior in the Python bindings.
PiperOrigin-RevId: 730810198
Change-Id: I095808f0afe62b5bbd27201ed5c75804e0e9c4bf
2025-02-25 03:21:05 -08:00
Alessio Quaglino
6a86247810
Fix flex textures for 3D grids.
...
Fixes #2013 .
PiperOrigin-RevId: 728673726
Change-Id: Idb2b6bf9e5392576d0b09f3e71dbea6f4636ae81
2025-02-19 07:59:22 -08:00
Kyle Bayes
7f3bb062c3
Add fields in mjModel for supporting mesh multicontact in nativeccd.
...
PiperOrigin-RevId: 728659204
Change-Id: I7f8a11b082640284ea009d8693f228078680b953
2025-02-19 07:12:26 -08:00
Yuval Tassa
fb07e0d1f7
Convert qLD to CSR format.
...
PiperOrigin-RevId: 728196818
Change-Id: I31bdf32e251293284426ed345019f27fd051a0e1
2025-02-18 07:14:45 -08:00
Tom Power
89253d957d
Changes to inertia inference from meshes.
...
PiperOrigin-RevId: 726051033
Change-Id: I6edfc118280d103a2dd9d07f29f0094858769761
2025-02-12 07:43:13 -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
Alessio Quaglino
7cdf180641
Introduce trilinear flex parametrization.
...
These flexes use only 24 DOFs (3 per vertex of the bounding box), while colliding with the full high resolution mesh.
On an 8x8x8 cube, the performance using DOFs at all vertices is
```
Simulation time : 18.74 s
Steps per second : 533
Realtime factor : 0.53 x
Time per step : 1874.4 µs
Contacts per step : 114.88
Constraints per step : 3322.51
Degrees of freedom : 1536
```
With the new implementation, it is the following:
```
Simulation time : 1.82 s
Steps per second : 5507
Realtime factor : 5.51 x
Time per step : 181.6 µs
Contacts per step : 38.84
Constraints per step : 155.36
Degrees of freedom : 24
```
PiperOrigin-RevId: 721008829
Change-Id: I833df027527db578d86667cc4b24295bcf6f7d22
2025-01-29 09:38:22 -08:00
Yuval Tassa
67dd4827a6
Improve printing of inertia-like matrices, allow mj_printData to take const mjData*
...
PiperOrigin-RevId: 718176884
Change-Id: I057dabe6973e19db86e9ff9ce4430c6d17dfce2b
2025-01-21 19:59:45 -08:00
Yuval Tassa
240a7afdee
Add sensors for potential and kinetic energy.
...
PiperOrigin-RevId: 716775375
Change-Id: Ic8ab7f1a51df970ab551dabe7c797cde13cd97fd
2025-01-17 13:10:12 -08:00
Yuval Tassa
893a993bf6
Fix typos.
...
PiperOrigin-RevId: 716211176
Change-Id: Ibadfe13db89ed9047832b977e918faa3c5c6d9f1
2025-01-16 06:28:54 -08:00
Alessio Quaglino
c2138c3fb0
Do not copy the spec during attach.
...
Use a reference count for managing the memory.
PiperOrigin-RevId: 716169486
Change-Id: Id270c4858c17b9250115e9544d5ea143584e2d5f
2025-01-16 03:53:17 -08:00
Gabe Oppenheimer
6436055c6c
Update the version number to 3.2.8 following the 3.2.7 release.
...
PiperOrigin-RevId: 715870970
Change-Id: I9fc9a09d959043f3029faa7296a717ea56f75c89
2025-01-15 11:13:27 -08:00
Alessio Quaglino
05d4c3d670
Add mjs_getParent to retrieve the parent body of an object.
...
PiperOrigin-RevId: 715794859
Change-Id: Ib9792787cdb966f579938dde3f94ebabca8ef1fc
2025-01-15 07:42:43 -08:00
Yuval Tassa
2409a6e537
Add mjData.nA the number of non-zeros in the constraint inverse inertia matrix.
...
PiperOrigin-RevId: 714076988
Change-Id: I4c323a6e81dfb23f7972b662719bbcb688bacf4a
2025-01-10 09:23:55 -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
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
8cb253b6ca
Fix typos.
...
PiperOrigin-RevId: 710678815
Change-Id: Iab6f603f8f4d782ac7f34140add39e1f37625167
2024-12-30 04:15:29 -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
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
e310c23267
Fix return value of mj_saveXML and mj_saveXMLString, fixes #2247
...
PiperOrigin-RevId: 700269761
Change-Id: Ifb7e9c66c70eac7d681cfcf106712d47291cf9e2
2024-11-26 02:32:50 -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
Alessio Quaglino
38ee55a957
Remove unused userfacenormal field from mjSpec.
...
PiperOrigin-RevId: 698739284
Change-Id: I6407356ac12ad49454d15ecf9056f2c0bef713d5
2024-11-21 05:08:39 -08:00
Taylor Howell
aae5fd6906
Add nJmom, the number of non-zeros in sparse actuator_moment matrix, to mjModel.
...
PiperOrigin-RevId: 698343986
Change-Id: I3d4a4dea1ec095d4e7b231c2fffc0e6241cee39f
2024-11-20 04:30:47 -08:00
Yuval Tassa
5c23ae11ef
Fix bug in material texrepeat attribute, fixes #2223 .
...
Was mistakenly cast from float to int, bug introduced in 3.2.0
PiperOrigin-RevId: 697993181
Change-Id: I643a07e2b0866a4af56d7cbd3344e764a7caf56f
2024-11-19 06:30:55 -08:00
Yuval Tassa
9f51ba50db
Fix field ordering in mjModel.
...
`nnames_map` is not required for `mjModel` construction, it is set during construction.
PiperOrigin-RevId: 696462793
Change-Id: Ie722e2a04d7fd7ed96634d3304cc94e895ed713b
2024-11-14 03:45:34 -08:00
Taylor Howell
c68ee8055e
Fix ordering in mjxmacro.h.
...
PiperOrigin-RevId: 696058596
Change-Id: I6359c082e528c1f53591033ea61c352ba5e13763
2024-11-13 03:12:24 -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
Alessio Quaglino
ebe60b9ad5
Add const to mjsDefault when used as function argument.
...
Fixes #2197 .
PiperOrigin-RevId: 692346264
Change-Id: Iddb9be1377a7d59c86911802d8c5563f6bf6b043
2024-11-01 18:18:42 -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
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
Yuxuan Jiang
e1cb43819a
Fix typo in MJDATA_VECTOR definition
2024-10-30 14:27:32 +08:00