Commit Graph

350 Commits

Author SHA1 Message Date
Alessio Quaglino b5f9628dd7 Reduce mjMAXCONPAIR to 50.
Use only the first `mjMAXCONPAIR` contacts in SDF-mesh collisions after sorting them using the penetration depth.

PiperOrigin-RevId: 558176217
Change-Id: Ia1ee12bd5ceb81e4c52f143831ad00426e8cf174
2023-08-18 10:02:44 -07:00
Kyle Bayes ba12a1354b Optimize and refactor combineSparse and combineSparseCount.
PiperOrigin-RevId: 558126391
Change-Id: Iead14c31136e789560f3c8124b84bd4e383158f4
2023-08-18 06:14:09 -07:00
Yuval Tassa b1ecc943bb Fix multiple bugs related to mjvSceneState.
PiperOrigin-RevId: 557864131
Change-Id: I47d9692930c54b1304a5cc161f99bbd81d992a7c
2023-08-17 10:25:39 -07:00
Yuval Tassa cf310079e2 Don't allow quat="0 0 0 0" in XML.
PiperOrigin-RevId: 557535436
Change-Id: Ie71246da5fff67a7cc37cb1801dd88d4a79b5766
2023-08-16 10:47:23 -07:00
Alessio Quaglino fdb041580c Add Signed Distance Field to collision geometries.
PiperOrigin-RevId: 557507088
Change-Id: I358a642407aee1ba8dfc9d405eb9a4f609435fe9
2023-08-16 09:15:23 -07:00
Yuval Tassa 6245edae28 Improve island discovery performance
PiperOrigin-RevId: 557444755
Change-Id: I22a2093b563e8e144de9534917955ac403fa5599
2023-08-16 04:55:42 -07:00
Kyle Bayes 8ea690ed70 Remove unused parameters from mju_sqrMatTDSparseInit.
PiperOrigin-RevId: 557114227
Change-Id: Ia7d3fedfba612a68ff01d68f1b9dadb45bd76e85
2023-08-15 06:30:19 -07:00
Yuval Tassa 3e034e38b2 Add constraint island discovery
PiperOrigin-RevId: 557067599
Change-Id: Ic41e1d0efef02b7a79142518afe49cf9d4e74725
2023-08-15 02:30:05 -07:00
Yuval Tassa e4dddea42a Make switch statements over enums in engine source use a typed expression to support compiler checking of full coverage.
PiperOrigin-RevId: 556854229
Change-Id: I36a5d146d776e10b946e2f9b51ace4ef3866471b
2023-08-14 11:17:47 -07:00
Kyle Bayes f34cb22bd3 Reuse sparse Dof-Dof matrix to make compressed sparse M in mj_addM.
PiperOrigin-RevId: 556823353
Change-Id: I650ac83767d60c69859aae6e38aa331f43814378
2023-08-14 09:49:34 -07:00
Kyle Bayes 7e1c65b10e Improve CRB code:
- remove mj_crbSkip since this was only utilized during compile time to compute m->dof_m0, replaced with mj_crbDiag to compute only the diagonals for dof_m0,
- change row backward pass to forward pass to optimize processing diagonal blocks,
- and various code refactoring.

PiperOrigin-RevId: 556799924
Change-Id: I0a18d7a45862860fdddd7150540ddc8d64b01b29
2023-08-14 08:32:12 -07:00
Alessio Quaglino 8ddef7007f Disable convex hull visualization for visual geoms.
This additional check in engine_vis_visualize is necessary for meshes that are shared between visual and colliding geoms.

