Commit Graph

255 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool b979a26b10 Rename mj_stackAlloc to mj_stackAllocNum.
PiperOrigin-RevId: 561040193
Change-Id: I49ea21ffb5b596471d2aacefb1961c11c5c905d0
2023-08-29 08:43:03 -07:00
Kyle Bayes ea5e00cad8 Move mju_combineSparseCount into engine_util_sparse.
PiperOrigin-RevId: 561025741
Change-Id: I0bdc48554928fc4545a38a8cea3bdeb593bd7ecd
2023-08-29 07:40:53 -07:00
Yuval Tassa df1b3515c7 Add mjData.nl: number of active limit constraints.
PiperOrigin-RevId: 561012367
Change-Id: I9a01fec55502f8a90d7435972e477455ae29df15
2023-08-29 06:32:18 -07:00
Kyle Bayes 389736f5a1 Add Base64, defined by RFC 4648, encoding and decoding to MuJoCo engine.
PiperOrigin-RevId: 561008882
Change-Id: I494eb163bc82e8a5c9ad2116ef119072b08a9f48
2023-08-29 06:14:02 -07:00
Yuval Tassa 5f3e22a45f Refactor a loop in engine_solver.c
PiperOrigin-RevId: 560997065
Change-Id: I26540e4f750eb18d9497bf35396adbb15cc3a122
2023-08-29 05:17:14 -07:00
Yuval Tassa 8ba3291365 Fix typo.
PiperOrigin-RevId: 560750842
Change-Id: I11064d43ab43ff0de96997a859bf32d4b0833e05
2023-08-28 10:29:48 -07:00
Yuval Tassa f44c657544 Restore acceleration after mj_inverse with invdiscrete flag.
PiperOrigin-RevId: 560647025
Change-Id: If51f721426be7ecf2b7aa53048ad8c897b51e76e
2023-08-28 02:17:20 -07:00
Tom Erez 819b5cb982 Add invdiscrete flag to enable discrete-time inverse dynamics with mj_inverse.
PiperOrigin-RevId: 560161140
Change-Id: If3e30be5e9af4982571dd310172f2fc0d8d1c551
2023-08-25 12:08:37 -07:00
Yuval Tassa 4db3377467 Don't use mj_stackAlloc for int allocations.
PiperOrigin-RevId: 559846094
Change-Id: I43eeec0b1970b2c6047be4e7c3548a4ce9aa6f5f
2023-08-24 13:09:51 -07:00
Alessio Quaglino b0077e4052 Use geom margin in the midphase.
At the leaves of the midphase trees in `mj_collideTree`, a bounding sphere test is performed. The margin was incorrectly set to zero instead of reading it from `geom_margin`.

PiperOrigin-RevId: 559782262
Change-Id: Icfceb8445bbf6977582e0061566d7bd4def2f0ae
2023-08-24 09:45:10 -07:00
Yuval Tassa 1dad5993f0 Refactor constraint island representation.
Required for constraint solver islanding.

Replace linked lists with `island_{dof,efc}_{num,adr,ind}`, corresponding to the standard `{rownnz,rowadr,colind}` sparse matrix representation. By effectively defining two sparse matrix structures of dimensions `nisland x nv` and `nisland x nefc`, respectively, this representation is more conducive to reuse of existing sparse matrix utility functions, while being cache-friendlier by making sequential indices adjacent in memory.

PiperOrigin-RevId: 559704957
Change-Id: I919362cbef0d5fe5acc4aa2bb4ffb17eee8223a2
2023-08-24 03:48:57 -07:00
Saran Tunyasuvunakool 1f5a9e8c70 Reinstate max_align_t alignment in mj_stackAllocByte.
PiperOrigin-RevId: 559433104
Change-Id: I891a6a0562cab1c3af0e3dc395304207ca3a3190
2023-08-23 08:22:31 -07:00
Yuval Tassa b7cf479abe Add flag for disabling implicit integration of joint damping in the Euler integrator.
PiperOrigin-RevId: 559398414
Change-Id: I43b23c5e75a2830a64b1898daeaa16f19e011718
2023-08-23 05:51:37 -07:00
Yuval Tassa 5f2a2a325c Fix typo.
PiperOrigin-RevId: 559393250
Change-Id: Ibe257d7db371868d87fbea56111972d3f96f7147
2023-08-23 05:20:50 -07:00
Yuval Tassa e4c3e1468b Fix typo
PiperOrigin-RevId: 559383537
Change-Id: I9510970c26b94b8e8bb90423d6164fc82b9bd016
2023-08-23 04:25:22 -07:00
Yuval Tassa 90f58ebe5d Rename mj_stackAllocBytes to mj_stackAllocByte
PiperOrigin-RevId: 559071711
Change-Id: I19072e07ac86ee0486703aa48b0dceb297f5f893
2023-08-22 04:43:53 -07:00
Nimrod Gileadi dae74030fe Handle initial_capacity = 0 in mju_arrayListCreate.
Add const to ArrayList function arguments where appropriate.

PiperOrigin-RevId: 559064386
Change-Id: I8763974a60a05f34dadd56e953cefa40fe78df42
2023-08-22 04:04:02 -07:00
Matthew Bennice 1d36b57d83 Switch from max_align_t to mjtNum until we sort out the git builds
PiperOrigin-RevId: 558982369
Change-Id: I24d9fd6400dae5e1bc1753ee74484da635ea8ecd
2023-08-21 21:30:49 -07:00
Matthew Bennice c2e586f303 add c stddef to engineio
PiperOrigin-RevId: 558949604
Change-Id: Ibe7fbb1a7fb3fcc9258bff3aae260a805eb853dd
2023-08-21 17:51:08 -07:00
Matthew Bennice 4b983e8439 Add an ArrayList container type.
PiperOrigin-RevId: 558887266
Change-Id: I201978bfa5e6cfa2f4e495feaecf61374baf7b7b
2023-08-21 13:38:45 -07:00
Matthew Bennice 59138af10b Refactor stack allocations to have a clean byte allocation interface.
PiperOrigin-RevId: 558881470
Change-Id: I08c45cb5fa25a1a9c39560e598e805cfa5141c3e
2023-08-21 13:18:29 -07:00
Yuval Tassa 22fd0586b1 Move core_constraint arena allocations to local function.
PiperOrigin-RevId: 558823297
Change-Id: I4a564f0d05c17634e70fbff16e8bdca2e7d7fb63
2023-08-21 10:07:10 -07:00
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
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
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
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
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
taylor howell e695a95efb fix mjd_transitionFD comment 2023-07-14 13:50:57 -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
Yuval Tassa 5cfbb6ac8b Add mjd_quatIntegrate, expose mjd_subQuat.
PiperOrigin-RevId: 546252926
Change-Id: I7d6b2bd6536e7e8afc368f3c46037c20f6a1cb5e
2023-07-07 05:33:24 -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