Commit Graph

824 Commits

Author SHA1 Message Date
Kyle Bayes a1d9b47e2f Initial (unoptimized) implementation of EPA.
PiperOrigin-RevId: 659938320
Change-Id: I72c6c6bd7504bce36e4788d90b06b2cb3849b4db
2024-08-06 06:53:55 -07:00
Nimrod Gileadi 4dc8f884de Check for texid >= 0 before accessing texture arrays.
PiperOrigin-RevId: 659567553
Change-Id: Ia4aaa85b85e3f27e632c03a9f50b10894d29a97b
2024-08-05 08:47:50 -07:00
Taylor Howell 20011a2f53 Disable RK4 integrator in mjd_transitionFD by throwing an error and improve documentation for mjd_transitionFD and mjd_inverseFD.
PiperOrigin-RevId: 659492713
Change-Id: I84ab7ebfba34742f239f60311d8f0a55559995fb
2024-08-05 03:18:31 -07:00
Nimrod Gileadi 6a8e28f0e9 Prevent integer overflow when computing texture sizes and allocating memory for them.
Correctly check for failed allocations when resizing std::vector

PiperOrigin-RevId: 659488680
Change-Id: I7bf4c0b416e96eda2baec32b21be78456604f4b0
2024-08-05 02:58:46 -07:00
Nimrod Gileadi ff5d339e48 GMSH loading: Check that std::stoi isn't out of range.
PiperOrigin-RevId: 659485119
Change-Id: I584ba33f87dbe3b87a8c4fb90feb8963106115da
2024-08-05 02:41:19 -07:00
Gabe Oppenheimer d538bf994d Update version to 3.2.1 following the 3.2.0 release.
PiperOrigin-RevId: 658412236
Change-Id: I4bd6ccb5dee18059eb6fc0d187afe62598845793
2024-08-01 08:35:42 -07:00
Nimrod Gileadi 70a3a541ea Unpoison destination arena when copying mjData.
PiperOrigin-RevId: 658312528
Change-Id: Ie6d3497793ef70b89eaa64dcc7aed4130678f06c
2024-08-01 01:38:14 -07:00
Alessio Quaglino b341bd391d Fix a bug with mjs_delete functions.
PiperOrigin-RevId: 657615906
Change-Id: Ic70eaa9a5c20337db3897cf882a60e9d94f2869b
2024-07-30 09:13:57 -07:00
Yuval Tassa 24a555062d Rename mjDSBL_AUTORESETNAN to mjDSBL_AUTORESET.
- Expose in MJCF.
- Add documentation.
- Improve handling in simulate.

PiperOrigin-RevId: 657606140
Change-Id: I6a27c2f4842d7d4ae32642f2a6255e5f8f1f605a
2024-07-30 08:41:59 -07:00
Copybara-Service 123a01bd83 Merge pull request #1833 from JewelryForge:main
PiperOrigin-RevId: 657249579
Change-Id: I11b9602ea685b22d0cc61add9e90e7a5c68559dd
2024-07-29 10:36:39 -07:00
Alessio Quaglino 6928e09f36 Small performance improvement: Parse body once during replicate.
PiperOrigin-RevId: 657227162
Change-Id: I5b60c25ab4634a44ed0474fdbf22e676bcb8f6d7
2024-07-29 09:32:40 -07:00
Yuval Tassa a4bd2bec0a Skip disabled actuators in mjd_actuator_vel.
Fixes a bug where the derivative of the actuator force with respect to the generalized velocities (used in implicit and implicitfast integrators) was failing to take into account disabled actuators.

Fixes #1838

PiperOrigin-RevId: 657193960
Change-Id: Id8c0ab863a39e2a01cd2703774f460e9731b4807
2024-07-29 07:31:58 -07:00
Alessio Quaglino 3f0749a0f7 Do not remove elements that contain user errors when detaching a subtree.
PiperOrigin-RevId: 657190780
Change-Id: I073a437013f80596a341f7b80bed991536efeb43
2024-07-29 07:19:12 -07:00
Kyle Bayes 5ac5cfb618 Support directories in VFS via mj_addBufferVFS.
PiperOrigin-RevId: 655286683
Change-Id: I846376a0571d8df28d979beb5981a0cbccd7a04f
2024-07-23 13:39:18 -07:00
Kyle Bayes 2746cb8559 Support FilePaths instead of raw strings in XML code.
PiperOrigin-RevId: 655177026
Change-Id: I55b055551384b01ba7a4baa5d75fbe3329b7d25d
2024-07-23 08:36:53 -07:00
Tom Erez 33e5960653 Allow multiple textures per material in MJCF.
PiperOrigin-RevId: 654795013
Change-Id: I418b72533484d00accaf801a342aa183e602a2d0
2024-07-22 09:57:51 -07:00
Alessio Quaglino e79efa60d6 Reset tree indices before recompiling.
Fixes #1822.

