Commit Graph

169 Commits

Author SHA1 Message Date
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
Yuval Tassa fb07e0d1f7 Convert qLD to CSR format.
PiperOrigin-RevId: 728196818
Change-Id: I31bdf32e251293284426ed345019f27fd051a0e1
2025-02-18 07:14:45 -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 8c22181156 Fix documentation typos.
PiperOrigin-RevId: 720232771
Change-Id: I176db4d4168c37b2819df14b439c4cde838e2025
2025-01-27 10:58:22 -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
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
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
Kevin Sayed 276f5b04cd Bump MuJoCo version to 3.2.6.
PiperOrigin-RevId: 693472991
Change-Id: Ic202f52dd42c55c43ba05ca21b5cc6a4024b0c72
2024-11-05 14:13:08 -08:00
Kyle Bayes 1d58576d28 Fetch source code line links for API functions on docs client side.
PiperOrigin-RevId: 692115441
Change-Id: Ifbedf6a4998000f99e2275cb43293b3050daf0ee
2024-11-01 03:28:53 -07:00
Taylor Howell f47840e57c Add mju_dense2sparse to public API.
PiperOrigin-RevId: 691125900
Change-Id: Id9b7c739ee14bff2317168da258b1a3acbdafdbe
2024-10-29 12:47:48 -07:00
Yuval Tassa d8494fef3b Remove deprecated mjv_makeConnector function.
PiperOrigin-RevId: 690563333
Change-Id: Ice9c6b6cf41de8a55fa361477f9aee9181d50184
2024-10-28 04:51:47 -07:00
Yuval Tassa 61cb552f8a Refactor PBR texture layers from separate sub-elements to a single layer sub-element.
Add new element to PyMJCF schema.

PiperOrigin-RevId: 690115286
Change-Id: I7bb3f184cb321ca96037b2ca0ee160efef37469d
2024-10-26 07:41:38 -07:00
Yuval Tassa a3ea01e57e Remove deprecated mju_rotVecMat and mju_rotVecMatT functions.
PiperOrigin-RevId: 689405782
Change-Id: I0281376d5d6f5c31ea2603d61c03c7b94aaa6312
2024-10-24 09:15:23 -07:00
Alessio Quaglino 159f23e6b4 Remember compiler options during attach.
Note:
- Move compiler options into `mjsCompiler` struct.
- The compiler options from the attached model are not written by mj_SaveXML.
PiperOrigin-RevId: 689391440
Change-Id: I1d63c146a32f87c737b7a55b64a54b0ffe3aecc9
2024-10-24 08:31:15 -07:00
Alessio Quaglino d17d9e835c Do not delete attached specs after compilation.
Also, copy them when copying the spec.

PiperOrigin-RevId: 688998464
Change-Id: I7229fd8032eafede582194ccf73ab4160fe06768
2024-10-23 09:42:05 -07:00
Yuval Tassa e14aebfd16 Expose mju_sparse2dense to public API.
PiperOrigin-RevId: 688985153
Change-Id: I9559f1d47363d0afada80c86abdc729cd1910b63
2024-10-23 09:01:25 -07:00
Alessio Quaglino dcf2816543 Remove copy_back from Python bindings and mj_copyBack from the C API.
PiperOrigin-RevId: 687377331
Change-Id: I355493d92857418b08b5aa90ea38cebe5c475314
2024-10-18 11:55:04 -07:00
Google DeepMind ffdb800e45 Update the MuJoCo version for the 3.2.5 release following the 3.2.4 release.
PiperOrigin-RevId: 686641388
Change-Id: I68d5183c9d369b7617f692ab97c12c53f0d2504c
2024-10-16 14:24:06 -07:00
Gabe Oppenheimer c2024ef6d1 Update the MuJoCo version for the 3.2.4 release.
PiperOrigin-RevId: 686261295
Change-Id: Ib59e44a6829a79fd480f2822a68cb05f94c38732
2024-10-15 15:34:09 -07:00
Alessio Quaglino 766cd20273 Add mjs_bodyToFrame() to convert a body to a frame.
Also add test for attaching the world body.

PiperOrigin-RevId: 685603933
Change-Id: I3cfe7d226d6f032b5a587e44d0f4f18207977188
2024-10-14 00:39:20 -07:00
Alessio Quaglino cdb167f275 Add mjs_attachToSite for attaching a body to a site.
PiperOrigin-RevId: 684432183
Change-Id: I7100bebfb6521f9dbfbb07f31490b2b9298bf18c
2024-10-10 07:12:49 -07:00
Alessio Quaglino a26ba2012e Return 0 on success from mjs_activatePlugin instead of using mju_error.
PiperOrigin-RevId: 684102823
Change-Id: I86b7702094ae886539e1dfb6294381952d507bc1
2024-10-09 11:09:33 -07:00
Alessio Quaglino 1f9dca8bc4 Do not expose plugin_slot.
PiperOrigin-RevId: 683215401
Change-Id: Ic64f7221ed83ca3b0c8cca16eb680ea67c67b564
2024-10-07 09:38:01 -07:00
Alessio Quaglino 6e66cafe76 Capture mjs_attach error message in the Python bindings.
PiperOrigin-RevId: 682409212
Change-Id: I391ee48626e7dcd985f65a231370ef5ec16124d7
2024-10-04 12:19:42 -07:00
Alessio Quaglino 89aea5e217 Add body.find_all() to Python bindings.
This enables to generate a list of all body children of a given type.

