Commit Graph

66 Commits

Author SHA1 Message Date
Yuval Tassa 393c1e4217 Migrate mjtByte to mjtBool for boolean-valued fields.
PiperOrigin-RevId: 921408093
Change-Id: Icb00457836359779f0f72fc02d6a7c0dc9f6bd23
2026-05-26 05:35:49 -07:00
Yuval Tassa 767c607f58 Add mju_sym2dense, document future breakage of mj_fullM
PiperOrigin-RevId: 910242375
Change-Id: Ibfbdef9cfb66088723499ea257da09aee0d80938
2026-05-04 14:25:53 -07:00
Kyle Bayes 3325971840 Add mj_maxContact API function.
PiperOrigin-RevId: 903135055
Change-Id: I5f103c7d51f97e327c923bc567002ace835f5517
2026-04-21 04:03:22 -07:00
Kyle Bayes acf7f030a6 Remove const qualifier from mjData in mj_geomDistance. The function mj_geomDistance will require data stack space as nativeccd memory is determined from opt.ccd_iterations.
PiperOrigin-RevId: 881946592
Change-Id: I524b9fa41018a581e58647d44de6ca3db4c6608b
2026-03-11 04:55:44 -07:00
Yuval Tassa 6419534bad Add actuator and sensor delays. Fixes #1004
PiperOrigin-RevId: 866478839
Change-Id: Id21a6da0f98454c8fa39ea5af8a5e213d6eae497
2026-02-06 08:47:36 -08:00
Yuval Tassa 218226fc95 Breaking change: Add surface normal output to MuJoCo raycast functions.
PiperOrigin-RevId: 855781592
Change-Id: Id96b1ca7eaf722e260cc69d7706c28dc51f52d92
2026-01-13 10:22:21 -08:00
Yuval Tassa d7e4038be8 Expose mj_copyData in Python bindings.
This allows calling `mujoco.mj_copyData(dest, model, src)` to copy data between existing `mjData` instances.

PiperOrigin-RevId: 855150139
Change-Id: If122cb7acf590846e25ee15f9770c3c087147169
2026-01-12 03:21:15 -08:00
Yuval Tassa 19e2d0ae2f Add mj_fwdKinematics and a table improving documentation of the MuJoCo computation pipeline structure.
PiperOrigin-RevId: 838768130
Change-Id: I1a22d5cdca7db704ba4cea1667fcbecb16b87005
2025-12-01 07:39:00 -08:00
Yuval Tassa 888d3a7b07 Add mj_copyState
PiperOrigin-RevId: 836588419
Change-Id: I7609e121dc0ac697d4d015d4244bdd5962650def
2025-11-25 03:10:30 -08:00
Haroon Qureshi 6c15c711ee Make mjv_cameraFrame and mjv_cameraFrustum public.
PiperOrigin-RevId: 832187804
Change-Id: I74d05d7fe03bc81bd05a823c7c9791bca12e3079
2025-11-14 00:03:18 -08:00
Yuval Tassa ad49733db2 Improve error message for insufficient arena memory in _realloc_con_efc.
PiperOrigin-RevId: 826845370
Change-Id: I09467dd44a6f9f01b89ff6c1d74cde493e84eb1c
2025-11-01 05:54:56 -07:00
Saran Tunyasuvunakool 2f65e23779 Add mj_extractState as a public API function.
This function allows the caller to extract a subset of components of a state previously obtained via `mj_getState` without having to first write it back into `mjData`.

PiperOrigin-RevId: 822165077
Change-Id: I6433261f4f5ec2e8d024bb7dee8f7dbf1e62666c
2025-10-21 10:01:22 -07:00
Sam Haves 6320b95957 Add mju_getXMLDependencies that given an MJCF file returns filepaths to all of it's dependencies.
PiperOrigin-RevId: 814203235
Change-Id: Ib5c2e2f4dd42224a768c88d76473544190c72bc0
2025-10-02 06:14:48 -07:00
Haroon Qureshi 6a7566872a Functions for printing the contents of mjvScene.
PiperOrigin-RevId: 812699642
Change-Id: Iafff53c952c952624129ff01a8c1b0aa5d38eec5
2025-09-29 02:47:17 -07:00
Kyle Bayes 9740705510 Add cache functions to Python bindings.
PiperOrigin-RevId: 807813218
Change-Id: Ieab2843d92e79c07bc9f98196db51297a456dedb
2025-09-16 13:02:59 -07:00
Yuval Tassa 1447711037 Rename spec to sig in state-related API functions.
(to avoid confusion with mjSpec)