PiperOrigin-RevId: 556786969
Change-Id: I8270d3f2c0ce497c79b24b282f2f15ece44a423b
2023-08-14 07:45:53 -07:00
Yuval Tassa a276c49c30 Rename `actuatorforcerange and actuatorforcelimited, to actuatorfrcrange and actuatorfrclimited`, respectively.
PiperOrigin-RevId: 556780590
Change-Id: Ide12cf390920f9efe6f79cc9f864a480ce5f256d
2023-08-14 07:18:57 -07:00
Kyle Bayes 93012bf164 Remove legacy MacOS support in mju_alignedMalloc. As of MuJoCo 2.3.7, MacOS 11 is the oldest supported version of MacOS.
PiperOrigin-RevId: 555090388
Change-Id: I57d7abf17952da250f1165f24dfcbb112aea92f9
2023-08-09 01:58:10 -07:00
Kyle Bayes 2d7d5319f7 Rework sparse addM function to support compressed sparse matrices.
Note:

- M is still a nv x nv uncompressed sparse matrix.
- NNZ precounting still needs to be implemented using the combineSparseCount helper function.

PiperOrigin-RevId: 554452710
Change-Id: I14adf58fc3acd4ed82d864d7c2e9e96ee6b0377d
2023-08-07 06:07:24 -07:00
Nimrod Gileadi 2c3297b3e7 Add filterexact and actearly options to MuJoCo.
When filterexact is a new dyntype which is just like the existing `filter`, but the activation state is integrated with exact integration, instead of simple Euler integration.

When actearly is specified on a general actuator, `qfrc_actuator` is computed using the next timestep's `act` value, instead of the current value.