Also, add recursive option to mjs_firstChild and mjs_nextChild. Fixes #2112.

PiperOrigin-RevId: 681039348
Change-Id: Iebbb26fd5ec314150206edfdddd88633baa0bec6
2024-10-01 08:57:25 -07:00
Alessio Quaglino 6832df3091 Replace mjs_setActivePlugins with mjs_activatePlugin.
PiperOrigin-RevId: 680613007
Change-Id: Ic03e0dc42a1f5f083e313672bc6e3ccebadc58b3
2024-09-30 09:46:47 -07:00
Alessio Quaglino 25e4d75a07 Return attached body/frame in mjs_attachBody/Frame.
PiperOrigin-RevId: 679601525
Change-Id: Icdc4616808e14bf0a3ebc17d89392382d084c31b
2024-09-27 08:34:00 -07:00
Yuval Tassa 41ea95f077 Add a section for element casting in the function API reference, move these functions to the end.
PiperOrigin-RevId: 677783917
Change-Id: I5042e7df20f2a2e0ecfe01a85a1969ccfc2307cd
2024-09-23 07:26:01 -07:00
Alessio Quaglino 0ba11b9623 Add plugins list to mjSpec Python API.
Fixes #2061.

PiperOrigin-RevId: 677762985
Change-Id: I8e407373e7b505d9b0f1c023e97c5ea92169bbf6
2024-09-23 06:13:42 -07:00
Yuval Tassa be00fafc43 Various documentation improvements.
- Replace two "below" instances in `XMLreference.rst` with proper links (there are many more that need fixing).
- Discuss friction cones and 32-bit floats in Performance Tuning.
- Delete Damping subsection in Tips and Tricks, no longer relevant after the introduction of the implicit/fast integrators.
- Simplify discussion of free bodies, mention free joint alignment.
- Clarify frame used by kinematic Jacobians.

PiperOrigin-RevId: 672615057
Change-Id: Ib59b71e3c09cdd13415519fc4a964131b155718f
2024-09-09 11:36:07 -07:00
Kyle Bayes 81618f95f9 Update doc for mj_addFileVFS and mj_addBufferVFS as VFS is no longer memory limited.
PiperOrigin-RevId: 671087960
Change-Id: I0b022554f4f47fe2e64c8201cd855b63d514c344
2024-09-04 13:51:43 -07:00
Yuval Tassa b502ceef00 Add note that XML saving requires that the spec first be compiled. Fixes #1832
PiperOrigin-RevId: 671046666
Change-Id: If5885545d5316537147d293fbe854caa568558b2
2024-09-04 11:47:34 -07:00
Yuval Tassa 8954a088ce Add automatic free-joint alignment.
PiperOrigin-RevId: 671010083
Change-Id: Ib7d60f75c7f545b1886703715663db8de77feeef
2024-09-04 10:07:33 -07:00
Alessio Quaglino d3dfa6f970 Add mjs_findElement() to find any element in a spec by name.
Also, remove mjs_findMesh() and mjs_findKeyframe().

PiperOrigin-RevId: 670978980
Change-Id: Id88b800eb8a4c5efc40866f72a4442bf1d1437d0
2024-09-04 08:24:22 -07:00
Yuval Tassa 2d3d5415b7 Add mj_jacDot: Time derivative of kinematic Jacobian.
PiperOrigin-RevId: 670505417
Change-Id: Icf30cff5dc955e002bd2f5d5fb3a04f8388d0780
2024-09-03 04:49:47 -07:00
Alessio Quaglino 505d01a1c1 Add error handling to mj_recompile.
This CL adds error handling to the mj_recompile function. If the recompile fails, the function will return -1 and set the error message in the spec. The Python wrapper for mj_recompile will catch the error and raise a ValueError exception.

PiperOrigin-RevId: 666784579
Change-Id: I225eca1769ea839c782be3c03fc4ff1ea5885a48
2024-08-23 07:18:28 -07:00
Yuval Tassa 8b03daa09b Add mjtSameFrame enum to specify frame alignment of bodies with their children.
PiperOrigin-RevId: 666303674
Change-Id: I53dc56e1ca52afa280ae5abaf4158edc465fb1e0
2024-08-22 05:17:06 -07:00
Yuval Tassa 5d91231d31 Rename mjBuffer to mjByteVec.
PiperOrigin-RevId: 664872558
Change-Id: I7b003374c390958667635fb21089faf2ece54b14
2024-08-19 10:40:26 -07:00
Alessio Quaglino cfc7dc9848 Clarify that keyframes are not replicated in nested attachments.
PiperOrigin-RevId: 663683684
Change-Id: Id180b3a6afad6809d8189a7a525c474bd3a91fc1
2024-08-16 04:22:21 -07:00
Yuval Tassa 2cb601c98d Improve documentation w.r.t smoothness, differentiability and finite-differencing.
PiperOrigin-RevId: 662848709
Change-Id: Icb7dc03a2c53d43d0d3a9e4ac95d963e5bc6853c
2024-08-14 03:11:38 -07:00