Commit Graph

223 Commits

Author SHA1 Message Date
Yuval Tassa c8ff7b3d34 Remove distance constraints.
- `distance` constraints were not very useful and increased the contact buffer within the constraint solver, violating a core design principle. Therefore they have been removed.
- The enum value `mjEQ_DISTANCE` is retained, but errors will be thrown in the parser and engine if these constraints are selected.

PiperOrigin-RevId: 467050101
Change-Id: Ie72a07e4fe338eea5107004a9fc0f5e47eb0c3b7
2022-08-11 14:31:11 -07:00
Copybara-Service 396fdf00c3 Merge pull request #425 from aftersomemath:cull-face-flag
PiperOrigin-RevId: 466904386
Change-Id: Icd5515c2bbb8f8f3417501ea43c8e5ae22b32f91
2022-08-11 02:44:37 -07:00
Nimrod Gileadi 01c297cddd Validate that fields like mjModel.body_jntnum don't contain negative values.
PiperOrigin-RevId: 466733848
Change-Id: I0b1f41fa8841c678307f2185aac4c46a2fd40396
2022-08-10 10:57:36 -07:00
Saran Tunyasuvunakool e3ded23c66 Fix memory leak in mjCModel::Compile.
This is a very subtle leak caused interaction between longjmp and compiler optimisation. Specifically, at the point where the setjmp takes places, these pointers have never been reassigned from its nullptr initialization. Without the volatile keyword, the compiler is free to assume that these pointers remain nullptr when the setjmp returns, and therefore to pass nullptr directly to the mj_deleteModel and mj_deleteData calls in the subsequent catch block, without ever reading the actual pointer values.

PiperOrigin-RevId: 466649447
Change-Id: I51e82ec8b566deb144221e11a99d5124a8267de4
2022-08-10 05:11:53 -07:00
Saran Tunyasuvunakool c2aff3a9f2 Fix memory leak and possibly use-after-free in user_mesh.cc.
The memory handling in the asset loading logic in user_mesh.cc is currently flipped: it frees the asset content buffer when reading from VFS but not from the filesystem. This causes the VFS object to leave these functions in an invalid state, while leaking locally allocated buffers that hold contents read from the filesystem.

PiperOrigin-RevId: 466643390
Change-Id: I162221e019861f23fb61308facd63dbb0422e113
2022-08-10 04:40:11 -07:00
Yuval Tassa d6e46bda50 Add missing braces.
PiperOrigin-RevId: 466576293
Change-Id: Ifea04abeed531befac6ab335bb66b1f1ce0f10a6
2022-08-09 22:53:13 -07:00
Alessio Quaglino 95d5db3f81 Allow malformed meshes for visualization purposes. Throw error only if the mesh is required for inertia computation.
PiperOrigin-RevId: 466421062
Change-Id: I947dbc107e481bd8c328b1a6430ab2e88bc82fd6
2022-08-09 11:41:29 -07:00
Saran Tunyasuvunakool aee73a9023 Fix memory leaks in mj_makeData and mj_makeModel.
Currently, if these functions fail to allocate space for the buffer or stack, it will exit without freeing any of the memory successfully allocated so far.

PiperOrigin-RevId: 466271030
Change-Id: Id01c115ec976482ac5d28c373b5eb47d77f424be
2022-08-09 00:42:17 -07:00
Yuval Tassa 1e41bf5076 Improve <statistic meansize/> documentation.
PiperOrigin-RevId: 466002484
Change-Id: I83edfa4f49e0129c85a2558ecc7bbdef8725ff13
2022-08-08 03:48:21 -07:00
Yuval Tassa 50976a2a1f Move separator to correct location.
PiperOrigin-RevId: 465885126
Change-Id: I7cb8854461cccf56e4f07ec7ae284a102928f9ee
2022-08-07 09:29:52 -07:00
Kevin Zakka e96776c901 Add documentation badge to README.
PiperOrigin-RevId: 465791060
Change-Id: I7d1266bea1b4d59f6ff7f112f35f14f2a62282b1
2022-08-06 13:58:03 -07:00
Yuval Tassa 83b30a6210 Correct mention of the implicit integrator in viscosity documentation.
PiperOrigin-RevId: 465763354
Change-Id: I605165c536de294c6d0981524d7dfab566da55aa
2022-08-06 07:54:10 -07:00
Yuval Tassa 4d24d56c64 Fix simulate window title.
PiperOrigin-RevId: 465763279
Change-Id: I21405891071ae151c057c40725be645fc28cd748
2022-08-06 07:53:11 -07:00
Kevin Zakka a6841120f8 Mention the new Implicit-in-velocity Euler integrator in the XML reference.
#mujoco

