Commit Graph

124 Commits

Author SHA1 Message Date
Alessio Quaglino dfe8e45101 Namespace plugin instances when attaching.
Fixes #2112.

PiperOrigin-RevId: 681045462
Change-Id: I2c945c5405fcb91e0f9a1b0b1e94f68d174c84ee
2024-10-01 09:14:37 -07:00
Alessio Quaglino 1eb6fc2285 Disallow using elasticity and edge constraints at the same time.
Fixes #2084.

PiperOrigin-RevId: 678614880
Change-Id: I44eead3dc4edf82d725a3063b927a421c660721a
2024-09-25 02:56:20 -07:00
Yuval Tassa 5219893813 Replace mjQUICKSORT with std::stable_sort in user_mesh.cc
PiperOrigin-RevId: 677864209
Change-Id: I1cca8e1ae8c84e652b12c24cfddfbca97d8c6841
2024-09-23 11:06:46 -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
Alessio Quaglino f4381e12a2 Delete plugins when their corresponding objects are deleted, if their instance belonged the object.
Fixes #2061.

PiperOrigin-RevId: 676402701
Change-Id: Ia4807d57a3763e2100702b7e7ec96c300d0a9cfb
2024-09-19 07:21:42 -07:00
Alessio Quaglino aca4b3324d Resolve default asset names while attaching a spec.
PiperOrigin-RevId: 676053538
Change-Id: I717b87be4bc18a5d9f8e5f2dc071bd93409eea81
2024-09-18 10:58:12 -07:00
Alessio Quaglino 66a9cacc90 Move elasticity force computation to the engine.
PiperOrigin-RevId: 676028775
Change-Id: I994e3dda8d6470815763c04df0c276e265aa1f54
2024-09-18 09:55:00 -07:00
Alessio Quaglino ddbc083810 Move elasticity computation to mjCFlex.
PiperOrigin-RevId: 675949380
Change-Id: Ia48f4fd6ae1ede206ccacd1205914e7e4b3c7aec
2024-09-18 05:23:10 -07:00
Alessio Quaglino 31abd7900a Add edge ids to flex elements in mjModel.
PiperOrigin-RevId: 675130981
Change-Id: If2ccfb268142d235273b7a50e15740f6399903b2
2024-09-16 06:58:10 -07:00
Alessio Quaglino b15de2c951 Add elasticity parameters to the schema.
PiperOrigin-RevId: 675115200
Change-Id: Ic6608ce61cbb857dca71b3d9cbdac057e8f1ac7a
2024-09-16 05:56:36 -07:00
Alessio Quaglino c77babe046 Fix a bug in MuJoCo's user_mesh.cc that caused meshdir_ to be overwritten when a model was loaded with a nested model.
PiperOrigin-RevId: 675092713
Change-Id: Iad6336141749510bf5544cab9c06533ee1589c08
2024-09-16 04:22:13 -07:00
Yuval Tassa fd17b2144a Replace double- or single-precision-denominated function calls in the engine with the equivalent mjtNum-denominated calls. This avoids unnecessary casting or precision loss when MuJoCo is compiled for 32-bit float precision. Accordingly, remove #include <math.h> from all engine source files.
build / windows-2022 (push) Has been cancelled
build / macos-12 (push) Has been cancelled
build / ubuntu-20.04-clang-10 (push) Has been cancelled
build / ubuntu-20.04-clang-11 (push) Has been cancelled
build / ubuntu-20.04-clang-12 (push) Has been cancelled
build / ubuntu-22.04-clang-13 (push) Has been cancelled
build / ubuntu-22.04-clang-14 (push) Has been cancelled
build / ubuntu-22.04-gcc-10 (push) Has been cancelled
build / ubuntu-22.04-gcc-11 (push) Has been cancelled
build / ubuntu-22.04-gcc-12 (push) Has been cancelled
build / ubuntu-22.04-gcc-9 (push) Has been cancelled
Also, minor type-related fixes in `user_mesh.cc`.

PiperOrigin-RevId: 675082329
Change-Id: Icc5eb9f9eb4fbf09b08d7d4b9b2929f414e4a75c
2024-09-16 03:40:17 -07:00
Alessio Quaglino 567793c26f Store model paths in assets.
This enables to preserve the paths of the child spec during `attach`.