PiperOrigin-RevId: 654762203
Change-Id: I7f656f7dad376d4899229a8741315c8f821bfa56
2024-07-22 08:30:29 -07:00
Saran Tunyasuvunakool f62792594f Add a new disable flag mjDSBL_AUTORESETNAN.
PiperOrigin-RevId: 654677473
Change-Id: Id92383fe413729bf6697353aa6e0bc8a946ec7e8
2024-07-22 03:22:41 -07:00
Chengrui Zhu cdd8531290 Fix typos and indents. 2024-07-22 13:45:15 +08:00
Kyle Bayes b3f79e561d Fix bug in pre-counting equality constraints.
PiperOrigin-RevId: 654031345
Change-Id: If8c660b3e6fed78d8fd8de470f1cf2a709ac1244
2024-07-19 09:33:59 -07:00
Tom Erez 796173170c Add support in mjModel for tagging textures with different roles, and use the slot index of a texture to designate its role.
PiperOrigin-RevId: 654030065
Change-Id: I34a5b132a7f91a6bb8f260500c1b9c128a03b596
2024-07-19 09:29:22 -07:00
Kyle Bayes 8a8a44a4db Refactor numerical parsing in XML.
PiperOrigin-RevId: 653979240
Change-Id: I4d39f4041b88396193eb35f0cc393141d64f6fc0
2024-07-19 05:42:02 -07:00
Tom Erez e92af73cbf Add mjmodel support for textures with different number of channels.
PiperOrigin-RevId: 653974959
Change-Id: Ia280e0bdb21027646249f104f21bedee792ba7e5
2024-07-19 05:22:19 -07:00
Alessio Quaglino c198a69bbf Return null pointer from mjs_firstChild and mjs_firstElement when the requested list is empty.
Fixes #1824.

