Commit Graph

926 Commits

Author SHA1 Message Date
Yuval Tassa 91cedfd65c Avoid square roots in barycentric coordinate computation.
Also add some `inline` qualifiers.

PiperOrigin-RevId: 676873457
Change-Id: I76f57dc870a8714bd86749a7dee1f10fc5e4be1c
2024-09-20 09:37:40 -07:00
Yuval Tassa 50f43b8745 Fix various issues with body inertial parsing and compiling.
- Add errors in body compiler for incorrect mixing of specifiers.
- Correctly process inertia orientation specifiers.

PiperOrigin-RevId: 676843326
Change-Id: I7e7eb22e25a6769754794f98fad5e0dcc0e5946f
2024-09-20 07:53:42 -07:00
Yuval Tassa 78832db53f Use designated initializers for mjCCDObj.
PiperOrigin-RevId: 676794693
Change-Id: Ie8a35415232e8a9f619713763c5d5a37a6f82935
2024-09-20 04:32:10 -07:00
Kyle Bayes 7a92423cf2 Add height fields to list of discrete objects in NativeCCD.
PiperOrigin-RevId: 676452215
Change-Id: I5d6a0d1e26ee852c774b44f550c1d0531b7a269b
2024-09-19 09:48:41 -07:00
Alessio Quaglino 4998e7b392 Move flex damping to the engine and remove membrane and solid plugins.
PiperOrigin-RevId: 676434954
Change-Id: I24e8dbaa90afcffd613a9cf106ef8b7262195328
2024-09-19 09:01:30 -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
Yuval Tassa f161b63a22 Set default body position to (0, 0, 0).
The "undefined" body position is a remnant of the now-removed `compiler/coordinate` attribute, see [documentation in version 2.3.3](https://mujoco.readthedocs.io/en/2.3.3/modeling.html#cframe) (or older).

PiperOrigin-RevId: 676361485
Change-Id: I104c8da2a988a0430eb85fff8b9b60f8c1e08582
2024-09-19 04:36:39 -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 1a5536ce5b Make edges array const.
PiperOrigin-RevId: 676046588
Change-Id: Ica4bcdb49311bae8ccbf071717d7eb1c7cb55b87
2024-09-18 10:40:38 -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
Kyle Bayes e439b748a4 Replace calls to floor/ceil with mju_floor/mju_ceil.
PiperOrigin-RevId: 675988982
Change-Id: I5f4d09d957ac7030cd4ce70e72f78dd4f07a6090
2024-09-18 07:49:23 -07:00
Alessio Quaglino ddbc083810 Move elasticity computation to mjCFlex.
PiperOrigin-RevId: 675949380
Change-Id: Ia48f4fd6ae1ede206ccacd1205914e7e4b3c7aec
2024-09-18 05:23:10 -07:00
Kyle Bayes 0657e3e871 Fix bug in DeleteFace in NativeCCD.
PiperOrigin-RevId: 675948504
Change-Id: If9d967c8e75580a3a002fce9c10a2e1bfd0b5d46
2024-09-18 05:20:11 -07:00
Kyle Bayes 317f480224 Properly initialize hfield mjCCDObj for collisions.
PiperOrigin-RevId: 675580798
Change-Id: I119258c46562f73af4b7a5d100f69d0e52fbe71c
2024-09-17 08:37:59 -07:00
Kyle Bayes bd811a44e7 Remove redundant copying in NativeCCD and refactor code for readability.
PiperOrigin-RevId: 675573079
Change-Id: If9f7bc21d9ee7806997f05a8985ebe6b1b3c8332
2024-09-17 08:14:10 -07:00
Yuval Tassa 7f7c5ec943 Fix mismatch in mju_wrap function signature definition.
PiperOrigin-RevId: 675204328
Change-Id: I820f10237b6d3bfd36067a9c3aef82cb1908ef6a
2024-09-16 10:34:22 -07:00
Kyle Bayes e94bd8348c Store polytope faces in heap in NativeCCD.
PiperOrigin-RevId: 675197250
Change-Id: Ibe9194d777d68729bffd085e36313fb33ee2756d
2024-09-16 10:17:20 -07:00
Yuval Tassa 48fee9487e Clean up tendon wrapping code.
PiperOrigin-RevId: 675185000
Change-Id: I3d93d7ce65b617c4869eb002dfe9440efa9abf66
2024-09-16 09:47:22 -07:00
Yuval Tassa ce3681a26d Replace hard-coded mjNCATENARY with mjVisual.quality.numslices.
PiperOrigin-RevId: 675157138
Change-Id: I87ea16e4df8ed63b301ceaeac6e1b1d0513b77a0
2024-09-16 08:25:19 -07:00
Kyle Bayes 4628a5e438 Remove vertex struct from NativeCCD and allocate fixed memory for vertices on MuJoCo stack.
PiperOrigin-RevId: 675144892
Change-Id: I23d3316b9346ce7137bcfe84265717b60950898a
2024-09-16 07:45:53 -07:00
Yuval Tassa 2ffa0fe942 Avoid freeing model and/or data twice in case of errors during the compilation process.
PiperOrigin-RevId: 675136721
Change-Id: Ibe01216f86893db44a8279c560c307726fb03f81
2024-09-16 07:18:15 -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 015bdeb756 Disallow repeated nameless assets that use the same file, except for URDFs.
PiperOrigin-RevId: 675114055
Change-Id: I142811ac2d8ef9e12bb8a06d5f3a2fdac02946da
2024-09-16 05:50:50 -07:00
Taylor Howell 60a1921b34 Add site semantics to weld constraint. Fixes #1896
PiperOrigin-RevId: 675112981
Change-Id: Ie4c01440d54116075df89f480591700762892cbd
2024-09-16 05:46:01 -07:00
Alessio Quaglino 2da15cf137 Add flex elasticity stiffness matrix to mjModel.
PiperOrigin-RevId: 675101645
Change-Id: Ic169c108b9eece3657ea4ec211df357abe615b7e
2024-09-16 05:00:54 -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
Kyle Bayes 9f8f6947fc Remove global linear search in favor of (almost constant time) local search when finding the convex hull of the polytope and new point in EPA for NativeCCD.
PiperOrigin-RevId: 673852140
Change-Id: Ib2ab64bad3cd2aa7d252b4016754f37ea30e1077
2024-09-12 08:11:30 -07:00
Kyle Bayes 8d165d5cc7 Fix early termination in GJK. It's possible for x_k to be the origin, so we should run the previous test to conclude that the objects are colliding.
PiperOrigin-RevId: 673834101
Change-Id: I596b30d2847670261f8067840b34dc13de401ecb
2024-09-12 07:17:53 -07:00
Kyle Bayes 14f420069e Make projectOriginPlane in NativeCCD numerically robust.
PiperOrigin-RevId: 673761409
Change-Id: I64304c89f768414d60e2dcf2e71feb8a6f9b2635
2024-09-12 03:01:15 -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
Yuval Tassa e4d4153352 Move sanitizer instrumentation to a separate header file. Fixes #2049.
PiperOrigin-RevId: 672986547
Change-Id: I42522f4925237a73168e965364a2dd65c0f067cb
2024-09-10 09:05:35 -07:00
Alessio Quaglino 4862b9e765 Remove plugin support from Composite particles.
This functionality is replaced by FlexComp.

PiperOrigin-RevId: 672503965
Change-Id: I58953267de285f82e416f9f60576a336b7d0da4c
2024-09-09 04:58:26 -07:00
Kyle Bayes 44145742a7 Exit GJK early if geom distance doesn't need to be recovered.
PiperOrigin-RevId: 672334991
Change-Id: I4af582c799140ccf3ac4d51952e547b08ab5d55e
2024-09-08 14:57:50 -07:00
Kyle Bayes 61721f8d3c Set tolerance in GJK to zero for colliding discrete geoms.
PiperOrigin-RevId: 672326091
Change-Id: Iddec335272461c9aee13c1960640a453ff59f841
2024-09-08 13:49:58 -07:00
Kyle Bayes 4fc6fb179b Remove libccd compatibility layer from native ccd.
PiperOrigin-RevId: 671740643
Change-Id: If3c1097df5c505f70c2dc0c090a7f5a93a43c683
2024-09-06 06:56:01 -07:00
Yuval Tassa 621ea29382 Improve error message for keyframe size mismatch. Fixes #2041
PiperOrigin-RevId: 671069582
Change-Id: Ie63d3bf2b543f7bb5e3c123093095e76a95b7b48
2024-09-04 12:58:31 -07:00
Kyle Bayes b9822e4347 Check hexahedron in polytope3 to make sure it contains the origin. Otherwise, EPA can return invalid results.
PiperOrigin-RevId: 671057312
Change-Id: Ieb21a77ea679ee5c18972d3a0375578d9a98405e
2024-09-04 12:17:54 -07:00
Kyle Bayes 79a5bd0915 Add better boundary tests in polytope3 for EPA.
PiperOrigin-RevId: 671038835
Change-Id: I259260a7b40e825678b52187bee4791266ae10c4
2024-09-04 11:25:44 -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 ae4987026c Add tree element support to mjs_firstElement() and mjs_nextElement().
PiperOrigin-RevId: 671003046
Change-Id: I9e07d7c85c7218e9bded0f50af9db62d0f1e21e1
2024-09-04 09:46:24 -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
Alessio Quaglino 0e8c0b80eb add content_type to model in the XML schema.
PiperOrigin-RevId: 670961443
Change-Id: I98cd6bb61b50029cdd4f5b31e23d268989d136da
2024-09-04 07:25:55 -07:00
Kyle Bayes e9a85764ea Native CCD: Replace mju_malloc with C standard malloc, fix bug in computing v5 in polytope3, and add another warning in EPA.
PiperOrigin-RevId: 670939250
Change-Id: Ia0d8b7c78ed2ef7019f2a691c066b20e98dc1889
2024-09-04 05:53:31 -07:00
Yuval Tassa 3437361bfb Add reduced sparse dof-dof matrix structures to mjData.
PiperOrigin-RevId: 670919263
Change-Id: I3592de802ae84648d97230115c2e9c3437424968
2024-09-04 04:24:02 -07:00
Yuval Tassa 42eb669e4e Precompute mappings between M <-> D sparse representations.
PiperOrigin-RevId: 670898353
Change-Id: I4b15477b1b6eb4a64cf7d4a0bb5af8fcb95d4e45
2024-09-04 02:57:13 -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
Taylor Howell 9cab5a42a4 Remove unnecessary normal vector computation from mju_wrap cylinder case.
PiperOrigin-RevId: 669010760
Change-Id: Ie3869a9f112ca88b2a7ec4990c402ef3e92d36a8
2024-08-29 11:46:38 -07:00
Yuval Tassa a1036b86d3 Allow connect constraints to be specified using sites.
PiperOrigin-RevId: 668925419
Change-Id: I10cb71e6706e617c830cd90d6d0836b94a5a8cfa
2024-08-29 07:10:51 -07:00