PiperOrigin-RevId: 673349237
Change-Id: Ibf075c7ec037ff5d540bc60d6e77c12f60269791
2024-09-11 05:20:14 -07:00
Michael Ahn 9924d9ca89 Fixed incorrect mesh face circumradius calculation
- In 8e2f830, this was changed from `mju_norm3` to `mjuu_normvec`, but the
  latter will mutate its input to be normalized instead of just
returning the norm (the former was likely mistaken as `mju_normalize3`
which does mutate its input).
2024-08-15 20:53:57 -07:00
Kyle Bayes 39896f8064 Restructure mjCMesh for caching.
PiperOrigin-RevId: 662496475
Change-Id: I4c3a58a63ef2c3b1196b3e6b30eb556b5528ff7f
2024-08-13 06:40:36 -07:00
Kyle Bayes 20cae556ee Encapsulate BVH class members.
PiperOrigin-RevId: 662141171
Change-Id: Ica202d31dacc9cc500d0aeecded941b79002b9a1
2024-08-12 10:27:03 -07:00
Taylor Howell 82c27165f2 mjQUICKSORT uses std::sort with C++.
fixes #1638

PiperOrigin-RevId: 660887790
Change-Id: Ia3b493feda98b246d963aa749bc81b96c42fddaa
2024-08-08 10:24:34 -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
Kyle Bayes 5ac5cfb618 Support directories in VFS via mj_addBufferVFS.
PiperOrigin-RevId: 655286683
Change-Id: I846376a0571d8df28d979beb5981a0cbccd7a04f
2024-07-23 13:39:18 -07:00
Chengrui Zhu cdd8531290 Fix typos and indents. 2024-07-22 13:45:15 +08:00
Kyle Bayes 8a8a44a4db Refactor numerical parsing in XML.
PiperOrigin-RevId: 653979240
Change-Id: I4d39f4041b88396193eb35f0cc393141d64f6fc0
2024-07-19 05:42:02 -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
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
Yuval Tassa 3d1d1d0718 Multithreaded mesh compilation.
PiperOrigin-RevId: 651358120
Change-Id: Id6272aac84ec6ac1b709d2f4a44b7593307bd158
2024-07-11 04:21:49 -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 e0d33eb1d0 Remove mjCBase::def and use mjCBase::classname instead.
PiperOrigin-RevId: 650629741
Change-Id: I10a9955b99e4a5ff0b5a742e22635ccad1455f1a
2024-07-09 08:02:32 -07:00
Alessio Quaglino f57dc90669 Refactor Default class to use pointers instead of indices.
This in order to make it easier to append the default tree to another tree.

PiperOrigin-RevId: 649812975
Change-Id: I2915ac7e37957e45eadc24d6caaf7beea236bf29
2024-07-06 03:51:30 -07:00
Kyle Bayes c6fd002f87 Move engine/engine_resource.{c,h} to user/user_resource.{c,h}.
PiperOrigin-RevId: 649628768
Change-Id: Id90c983cf70c0f92c3b033ac1b1654c53696955d
2024-07-05 05:41:55 -07:00
Kyle Bayes 2a4410e4e5 Fix bug with absolute meshdirs in included XML files. Fixes #1772.
PiperOrigin-RevId: 649150979
Change-Id: I5df08c689afc4f5bc625e989a8c0b9733fcfa3c2
2024-07-03 11:49:17 -07:00
Alessio Quaglino f6cc3f4091 Remove classname from mjs* structs.
PiperOrigin-RevId: 647277317
Change-Id: Ic3cb0d3bf890d6be2712c0538e21910a8f12ab44
2024-06-27 05:13:02 -07:00
Yuval Tassa 8e2f830fd2 Fix type errors in compiler and tests.
In preparation for a float32 build of MuJoCo.

PiperOrigin-RevId: 644407674
Change-Id: I60069f0f865ef89fbf613f5a2ca0c336cc63461e
2024-06-18 09:12:44 -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
Alessio Quaglino 7a06bcfdaf Make model editing API public, fixes #364
Still missing:

- Detailed documentation.
- Python bindings.