PiperOrigin-RevId: 653758711
Change-Id: I6ede762cafd88dcbb0dfc9c2999b7aee24bd2e2a
2024-07-18 14:35:36 -07:00
Yuval Tassa ffb50b7b67 Improve readability of body transmission code.
(code block mentioned in #1790)

PiperOrigin-RevId: 653601254
Change-Id: Ibee727ab668b690c3b9a55c39110c6219cca17fa
2024-07-18 06:43:40 -07:00
Alessio Quaglino 231d9632cd Avoid duplicated code in mjCModel by adding ResetTreeLists().
PiperOrigin-RevId: 653575505
Change-Id: I61ee1462deae2a371cf6f36ca1cf3dbbd88d174c
2024-07-18 05:08:18 -07:00
Alessio Quaglino dd9dd295ba Prevent uninitialized memory during a copy of joints and actuators.
PiperOrigin-RevId: 653340718
Change-Id: Icc5ada05abd590504c157311a309f9b8493feac9
2024-07-17 13:22:11 -07:00
Yuval Tassa dd25973481 Remove unnecessary def_map copying.
Introduced in 5b080bacc4
Made obsolete by 27b9ddda5b
[Context](https://github.com/google-deepmind/mujoco/commit/27b9ddda5bdd12345abdfbc0a6efce121d40cd6c#r144157607)

PiperOrigin-RevId: 653254345
Change-Id: Ie944d2c3924d3eb91f7743c0d0c8413cd2cd79cc
2024-07-17 09:10:31 -07:00
Alessio Quaglino 2664cc1391 Allow passing a null pointer in mj_recompile.
Fixes #1819.

PiperOrigin-RevId: 653242587
Change-Id: I36dbd6ed54abdf21abeb62cf41ee88f159008d01
2024-07-17 08:29:01 -07:00
Kyle Bayes 2cf352c2e6 Add VFS handling logic to mj_openResource.
PiperOrigin-RevId: 653124909
Change-Id: I4d031eb0bfb0070f8493753d2aeaac60ac283b85
2024-07-17 00:41:18 -07:00
Gabe Oppenheimer 22ce22ac8a Update the MuJoCo version number ahead of the 3.2.0 release.
PiperOrigin-RevId: 652578624
Change-Id: I8ed6f66ff1247ff7421e3ed0521cf15e1c0b6c79
2024-07-15 13:16:06 -07:00
Alessio Quaglino 9a7c1df130 Set unused inherited opaque pointers to nullptr.
PiperOrigin-RevId: 652444674
Change-Id: I3e82b1e1ae029f2f01ddcdf5ce2ccb45624e7062
2024-07-15 05:15:45 -07:00
Alessio Quaglino cf61d88e41 Move pointer assignments from CopyFromSpec() to PointToLocal().
Note that these internal pointers are inherited from the public structs and are unused internally.

PiperOrigin-RevId: 652414750
Change-Id: I5e42503bce8e9019291ec0a1f8c4278438474e9b
2024-07-15 02:47:32 -07:00
Yuval Tassa 22a10fd2ff Minor documentation improvements.
PiperOrigin-RevId: 652064694
Change-Id: I13009410fbd3ce5ac90788f61e32354474a8e19e
2024-07-13 08:36:47 -07:00
Alessio Quaglino 5d51b4cd5f Check that element is a nullptr before casting.
The bug was caused by the fact that the `mjs_as*` functions would return a pointer to a `mjC*` object, even if the input `mjsElement` pointer was null. This would cause a segfault.

PiperOrigin-RevId: 651802736
Change-Id: Ibec00d269a4befadff8a68e0513fd381c7e38a2a
2024-07-12 09:46:16 -07:00
Yuval Tassa e76f3ce1e3 Rename model to spec in xml_native_reader.cc.
PiperOrigin-RevId: 651780148
Change-Id: I476c79af4b47bf763f1f3cb166d3f0897554a207
2024-07-12 08:22:54 -07:00
Nimrod Gileadi 84108589c4 Move the map lookup outside of the mesh processing loop. Change to unordered_map.
PiperOrigin-RevId: 651745837
Change-Id: Ibfcbe4b8cefa53a3dbaa99c4ca68442e2e10bc5d
2024-07-12 05:45:25 -07:00
Alessio Quaglino 6e64dd10e8 Fix bug in RemoveFromList.
The function was interpreting that the elements that were expected to be detached contained useful user errors, and therefore it was not detaching them. Also, the function tried to compare the namespace between two models, but the namespace is already fused in the references at detach time.

PiperOrigin-RevId: 651738364
Change-Id: Ifdaa9bd5b658bfd18b544b7138a5c2c56b66e936
2024-07-12 05:08:00 -07:00
Yuval Tassa f1aa52aa9b Never use more threads than meshes for multi-threaded compile.
PiperOrigin-RevId: 651728817
Change-Id: Ib607d528c25a10e2cdb8c2b0b0da2189683d2691
2024-07-12 04:18:35 -07:00
Kyle Bayes 9c9faa02d5 Add FilePath utility class for handling resource / file paths in MuJoCo user code.
PiperOrigin-RevId: 651716008
Change-Id: I250b8cec32aab538f5862f8a05f42d1fae698307
2024-07-12 03:21:21 -07:00
Alessio Quaglino 2f46dec669 Fix bug in frame saving. Fixes #1802
PiperOrigin-RevId: 651696068
Change-Id: Ie1e2e1de4e83c42f2b5ebcc3afd0540b9afe7bbd
2024-07-12 01:56:38 -07:00
Yuval Tassa 3d1d1d0718 Multithreaded mesh compilation.
PiperOrigin-RevId: 651358120
Change-Id: Id6272aac84ec6ac1b709d2f4a44b7593307bd158
2024-07-11 04:21:49 -07:00
Nimrod Gileadi e7301edd20 Copy arena contents in mj_copyData.
Fixes #1710.

PiperOrigin-RevId: 651351384
Change-Id: I56e3204b30bb18f48278117e85e90464177da973
2024-07-11 03:54:44 -07:00
Kyle Bayes f9ab89b205 Refactor user cache to just support void pointers so user objects can be cached whole.
PiperOrigin-RevId: 651307384
Change-Id: I92c058a900727070235d00b6d2165c29fd12e7b0
2024-07-11 01:01:27 -07:00
Alessio Quaglino 27b9ddda5b Add attach tag to MJCF.
PiperOrigin-RevId: 651117953
Change-Id: I57b0e53ed44607d479b3785d908e0837c0804cf3
2024-07-10 12:41:43 -07:00
Copybara-Service 5b080bacc4 Merge pull request #1799 from JewelryForge:main
PiperOrigin-RevId: 651069985
Change-Id: I758e27e2f4bf19bba38d9e1189a41accae40d028
2024-07-10 10:29:22 -07:00
Alessio Quaglino 7f9f8b5429 Catch errors in attach during replicate.
PiperOrigin-RevId: 651041336
Change-Id: I59986e157b4e22c74f8b8493899cdd4a3d5df839
2024-07-10 09:04:37 -07:00
Yuval Tassa b483ce608e Use std::thread in compiler on all platforms.
PiperOrigin-RevId: 651005412
Change-Id: I8dfb142dc2d87ab0af79583f2df168c105b50138
2024-07-10 07:10:45 -07:00
Chengrui Zhu 5bd13b4982 Copy all keys of def_map when copying a mjCModel. Fixes #1798 2024-07-10 16:40:36 +08:00
Alessio Quaglino 462cfa5ceb Attach the tree of defaults recursively and with namespacing.
PiperOrigin-RevId: 650664018
Change-Id: I17751a02a406dcb2a2ca218c316b5eb0370071b8
2024-07-09 09:54:09 -07:00