PiperOrigin-RevId: 465754132
Change-Id: If1578afe00a69bfa6816d8e18d5fdc9296a69dc4
2022-08-06 05:44:34 -07:00
Copybara-Service 9cd1c2f726 Merge pull request #428 from aftersomemath:segmentation-doc-fix
PiperOrigin-RevId: 465644599
Change-Id: I5f3c0ef5d52935906e73035c371345f936e062ea
2022-08-05 14:11:08 -07:00
Kevin Zakka 80b4ffdd6a Add screenshot button to simulate.
PiperOrigin-RevId: 465628684
Change-Id: I0eb86d6b18c25bb437f197229be6d1c57ccbc50a
2022-08-05 12:56:32 -07:00
Levi Burner 581f009c02 Cull face flag 2022-08-05 11:53:46 -04:00
Levi Burner eab1f0da7d Fix off by one in segmentation with IDCOLOR documentation 2022-08-05 11:46:22 -04:00
Nimrod Gileadi 7a0e0ed80c Use testspeed to test all sample models and all models in mujoco/test.
PiperOrigin-RevId: 465534183
Change-Id: Ic0c398d45ce3a4da5d0a2b7310439f17f0ec4162
2022-08-05 04:25:19 -07:00
Nimrod Gileadi fae896c51b Use a negative size instead of overflow in EngineIoTest.
The MSVC build on GH Actions doesn't detect overflows in mjData or mjModel sizes, so use a negative size instead to trigger an intentional failure in the test.

PiperOrigin-RevId: 465529615
Change-Id: Ic7f15eed782cdda11b29984b136ed4f625418cc8
2022-08-05 03:54:35 -07:00
Yuval Tassa b966a37855 Add optional azimuth and elevation to initial free camera.
- Add `azimuth` and `elevation` to `visual.global`.
- Add `mjv_defaultFreeCamera`.
- Use `mjv_defaultFreeCamera` in `simulate`.

PiperOrigin-RevId: 465505244
Change-Id: I61e60f14a990d4e2d220958adb75c325001978ee
2022-08-05 01:04:02 -07:00
Nimrod Gileadi 5ee184ddaa Add --output-on-failure to ctest invocation on GH Actions.
See https://cmake.org/cmake/help/latest/manual/ctest.1.html

PiperOrigin-RevId: 465414085
Change-Id: Ia8f8da532193cced535bb813cdd66ae48005f91d
2022-08-04 15:05:19 -07:00
Nimrod Gileadi 760816ae18 Make sure the size of items on the model / data buffer is never negative.
Explicitly check that nmocap won't cause overflow when multiplied by 4, to give a nicer error message.

PiperOrigin-RevId: 465380712
Change-Id: I217e3759d55e9761b47db5efd892b8bc811ea8ae
2022-08-04 12:47:21 -07:00
Nimrod Gileadi 4268d81b55 Null out mjData.buffer and mjData.stack before possibly calling mj_deleteData.
While creating an mjData, any error triggers mj_deleteData. If buffer or stack is not NULL at that point, an uninitialized pointer will be freed.

PiperOrigin-RevId: 465378329
Change-Id: I9be0eef0648e05e3e5f1361da346a5046485cde7
2022-08-04 12:36:42 -07:00
Nimrod Gileadi 0e8fd182de Ensure that mjModel->nbody is never zero.
nbody is already checked to be non-negative, but various pieces of code assume it's nonzero (because there's always a world body).

PiperOrigin-RevId: 465339241
Change-Id: I38ce3764074d03bf9a703aa490964c1eb83cc1da
2022-08-04 09:59:16 -07:00
Nimrod Gileadi 999c345b93 Check input vertex coordinates for NaNs when loading STL meshes.
PiperOrigin-RevId: 465327574
Change-Id: I985170941d217031c169ee5107dd1a3bcd27b6af
2022-08-04 09:05:14 -07:00
Saran Tunyasuvunakool 3a3ca37615 Fix msan bugs in bindings_test.py.
PiperOrigin-RevId: 465321721
Change-Id: Ie5bfbf5fb0cd3f2b3db3adc86bff3cb1c4df3da0
2022-08-04 08:36:05 -07:00
Copybara-Service 5f79a1d95f Merge pull request #418 from aftersomemath:simulate-cond-fix
PiperOrigin-RevId: 465238283
Change-Id: If93ed34ce9bb8a4942c1bc30802ee7f4cace8690
2022-08-03 23:42:27 -07:00
Levi Burner 7fb1ffe712 Invert condition variable predicate 2022-08-03 15:59:14 -04:00
Saran Tunyasuvunakool 74539e307e Run apt-get update on Linux in GH Actions.
PiperOrigin-RevId: 465054121
Change-Id: I01702bcc51e03ea27c0da80565296b9f80df46fb
2022-08-03 07:52:12 -07:00
Saran Tunyasuvunakool e40b9da181 Merge pull request #201 from aftersomemath:refactor-simulate
PiperOrigin-RevId: 465044152
Change-Id: I54e65a30764a444dbd175260314d685fd7ffa6a1
2022-08-03 15:32:15 +01:00
Yuval Tassa 6e67391fe9 Add Info.framework.plist to .gitignore
PiperOrigin-RevId: 464765972
Change-Id: Ieef2e92349261bb00b58e1bf3ceeda69fee123e5
2022-08-02 05:26:52 -07:00
Kevin Zakka f71daed66f Fix various typos in doc.
PiperOrigin-RevId: 464730883
Change-Id: Id90d7ca07dddbe2b7a991d0d018c9145fae3c698
2022-08-02 01:46:54 -07:00
Alessio Quaglino f15bcd04b5 Restore legacy center-of-mass computation when exactmeshinertia is false.
PiperOrigin-RevId: 464511268
Change-Id: Ic7c640d01e58dba5049e9fcb2c1b75d6bff4f956
2022-08-01 05:12:30 -07:00
Yuval Tassa 3d77eb1ef4 Add adhesion actuators.
- Adhesion actuators using contact normals as force transmission mechanism.
- Related video: https://youtu.be/HdBue4MUZys