PiperOrigin-RevId: 641445626
Change-Id: I20e67b707cf1bebae7e0cc94d17f7b76a89171f0
2024-06-07 22:28:01 -07:00
Baruch Tabanpour ace0c8f0a3 Add maxhullvert.
PiperOrigin-RevId: 641092710
Change-Id: Ib4fa828a9c82531614f0a67de9990340dbb25406
2024-06-06 19:05:16 -07:00
Alessio Quaglino f6084b4328 Change user_api handle types.
PiperOrigin-RevId: 640978033
Change-Id: I53496671ac823b50e6f90ceee15bf3b314b06db8
2024-06-06 12:06:10 -07:00
Kyle Bayes e885a3dc3d Make default class members private.
PiperOrigin-RevId: 634288934
Change-Id: I1b7a5ec8dd51c65377b09bcb85c56a849573cac7
2024-05-16 03:22:31 -07:00
Kyle Bayes 13bf9ae6bd Encapsulate mjCModel internal lists.
PiperOrigin-RevId: 631760335
Change-Id: I9b67f6ed2e65a01877de15a92a04a1b31a6b3ff4
2024-05-08 05:02:21 -07:00
Alessio Quaglino 259d3876ce Remove C-style vectors from user_mesh.
PiperOrigin-RevId: 630031676
Change-Id: I87cba3eb816095657acd886037af2c0f06fe4fdd
2024-05-02 05:27:29 -07:00
Yuval Tassa 1b70907060 Convert user_api header and user_init source files to valid C code.
PiperOrigin-RevId: 629691192
Change-Id: I9be78aca27ae584fff0b733e9015b2bb3b927ca4
2024-05-01 04:53:01 -07:00
Alessio Quaglino 70f00b05a1 Allow attaching a model to itself.
PiperOrigin-RevId: 623806812
Change-Id: I9b0e36308be754e838790ead8ec717953e4b2350
2024-04-11 06:28:48 -07:00
Nimrod Gileadi 02a7a8dc11 Fix integer overflow in MSH loading
PiperOrigin-RevId: 621151576
Change-Id: I33f44dcc5d1099502714b384d97c37fe95e72186
2024-04-02 06:11:55 -07:00
Alessio Quaglino dfe2b75378 Convert mjElement to struct rather than opaque pointer.
By making mjElement the parent of mjCBase, mjCModel, and mjCDef, this CL enables safer casting using static_cast instead of reinterpret_cast and C-style casting.

PiperOrigin-RevId: 619526291
Change-Id: Ifa2b4bd3ecd95bade61f41a7005c62212f456c00
2024-03-27 07:37:49 -07:00
Matthew Bennice 7875e93fea Improve error text when a mesh face references an invalid vertex.
PiperOrigin-RevId: 618715730
Change-Id: I28fae1e1570d359db4be98e9c5b7713169eaf34f
2024-03-24 20:59:16 -07:00
Yuval Tassa 4660a297d1 rename mjspec api structs and functions mjm -> mjs
PiperOrigin-RevId: 618017976
Change-Id: I5f790167e5ca670f8d5f92e8e1c920db8d236144
2024-03-21 18:04:50 -07:00
Alessio Quaglino c3fb8e7f35 Do not attach elements not referenced in the subtree.
PiperOrigin-RevId: 617849280
Change-Id: I391fe7c00f67d020d7394ddd31219d727b2eaa94
2024-03-21 08:22:03 -07:00
Alessio Quaglino b0daccc234 Allow meshes with flipped faces if exactmeshinertia is false.
Fixes #1529.

PiperOrigin-RevId: 617824308
Change-Id: I926c385475dd79f07e88fe1925ecbb2adb4f8917
2024-03-21 06:36:07 -07:00
Alessio Quaglino 07da7336e8 Set mesh visual flag regardless of discardvisual.
PiperOrigin-RevId: 617428859
Change-Id: I427d888e6caa2fe1ae6597ca7165c600c9779cc7
2024-03-20 01:15:52 -07:00
Alessio Quaglino 372aa021d0 Add copy constructor and assignment to mjCModel.
PiperOrigin-RevId: 616850780
Change-Id: I7fedab2efa2a90fd7ce952eac4e195f77c5ff5bc
2024-03-18 09:25:27 -07:00
Kyle Bayes 74d3d8cb4e Cache OBJ files in MuJoCo compiler.
PiperOrigin-RevId: 616211896
Change-Id: I3b765f4529957914e6154f0e62ef36fd9df93c96
2024-03-15 12:32:06 -07:00