PiperOrigin-RevId: 795848898
Change-Id: I0b64eb85f5c7a3ee889a746c751d9f5561650277
2025-08-16 08:38:25 -07:00
Yuval Tassa 89e39dc0a7 Expose mj_makeM as a sub-component.
PiperOrigin-RevId: 763662068
Change-Id: I55ced456dca751c1de09fb35e2f73c60ffc0d626
2025-05-27 00:35:55 -07:00
Erik Frey 49c33716a1 Allow _realloc_con_efc to also allocate new nJ arrays.
PiperOrigin-RevId: 761252071
Change-Id: Idce822c6f2b8f2d81a5d43228f5dc35281c5ad07
2025-05-20 15:26:04 -07: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
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
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 a3ea01e57e Remove deprecated mju_rotVecMat and mju_rotVecMatT functions.
PiperOrigin-RevId: 689405782
Change-Id: I0281376d5d6f5c31ea2603d61c03c7b94aaa6312
2024-10-24 09:15:23 -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
Yuval Tassa b66da3d369 Add mjData.L, sparse Cholesky factor of Newton solver Hessian.
PiperOrigin-RevId: 683669555
Change-Id: I18d7530b5d68d1d48cb95d4faa0150c434109638
2024-10-08 10:13:08 -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
Yuval Tassa 62e2842116 Skip deprecated mju_rotVecMat and mju_rotVecMatT in Python bindings.
PiperOrigin-RevId: 647275284
Change-Id: I371236182b22eb399041959901085bb82af3f670
2024-06-27 05:06:01 -07:00
Yuval Tassa 6067048537 Deprecate mju_rotVecMat and mju_rotVecMatT in favor of mju_mulMatVec3 and mju_mulMatTVec3.
These functions names and argument ordering are more consistent with the rest of the API.

PiperOrigin-RevId: 643788290
Change-Id: I783eda8021b80b82098e23ed95669b102bb82508
2024-06-16 10:02:36 -07:00
Yuval Tassa c9bcf8371e Add mj_setKeyframe function to save current state in k-th model keyframe.
Fixes #1719.

Also improve documentation of `mju_sigmoid`, was previously only documented in changelog.

PiperOrigin-RevId: 642637458
Change-Id: I811a0bf8f881c8b76c9a62d2faec8fdec4e7585b
2024-06-12 09:22:52 -07:00
Yuval Tassa 02d015458c Add mj_geomDistance API function and sensors for geometric distance, normal direction and segment between between two geoms. Fixes #51
PiperOrigin-RevId: 632458301
Change-Id: I65b7e5bb0df59008028114cf4a07e0d6365ff3d3
2024-05-10 04:52:43 -07:00
Yuval Tassa 2b4975811b Fix bug in Python binding of mj_saveModel
PiperOrigin-RevId: 625655183
Change-Id: I80d3390d739a8d6e280343087b79c15b543ff50a
2024-04-17 05:58:50 -07:00
Yuval Tassa 5a365603f8 Add mju_euler2Quat.
PiperOrigin-RevId: 623469398
Change-Id: Ia86b29a764018cd4c3bc57d23616bed7393081f5
2024-04-10 06:02:50 -07:00
Copybara-Service 6b7d714291 Merge pull request #1450 from v-r-a:angmomMat
PiperOrigin-RevId: 612835207
Change-Id: I8e7b01cc433563556a3ae4bbdd0c53612cc15e97
2024-03-05 07:35:15 -08:00
Yuval Tassa 982760a63b Improve bindings for mjd_subQuat.
- Accept `None` for optional arguments.
- Accept 3x3 matrices for matrix arguments.

PiperOrigin-RevId: 611000820
Change-Id: Id28cdb2ae574f372ff251f94ab4557d9d2eaa80b
2024-02-27 23:55:19 -08:00
Yuval Tassa 822b03446c Improve pipeline documentation, expose mj_implicit function to public header.
PiperOrigin-RevId: 586380774
Change-Id: I3fafa563ebc852e17e1233288455b96f4499027b
2023-11-29 10:18:57 -08:00
Alessio Quaglino 9ae40e718e Define mj_multiRay bindings explicitly.
Fixes #1184.