PiperOrigin-RevId: 554438423
Change-Id: If901e4988fa6b518d6f3097f149770665a189a4b
2023-08-07 04:50:33 -07:00
Yuval Tassa a063e2f0ef Add private functions and associated tests related to constraint island discovery.
PiperOrigin-RevId: 553156672
Change-Id: Ifd73e3df443f7955359c5243d5f7756069335c05
2023-08-02 08:43:11 -07:00
Kyle Bayes efca1a76aa Encapsulate mjCMesh data, apply Google C++ naming convention to class members (See https://google.github.io/styleguide/cppguide.html#Variable_Names), and fix a couple of typos.
PiperOrigin-RevId: 553129088
Change-Id: Ic515154220af472f4fc90ca9ade92d86b205cc94
2023-08-02 16:07:44 +01:00
Nimrod Gileadi dac34c91bb Set tendon_invweight0=0 for models with no dofs.
PiperOrigin-RevId: 551851674
Change-Id: I9d2fd1728b4b654e5bb91ac8f0d203e275b7b93a
2023-07-28 07:54:08 -07:00
Kyle Bayes 5f246ef210 Add ReadAttrVec, ReadAttrArr, ReadAttrStr, and ReadAttrNum to XML utils.
Moving forward, the compiler objects should have encapsulated data, therefore the old ReadAttr* methods are being deprecated as they require raw pointers to read into.

No external changes other than minor improvements to ReadAttr and ReadVector.

PiperOrigin-RevId: 550880401
Change-Id: I632f40322ccd935f9af9b69e66b056c5cda6face
2023-07-25 07:31:23 -07:00
Saran Tunyasuvunakool eaf78b798b Bump dev version number to 2.3.8.
PiperOrigin-RevId: 549580971
Change-Id: If8be1910f0196754ce8abb8d91fe604e789ecec8
2023-07-20 03:27:50 -07:00
Saran Tunyasuvunakool c9246e1f50 Release version 2.3.7.
PiperOrigin-RevId: 549565890
Change-Id: I56db138998e43637bdde86de6490a567f0f255ec
2023-07-20 02:13:55 -07:00
Yuval Tassa 51aa375af0 Improvements related to models where joint-actuator relationship is not one-to-one:
- Add `joint-actuatorforcerange` for clamping total actuator force at joints. Add `sensor-jointactuatorfrc` for sensing total actuator forces on a single joint.
See [documentation](https://mujoco.readthedocs.io/en/latest//modeling.html#actuator-force-clamping) for justification and use cases.
- Add simple car model to `model/`.
- Move actuation-related test models into `engine/testdata/actuation/`.

PiperOrigin-RevId: 549355941
Change-Id: I27f6c1f80426d73a2811ef5ae74684a228b2fbd1
2023-07-19 10:29:32 -07:00
Saran Tunyasuvunakool 7603b07a20 Fix broken Linux build in 5fcdae771b.
PiperOrigin-RevId: 549338643
Change-Id: Icb2de7aa77ddb5d6c9bbf6a1140ef388ead5368c
2023-07-19 09:27:25 -07:00
Kyle Bayes 5fcdae771b Add content_type attribute that takes a MIME type to specify the file contents for meshes, hfields, and textures.
PiperOrigin-RevId: 549302344
Change-Id: I30a8adfef5b5d87bb20479329f3396892f5137ff
2023-07-19 06:51:36 -07:00
taylor howell e695a95efb fix mjd_transitionFD comment 2023-07-14 13:50:57 -07:00
Google DeepMind 8f3c488de8 allow specifying static bodies when parsing URDF
PiperOrigin-RevId: 547664406
Change-Id: I4b555431d1877fb7547c6b550387cd4230c2b0c4
2023-07-12 19:42:09 -07:00
Kyle Bayes 242aea93c6 Bump oldest supported MacOS to version 11.
PiperOrigin-RevId: 547479684
Change-Id: Idb6a432af0e7872ca087a0c571aafa72e9528818
2023-07-12 06:38:26 -07:00
Yuval Tassa 77b3533d90 Improve mju_cross implementation.
- Allow in-place cross product a = a x b using `mju_cross(a, a, b)`.
- Easier for compiler to optimize since tmp cannot alias a or b (verified with godbolt).

PiperOrigin-RevId: 547265908
Change-Id: If965867e08c1bc980e71729e38f6855e32de18b2
2023-07-11 12:35:02 -07:00
Alessio Quaglino e2677d6057 Check references for BVH data structure.
PiperOrigin-RevId: 547175700
Change-Id: I10e47f0c81ad25563d1f149bf4d2310ee515b1be
2023-07-11 06:49:20 -07:00
Kyle Bayes 24c1ec9aec Add support for printing to stdout in mj_saveLastXML.
PiperOrigin-RevId: 546849864
Change-Id: I799ea3fcd723cf036f82ef5c1ef8152c314072dc
2023-07-10 06:08:10 -07:00
Yuval Tassa 5cfbb6ac8b Add mjd_quatIntegrate, expose mjd_subQuat.
PiperOrigin-RevId: 546252926
Change-Id: I7d6b2bd6536e7e8afc368f3c46037c20f6a1cb5e
2023-07-07 05:33:24 -07:00
Alessio Quaglino 46e06c4cac Add elasticity plugins to xml_native_writer_test. Fixes #961.
PiperOrigin-RevId: 545454207
Change-Id: I4e93499eaa53e5bc8c8afa682986657cef3ac20f
2023-07-04 08:30:30 -07:00
Saran Tunyasuvunakool 2b38148d24 Explicitly zero out cinert of the world body.
Values of `cinert` are only set by `mj_comPos` for body 1 and above, which leaves the values for body 0 uninitialized. This triggers a `use-of-uninitialized-value` error under msan when the entire `cinert` array is read.

PiperOrigin-RevId: 545453619
Change-Id: I7bfdb4e4e33677903fc90c6ad070490aa65bf464
2023-07-04 08:26:02 -07:00
Kyle Bayes 95167fab2d Add utility function for merging directory names with filenames, and fix issue in mj_addfileVFS where directory names without trailing filesystem separators won't append correctly.
PiperOrigin-RevId: 545450158
Change-Id: I550394f11ac2837d35f3d869f8718a119a9eac38
2023-07-04 08:09:01 -07:00
Kyle Bayes 82e85e24e5 Fix nv precounting bug for dense allocation in contact constraint.
PiperOrigin-RevId: 545441998
Change-Id: I12951d9022d78838a67d8e1d9d80d41b73e7c29d
2023-07-04 07:26:49 -07:00
Yuval Tassa bce2043762 Tighten const qualifiers in collision functions.
PiperOrigin-RevId: 543789453
Change-Id: I929c68b9100a093738c0de6c0965dab4ded1084b
2023-06-27 10:44:58 -07:00
Yuval Tassa a7021df63e Add primitive sphere-cylinder collider.
PiperOrigin-RevId: 543586615
Change-Id: Icd47123e619f731f16dedfec25d825e44c24c036
2023-06-26 17:25:32 -07:00
Yuval Tassa 1d6d6f33bf Cosmetic clean-up and a few micro-optimisations for primitive colliders.
PiperOrigin-RevId: 543559919
Change-Id: I345ccbdca4303e82d1097a5a4bf9381c9f845617
2023-06-26 15:36:20 -07:00
Yuval Tassa c50c92ccc8 Add mjv_connector, identical to mjv_makeConnector but with a more convenient "from-to" parameterization.
PiperOrigin-RevId: 542343761
Change-Id: I75f5ff3c404a2a9f65dfed706e590efd7b951f6e
2023-06-21 13:19:36 -07:00
Nimrod Gileadi 74747e2ae6 Don't accept NaN geom sizes.
PiperOrigin-RevId: 542209911
Change-Id: I80f9728e8e624d19783370ba5072f39624c1bbe7
2023-06-21 04:02:48 -07:00
Kyle Bayes ac1f41160d Add engine internal error macro mjERROR to prepend calling function to error function.
PiperOrigin-RevId: 541584847
Change-Id: I57447e64375413ee07aa96372a402e1ced59ff4a
2023-06-19 03:29:31 -07:00
DeepMind b873800ab3 Initial Implementation of MuJoCo Physics Device
1) Modifications to MJCModel and URDF parsing to enable loading multiple URDF's
2) Device Skeleton for MuJoCo Physics Device
3) Scene Loading and Modifications
4) State Generation

