Commit Graph

941 Commits

Author SHA1 Message Date
Alessio Quaglino 40b2ae92e5 Reset pending keyframes in source model after attaching.
Fixes #2101.

PiperOrigin-RevId: 680526395
Change-Id: I3bd06db5231d653b1c5bc1c2ba6b03b52e65f288
2024-09-30 05:05:21 -07:00
Alessio Quaglino 58a49bad96 Add nested keyframes attachment test.
This is a no-op change for keyframes but it shows an example of behavior.

Also, fixed two bugs:
- Missing namespace when attaching frames.
- Incorrect body id and subtreedof when attaching a compiled spec. Fixes #2063.

PiperOrigin-RevId: 680289467
Change-Id: I2ddaa7ad2226fa466ec3bbf74a7553d497bb4bb9
2024-09-29 11:57:56 -07:00
Copybara-Service 807ee852d0 Merge pull request #2097 from emotodorov:ui
PiperOrigin-RevId: 679704368
Change-Id: Iae396a134e6019c8cdb935a306f097f9427e134c
2024-09-27 13:16:01 -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 176345b4e1 Remove meaningless const qualifier for scalar arguments in sparse function signatures.
PiperOrigin-RevId: 679568516
Change-Id: I910626cd9555966c3b0a9ffba4064d263b2c16e1
2024-09-27 06:37:18 -07:00
Taylor Howell 6a6e10d779 Add mju_cholFactorNNZ to compute the number of non-zeros per row for sparse Cholesky factorization.
PiperOrigin-RevId: 679553197
Change-Id: I6f92deec347dae97d2e219cfb5376f92e777da1a
2024-09-27 05:39:08 -07:00
Alessio Quaglino bb6da503dc Make 3 the default number of channels in mjsTexture.
PiperOrigin-RevId: 679521155
Change-Id: Ie6c962e75983c8bf8323170338b3d480be3a1117
2024-09-27 03:33:04 -07:00
Emo Todorov a985faef51 section checkbox highligting 2024-09-26 22:22:02 -04:00
Alessio Quaglino 6a415da267 Make from_file() and from_string() classmethod functions.
This prevents the user from modifying an mjSpec and then calling the functions to load it from string/file.

PiperOrigin-RevId: 679311284
Change-Id: I4f1ae3cc8f15bece245f624303470d538deec410
2024-09-26 15:16:10 -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
Alessio Quaglino f0d52813b8 Copy joint state to the modified mjSpec when detaching bodies.
Fixes #2085.

PiperOrigin-RevId: 678351210
Change-Id: I2a546877dd50abc7805099f8d5c40807ffe780e6
2024-09-24 12:26:29 -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
Yuval Tassa 84e0e2839d Improve error message when requested stack allocation is larger than 2^64 bytes.
PiperOrigin-RevId: 677851110
Change-Id: Iaef92f7f48f41f3a4bfaae9c517ff6664afed039
2024-09-23 10:34:33 -07:00
Kyle Bayes 04f8403d8e Add unit tests for NativeCCD to produce better test coverage.
PiperOrigin-RevId: 677793306
Change-Id: I435865f00553c74d1d0c0fa86d9c41fb1e5497ff
2024-09-23 07:55:39 -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 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