Yuval Tassa
2b192cebb6
PUBLIC: In mju_normalize4, don't normalize if norm is less than mjMINVAL away from 1.
...
This makes mj_forward calls idempotent if warmstart is disabled and quats in qpos are normalized.
PiperOrigin-RevId: 564442666
Change-Id: I9c43add82bcfb4101c19fbfbfc8c30091b8906d5
2023-09-11 11:09:53 -07:00
Saran Tunyasuvunakool
a07e172770
Make MuJoCo work with -fsanitize=alignment.
...
PiperOrigin-RevId: 563702045
Change-Id: Ieca69595b7e2fc1e35ca69754d7cc7971825f48b
2023-09-08 03:29:34 -07:00
Saran Tunyasuvunakool
4929077211
Remove mjMARKSTACK and mjFREESTACK macros.
...
PiperOrigin-RevId: 562844184
Change-Id: Id2f57f5d132c47094dad75c6dab7297d7aa73458
2023-09-05 11:41:43 -07:00
Saran Tunyasuvunakool
329ed193ac
Disallow variable-length arrays and turn on -Wpedantic in Clang and GCC.
...
PiperOrigin-RevId: 562832747
Change-Id: I0532624cee31e089a47426305d885687eb0fc5c5
2023-09-05 11:05:04 -07:00
Saran Tunyasuvunakool
94a8705ad0
Add mj_markStack and mj_freeStack as public API functions.
...
Also add asan instrumentation to detect stack frame leakages (i.e. `mj_markStack` without a corresponding `mj_freeStack` in the same caller function).
PiperOrigin-RevId: 562625645
Change-Id: I4e3ff66ca0b9d08ed0a95cef45393db8e3053e22
2023-09-04 17:04:11 -07:00
Yuval Tassa
1aa375ef9a
Allow RHS vector in mj_mulM_island to use uncompressed memory.
...
PiperOrigin-RevId: 562605681
Change-Id: If34bceed9eade59957ac9fd9b6a41fb736b58024
2023-09-04 13:56:54 -07:00
Yuval Tassa
600c12533d
Add mj_constraintUpdate_island.
...
PiperOrigin-RevId: 562581620
Change-Id: If156a02873168127e2c5f2f377532fd45f7eec1c
2023-09-04 10:33:34 -07:00
Yuval Tassa
5cef4708f2
Allow mj_mulJac(T)Vec_island to read and write from uncompressed vectors (length nv or nefc).
...
PiperOrigin-RevId: 562547310
Change-Id: Id517c1842e711639f4113d23cc364945839a3759
2023-09-04 06:51:51 -07:00
Yuval Tassa
feb8aa2fbb
Fix bugs in engine_island.c
...
PiperOrigin-RevId: 562519702
Change-Id: I3075e539ccc1cef92485152721a9344f180aa4b1
2023-09-04 04:06:39 -07:00
Yuval Tassa
29aa5e4a41
Allow dot products with sparse vectors to specify that one vector uses uncompressed memory.
...
PiperOrigin-RevId: 561951337
Change-Id: I1310d7c09d9a85ad9b43877155844a9d0ce6edab
2023-09-01 07:40:16 -07:00
Yuval Tassa
70c5fa50f2
Improve island-constraint testing model.
...
PiperOrigin-RevId: 561931744
Change-Id: I2826d4c5b987cc6edd761026f6734fe40fb31278
2023-09-01 05:52:00 -07:00
Yuval Tassa
eaa2572a8b
Add private function mj_mulJacTVec_island for Jacobian transpose multiplication with sub indices corresponding to one island.
...
PiperOrigin-RevId: 561672392
Change-Id: Ic72fd7de2a542603cc42e1c15ecb4edd27a9a986
2023-08-31 09:12:34 -07:00
Yuval Tassa
85fd922b37
Add private function mj_mulJacVec_island for Jacobian multiplication with sub indices corresponding to one island.
...
PiperOrigin-RevId: 561648540
Change-Id: I8080a620807e824b40b5d6ba484beb06d081d444
2023-08-31 07:28:24 -07:00
Yuval Tassa
9fd186ac2b
Add private function mj_mulM_island for mass matrix multiplication with sub indices corresponding to one island.
...
PiperOrigin-RevId: 561639405
Change-Id: I3777cea51ef22f6847b3cf3e17bdac5cf621c019
2023-08-31 06:42:33 -07:00
Yuval Tassa
129abc6bca
Add private function mj_solveM_island for mass matrix solve with sub indices corresponding to one island.
...
PiperOrigin-RevId: 561622962
Change-Id: Ib43f03b3dd0c7456c57d4ba45a68e0708bf1c91c
2023-08-31 05:11:00 -07:00
Kyle Bayes
f86e8b449f
Refactor VFS logic out of ResourceProvider plugin code.
...
PiperOrigin-RevId: 561302536
Change-Id: I952f9e76e85a7e3a111e0338f307378a6ff58197
2023-08-30 04:47:24 -07:00
Saran Tunyasuvunakool
4c899b92cc
Rename mj_stackAllocByte to mj_stackAlloc and make it public.
...
PiperOrigin-RevId: 561133040
Change-Id: I4f5ffe51c1287aa0c82af68bfe17ed6dd2ad09da
2023-08-29 14:07:54 -07:00
Yuval Tassa
d3ed16e78f
Add mjData.dof_islandind, indexing from dofs into islands.
...
Also fix bug in allocation for constraint islands, added allocation for limit constraints.
PiperOrigin-RevId: 561083128
Change-Id: I9e01d5a5b7454ec3cf60bccadaa0f96f2c0d87d1
2023-08-29 11:06:17 -07:00
Saran Tunyasuvunakool
daa2ac7f8b
Rename nstack to narena, change it and pstack to count bytes.
...
PiperOrigin-RevId: 561066311
Change-Id: I4d0e645e6c254dd906bfc42159e0e99149a7c6c8
2023-08-29 10:13:33 -07:00
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
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
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
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
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
4b983e8439
Add an ArrayList container type.
...
PiperOrigin-RevId: 558887266
Change-Id: I201978bfa5e6cfa2f4e495feaecf61374baf7b7b
2023-08-21 13:38:45 -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
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
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
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
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
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
7401d6786a
Add a test to check that mjData values for the world body are initialized.
...
PiperOrigin-RevId: 545493742
Change-Id: I502b57450ca858b0e96823a416cd7d930fd34489
2023-07-04 12:56:56 -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
Yuval Tassa
a7021df63e
Add primitive sphere-cylinder collider.
...
PiperOrigin-RevId: 543586615
Change-Id: Icd47123e619f731f16dedfec25d825e44c24c036
2023-06-26 17:25:32 -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
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
Saran Tunyasuvunakool
1d79657512
Fix out-of-bound read in mju_combineSparseCount.
...
PiperOrigin-RevId: 535615505
Change-Id: I740d4f50b46ec2a1cd1a5a615fb4312f1bbebd94
2023-05-26 07:44:47 -07:00
Yuval Tassa
c66d79409c
Change mj_ray behaviour to match geom visualisation conventions:
...
- Planes and height-fields respect `mj_ray`'s `geom_group` argument.
- The `flg_static` argument now applies to all static geoms, not only those directly in the world body.
Before this change:
- Rays always intersected with height fields and planes, unless `flg_static` was set to 0.
- `flg_static` only applied to static geoms that were direct children of the world, but not geoms that were children of static bodies.
PiperOrigin-RevId: 534969091
Change-Id: I8dc7c320c63d6af95709b9f5e83a3c50e1c199fa
2023-05-24 13:52:21 -07:00
Alessio Quaglino
03d6d27f64
Use mesh BVH for speeding up ray mesh intersection.
...
PiperOrigin-RevId: 534141245
Change-Id: I9f5a71ea059a1a232fd2910d1efc0506ab6dbef3
2023-05-22 12:05:20 -07:00
Alessio Quaglino
dab49d487c
Use mesh BVH for speeding up ray mesh intersection.
...
PiperOrigin-RevId: 532516008
Change-Id: Ia9cac060279d030221c1a6b4fad457a857701370
2023-05-16 11:10:38 -07:00
Alessio Quaglino
9d1a21f99d
Use mesh BVH for speeding up ray mesh intersection.
...
PiperOrigin-RevId: 532464595
Change-Id: If159c89b93c24e6a7be6310911364cfad7baae81
2023-05-16 08:17:50 -07:00