PiperOrigin-RevId: 539676439
Change-Id: Ic65f812b660319443e74f68acd851dba1435ddca
2023-06-12 09:28:27 -07:00
Yuval Tassa f67e359532 Add mjtState enum and related mj_stateSize, mj_getState and mj_setState functions.
PiperOrigin-RevId: 539667943
Change-Id: I14c34be8ce4c287e529380257b5c5bffc3ab45ce
2023-06-12 08:56:48 -07:00
Kyle Bayes 81d74c56e1 Separate mj_addM into dense and sparse functions.
PiperOrigin-RevId: 539066339
Change-Id: Ide3f9644fee46a5fb1a2e79a25be162b929e2421
2023-06-09 06:44:19 -07:00
Yuval Tassa 466c9aca82 Remove mj_activate and mj_deactivate.
PiperOrigin-RevId: 538799120
Change-Id: I4d6729131e20ab9ae15c94c221ba83ae5732e942
2023-06-08 08:55:39 -07:00
Yuval Tassa 188b04fba5 Use std::stable_sort in model compiler.
PiperOrigin-RevId: 538791034
Change-Id: I6c8eceffeb765a8a9801fee996d6ebf2964d8453
2023-06-08 08:21:34 -07:00
Yuval Tassa d82f5ce5a4 Add mjContact.solreffriction, mjModel.pair_solreffriction and related implementation, allowing contact reference acceleration to be different for normal and frictional contact directions. This is required for e.g. elastic frictional collisions.
PiperOrigin-RevId: 538513357
Change-Id: Id9eb910fe791cf898c712030cb2c0fc481389c91
2023-06-07 09:40:20 -07:00
Yuval Tassa d1c6561f1c Add spaces around comparison operators in render/ and ui/ source files.
PiperOrigin-RevId: 536001297
Change-Id: Ia0d97bf9f886aea03b8363e4d97e18301520909f
2023-05-28 07:04:49 -07:00
Yuval Tassa 455b1cd2e2 Add spaces around comparison operators in engine source files.
PiperOrigin-RevId: 535989348
Change-Id: I883f7e82351299933c49b35a31842b5d8d6aea04
2023-05-28 05:02:34 -07:00