Closes #229

PiperOrigin-RevId: 464389367
Change-Id: I9f69b3cd152d957e8f65870d208788463c036a6d
2022-07-31 08:54:06 -07:00
Alessio Quaglino 5c5449bf82 Compute moment of inertia for concave and boundary meshes. Resolve #338.
- Mesh inertias can now be computed exactly for well-formed (no holes) non-convex meshes.
- To activate this feature, set `<compiler exactmeshinertia="true">` (defaults to `false`). This default may change in the future.
- Added `<geom shellinertia="true/false">` (defaults to `false`). When true, geom inertia is computed assuming all the mass is concentrated on the surface, and `density` is interpreted as surface density (mass/area). Currently only mesh geoms are supported.

PiperOrigin-RevId: 464368395
Change-Id: I17afd99b9b221c9d24ae951f6e63d5c61ff89820
2022-07-31 04:32:28 -07:00
Yuval Tassa 52d78f8d24 Remove unused mjData argument in private function mj_solveLD.
PiperOrigin-RevId: 464087933
Change-Id: Ibe9e9713680a02bfe098c39191f9b706e2c70c12
2022-07-29 08:53:04 -07:00
Yuval Tassa fcf4131771 Add mj_jacSubtreeCom for computing subtree center-of-mass Jacobians.
PiperOrigin-RevId: 464075727
Change-Id: If679c0fdd05b7dc84154cec00963aeea7bbdacc3
2022-07-29 07:44:32 -07:00
Alessio Quaglino cd489fc72d Check if STL vertex coordinates are within maximum bounds.
PiperOrigin-RevId: 464047975
Change-Id: I5c8c32aca468aaee26ff5cf9466a0f2f81721010
2022-07-29 04:13:59 -07:00
Alessio Quaglino 8ead54d2dc Add missing gain type "affine" to general actuators.
PiperOrigin-RevId: 463605415
Change-Id: I849e6f2f0ec5eaedaa774099e5e07f27919bb943
2022-07-27 09:24:17 -07:00
Saran Tunyasuvunakool 807097148e Add internal-only API for creating mjrContext with custom offscreen FBO size.
PiperOrigin-RevId: 463048634
Change-Id: I195cbbf0e13a6c032e86070e8e4c11ad53af8a71
2022-07-25 03:47:02 -07:00
Saran Tunyasuvunakool 95b6327bb5 Fix rendering of reflection for transparent geoms.
PiperOrigin-RevId: 462589429
Change-Id: Ibda2d2b83cb43804644fecfe3a1e2a8496f3de56
2022-07-22 04:09:02 -07:00
Saran Tunyasuvunakool b849023069 Miscellaneous linting in src/engine.
PiperOrigin-RevId: 462415459
Change-Id: I6c79c592613c6b0a665af06faf945586bb6ba32d
2022-07-21 10:16:49 -07:00
Kevin Zakka eef473b1e1 Fix hyperlink to mjd_transitionFD.
PiperOrigin-RevId: 462150695
Change-Id: If736fee2cb629d649c2931aa0c0cbf4ddb56d68b
2022-07-20 08:44:36 -07:00
Yuval Tassa f6e1b02f48 Fix rendering of mjd_transitionFD docstring.
PiperOrigin-RevId: 462117193
Change-Id: Ia7fbd0c1a3cb3a9241f75759fc416a84d55d75fe
2022-07-20 05:23:29 -07:00
Kevin Zakka fa1536c2de Nit fixes to documentation.
PiperOrigin-RevId: 461932200
Change-Id: I3f929e09239c526b1686aa65641e47e759d32827
2022-07-19 11:27:33 -07:00
Alessio Quaglino 8dd9971409 Raise error if mesh has flipped faces.
PiperOrigin-RevId: 461860424
Change-Id: Ib23c50cf7f64de1173404d2f65ad87177fab45b3
2022-07-19 05:47:46 -07:00
Yuval Tassa e6480c76a9 Remove unused imports.
PiperOrigin-RevId: 461829404
Change-Id: I9ae44085af211013ed2b677b7d3a545ccec34605
2022-07-19 02:11:56 -07:00
Tom Erez 151449c47a binary retriever is only relevant for the Editor.
PiperOrigin-RevId: 461629986
Change-Id: Ib2e27bdf30c1fb696773b8d05b3e42a6adc3e0fe
2022-07-18 08:47:03 -07:00
Tom Erez e8a9db82b8 Retrieve the binary only when the MuJoCo package is installed.
PiperOrigin-RevId: 461524833
Change-Id: Ie8ca9dda71b35262f99688d02f71be77c251ea3e
2022-07-17 20:48:06 -07:00