PiperOrigin-RevId: 581956413
Change-Id: I6c611ac7537442a65e6961430ec724326ee6095a
2023-11-13 07:31:22 -08:00
Nimrod Gileadi 084facc9ab Python bindings: Store a reference to MjModel in MjDataWrapper.
Before this change, MjDataWrapper contained a custom data structure called MjDataMetadata, which contained the sizes of various arrays needed to create MjData. This was used for serialization and deserialization, as well as copying MjData instances.

This worked fine for native MuJoCo models, but as soon as plugins were used, there was information in the model that was needed and not available in MjDataMetadata. Since plugins are so general, keeping MjDataMetadata was untenable.

PiperOrigin-RevId: 578205355
Change-Id: I11b9ee797d1da5aaf1fecbbe170b3b0f1f1a3e6c
2023-10-31 09:16:40 -07:00
Alessio Quaglino 5a70ad08ab Add Flex component.
PiperOrigin-RevId: 572830650
Change-Id: I6908228087b7b9683be3506c8d9cdc725ed5dcd5
2023-10-12 10:49:35 +01:00
Saran Tunyasuvunakool be75dda8d1 Fix arena memory leak in _realloc_con_efc.
PiperOrigin-RevId: 567093603
Change-Id: I0a00da461b495cc13e54381862d740333a43f82b
2023-09-20 15:16:04 -07:00
Yuval Tassa 9902b73502 Rename mj_stackAlloc to mj_stackAllocByte.
PiperOrigin-RevId: 566351365
Change-Id: I91541168e83b05a730113661cc9f07985ac9ff0c
2023-09-18 10:53:35 -07:00
Saran Tunyasuvunakool daa2ac7f8b Rename nstack to narena, change it and pstack to count bytes.
PiperOrigin-RevId: 561066311
Change-Id: I4d0e645e6c254dd906bfc42159e0e99149a7c6c8
2023-08-29 10:13:33 -07:00
Kyle Bayes ed4bb2aab5 Change _Alignof to alignof in functions.cc
PiperOrigin-RevId: 558388811
Change-Id: I40f394d6dd05215a7499ede5903841a07cd1c9f0
2023-08-19 05:11:40 -07:00
Saran Tunyasuvunakool 488041d362 Add a private function for resizing contact and efc-sized arrays in Python.
This function is currently used for internal experimentation.

PiperOrigin-RevId: 558238153
Change-Id: I32eec8f13ac2d995e90c5421f2a157412e2148f2
2023-08-18 13:53:04 -07:00
Yuval Tassa 3e034e38b2 Add constraint island discovery
PiperOrigin-RevId: 557067599
Change-Id: Ic41e1d0efef02b7a79142518afe49cf9d4e74725
2023-08-15 02:30:05 -07:00
Yuval Tassa 5cfbb6ac8b Add mjd_quatIntegrate, expose mjd_subQuat.
PiperOrigin-RevId: 546252926
Change-Id: I7d6b2bd6536e7e8afc368f3c46037c20f6a1cb5e
2023-07-07 05:33:24 -07:00
Yuval Tassa c50c92ccc8 Add mjv_connector, identical to mjv_makeConnector but with a more convenient "from-to" parameterization.
PiperOrigin-RevId: 542343761
Change-Id: I75f5ff3c404a2a9f65dfed706e590efd7b951f6e
2023-06-21 13:19:36 -07:00
taylor howell b81dfbbc48 fix python type_error mj_differentiatePos, mj_integratePos 2023-06-14 12:19:58 -06:00
Yuval Tassa f67e359532 Add mjtState enum and related mj_stateSize, mj_getState and mj_setState functions.
PiperOrigin-RevId: 539667943
Change-Id: I14c34be8ce4c287e529380257b5c5bffc3ab45ce
2023-06-12 08:56:48 -07:00
Yuval Tassa 466c9aca82 Remove mj_activate and mj_deactivate.
PiperOrigin-RevId: 538799120
Change-Id: I4d6729131e20ab9ae15c94c221ba83ae5732e942
2023-06-08 08:55:39 -07:00
Alessio Quaglino dab49d487c Use mesh BVH for speeding up ray mesh intersection.
PiperOrigin-RevId: 532516008
Change-Id: Ia9cac060279d030221c1a6b4fad457a857701370
2023-05-16 11:10:38 -07:00