Commit Graph

395 Commits

Author SHA1 Message Date
Kyle Bayes bdccbcc60a Add multiccd fields to MJX and add simplex box-mesh model.
PiperOrigin-RevId: 813190617
Change-Id: Idc450da59d6420825077a642719525750f6551ec
2025-09-30 03:40:29 -07:00
Haroon Qureshi 70d03adc71 Store the status of the scene in the scene itself.
PiperOrigin-RevId: 813119377
Change-Id: Iebff9e7796ca9809ea22902522982bfd96eeba06
2025-09-30 00:06:00 -07:00
Haroon Qureshi fc8979ed4a Add test for checking exhausted geoms.
PiperOrigin-RevId: 812776271
Change-Id: Ic9456ab201610a69237182ac22147e3d3e240308
2025-09-29 07:18:12 -07:00
Yuval Tassa fe8384b6c5 Visualize joint and tendon limits by re-coloring.
PiperOrigin-RevId: 811590674
Change-Id: I5b65f2294a4bcda3c321fb51ebf29501bd0d416d
2025-09-25 19:02:26 -07:00
Yuval Tassa d71d42a374 Add private function mju_isZeroByte to check for byte-wise zero.
PiperOrigin-RevId: 810456282
Change-Id: I877d0f9225e7a783ed7ff12ce54f4ed0a7889793
2025-09-23 08:49:43 -07:00
Taylor Howell d616f11508 Remove references to deprecated nconmax and njmax.
PiperOrigin-RevId: 809987304
Change-Id: I4109497fe108234dd77011d61eb3ef833e6ae111
2025-09-22 06:28:41 -07:00
Yuval Tassa 681f5767b2 Remove -Wno-extra-semi, add workaround for mjSORT confusing some IDEs
PiperOrigin-RevId: 808689636
Change-Id: Ia091fb597c171a33842e62690d06f32614fbe4eb
2025-09-18 12:28:09 -07:00
Yuval Tassa b9900db00e Extract memory allocation functions and core utilities
PiperOrigin-RevId: 801745499
Change-Id: Iaf05c3430769d3115743d8ab020d13148cb2eb59
2025-09-01 03:38:25 -07:00
Yuval Tassa b092563cab Remove mjDSBL_PASSIVE, split it into mjDSBL_SPRING and mjDSBL_DAMPING.
PiperOrigin-RevId: 800870384
Change-Id: I273e0ceec090901e2620febb67e57914928e94bb
2025-08-29 06:06:28 -07:00
Yuval Tassa 7443e685ac Allow contact sensor subtree1/subtree2 to be any body.
PiperOrigin-RevId: 799632590
Change-Id: If9cd6c5a3a5f83d89ae024a8f64232ab1f1d603a
2025-08-26 11:00:39 -07:00
Taylor Howell 1ac51cf2a5 Update comment in engine_forward_test.cc.
PiperOrigin-RevId: 799550233
Change-Id: I75840bdcb94d4b10962f1fff5a225a6fe5bc0672
2025-08-26 07:12:51 -07:00
Yuval Tassa ec94bb49aa Make constraint island discovery on by default.
Also fix latent bug in mjData serialization.

PiperOrigin-RevId: 799505349
Change-Id: I299e7cc8133fa2ec0b339a7ff3d02543e06778b1
2025-08-26 04:27:24 -07:00
Taylor Howell 4cf5c37211 Fix spelling in engine_forward_test.cc.
PiperOrigin-RevId: 799147728
Change-Id: If5e734ba31961d459281f7cb5edea7c370c1f2fd
2025-08-25 09:15:48 -07:00
Yuval Tassa a230aa60c5 Improve mj_addM and associated test
- Updated docs to clarify that only the lower triangle is touched
- The function was unnecessarily adding the upper triangle in the sparse case
- The test used an unnecessarily large model and stepping it leading to timeouts under ASAN

PiperOrigin-RevId: 798528736
Change-Id: I592cc17dfb62379bb0cd6b332a8eb7e8b0ef6355
2025-08-23 03:56:47 -07:00
Yuval Tassa 2f28473bc1 Remove transposed Jacobian fields from mjData
No longer computed unconditionally, only ad-hoc where required.

PiperOrigin-RevId: 797753297
Change-Id: I2030fc342c98ff33575b0526dd72e2110c4fcb74
2025-08-21 07:21:24 -07:00
Yuval Tassa f71053243e Replace std::array with C-style array for error buffer in GJK tests.
PiperOrigin-RevId: 797730796
Change-Id: I228c58e163c8c6d1426a88c1a6f447c4a56a34e6
2025-08-21 06:03:53 -07:00
Yuval Tassa 174a50442d Allow transposing of sparse sub-matrices whose first row is > 0
PiperOrigin-RevId: 797728559
Change-Id: I3c825118dae198333d357d2e4f248d00b0f5d8ce
2025-08-21 05:56:33 -07:00
Alessio Quaglino b66175eba6 Bending stiffness for curved shells in flex.
PiperOrigin-RevId: 796361841
Change-Id: I105ea235fe2a8e1bcbde67276d77fa92eed214a1
2025-08-18 04:13:18 -07:00
Yuval Tassa 972ffd7b90 Improve mj_fullM documentation, add clarifying test.
PiperOrigin-RevId: 796134559
Change-Id: I85ab3680d3545ccf83d0d3af8a7c21cb36e96d4e
2025-08-17 11:02:14 -07:00
Yuval Tassa 1447711037 Rename spec to sig in state-related API functions.
(to avoid confusion with mjSpec)

PiperOrigin-RevId: 795848898
Change-Id: I0b64eb85f5c7a3ee889a746c751d9f5561650277
2025-08-16 08:38:25 -07:00
Yuval Tassa 5a24eb2d34 Add error reporting to model loading in engine tests, where missing
PiperOrigin-RevId: 795844607
Change-Id: I4163c53c05796c2e3036af28a98f58c15bb1c99c
2025-08-16 08:11:49 -07:00
Yuval Tassa bbb70d98a4 Add utility functions for mapping between sparse matrix patterns.
PiperOrigin-RevId: 795543910
Change-Id: I92be3afc3cd90020027737fffdba18c45e25f825
2025-08-15 11:22:35 -07:00
Yuval Tassa 977f94e9df Delete sparsity structures from mjData, use the ones in mjModel
PiperOrigin-RevId: 795067950
Change-Id: If4f52e40ac49f7c6986b33ef9c8b534199dfd21a
2025-08-14 09:13:02 -07:00
Yuval Tassa 996f0040fd Add built-in sphere mesh.
PiperOrigin-RevId: 791162850
Change-Id: I573a414727e79f1a495e0f2282b2faff48ab3443
2025-08-05 05:05:05 -07:00
Yuval Tassa 7b9f5bdae7 Fix bug in raycast to hfield. Fixes #2765
PiperOrigin-RevId: 790784429
Change-Id: Ib2319722796ed510afed960bbf5cebc86cf185a9
2025-08-04 09:40:59 -07:00
Kyle Bayes f2a2afeb03 Fix address bug in meshEdgeNormals in doing edge multiccd with meshes.
PiperOrigin-RevId: 790731924
Change-Id: Ia475b1f01731518166f229c25ebffd1fbf7c7939
2025-08-04 07:03:14 -07:00
Alessio Quaglino 51babec9c5 Move tactile sensor to the engine.
PiperOrigin-RevId: 788863133
Change-Id: I3172ebb7641fa8146469da25cba7db794760e7b1
2025-07-30 05:27:44 -07:00
Alessio Quaglino 89f4789085 Add mjs_makeMesh to create a builtin mesh.
PiperOrigin-RevId: 788538127
Change-Id: I999733399a1a0da07b0f915f34d31364ab8b3b52
2025-07-29 11:31:18 -07:00
Yuval Tassa a771fc6c09 Increase mjNSENS to 3
PiperOrigin-RevId: 788468705
Change-Id: Id22f131bebb6accc9a29c9aa285efa75fa8b2c16
2025-07-29 08:38:13 -07:00
Yuval Tassa 576a34bcf2 Add netforce reduction to contact sensor.
PiperOrigin-RevId: 783020713
Change-Id: I0d11ccc4e1fd16d07e6f116d64a26485346d9cf1
2025-07-14 13:27:43 -07:00
Yuval Tassa d0e4771c8c Add contact sensor.
PiperOrigin-RevId: 783011982
Change-Id: Ica56fe9d520fa1d1ee7338e09148b1a55a049912
2025-07-14 13:03:35 -07:00
Yuval Tassa ef013a0633 Add mjPARTIAL_SORT macro to engine_sort.h
PiperOrigin-RevId: 782999687
Change-Id: I986aec0e1faedae90f1891b5f3233d5262d167f3
2025-07-14 12:26:36 -07:00
Alessio Quaglino cef02fabea Remove sdflib plugin and move interpolation to engine_collision_sdf.
Before:
```
 Simulation time      : 1.71 s
 Steps per second     : 5854
 Realtime factor      : 11.71 x
 Time per step        : 170.8 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

After:
```
 Simulation time      : 1.41 s
 Steps per second     : 7093
 Realtime factor      : 14.19 x
 Time per step        : 141.0 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

PiperOrigin-RevId: 781087896
Change-Id: Iaf69dccc5e95af5bac862344683c74f962162186
2025-07-09 09:29:47 -07:00
Yuval Tassa a3d251f552 Add mjModel.sensor_intprm, integer parameters of sensors
PiperOrigin-RevId: 781053754
Change-Id: I90e5ef1cab3f87b894dbc70dccfc8bf0046ce1b6
2025-07-09 08:00:21 -07:00
Yuval Tassa e6c5715903 Add insidesite sensor for detecting when an object is inside the volume of a site.
PiperOrigin-RevId: 780993257
Change-Id: I2dcfc840d222680adc3b934344a0819f4d78b6eb
2025-07-09 04:56:42 -07:00
Yuval Tassa 1c98dfd86e Remove unused header
PiperOrigin-RevId: 777505320
Change-Id: I39d4ccf47a49bfb6f74090e59c68373e76a0bcf5
2025-06-30 04:09:10 -07:00
Yuval Tassa 57b3d6d0f4 Make island discovery compatible with flex
PiperOrigin-RevId: 777490642
Change-Id: Iae2f4e8297cc24bded833e04ebfe32895f3a5460
2025-06-30 03:16:57 -07:00
Alessio Quaglino e97e5d31d0 Replace box SDF with a smooth approximation.
This approximation is equivalent to the exact SDF on the surface and externally, but it is smooth on the inside, rotating the gradient from radial at the box center to normal to the faces at the surface, and interpolated linearly (using two Euler angles) in between. This enables stable contact gradients for deeper penetrations.

PiperOrigin-RevId: 776574022
Change-Id: I562976e9f0535b0067aa12b2bc9d48eccb6472e9
2025-06-27 07:21:30 -07:00
Yuval Tassa 2707eadc00 Refactor mj_crb and mj_tendonArmature to use CSR M.
PiperOrigin-RevId: 774077388
Change-Id: Id57118a5d66c074766f5c69fd3b889ebc625cbf7
2025-06-21 04:49:06 -07:00
Yuval Tassa e23b39fbfa Increase test tolerance in engine_solver_test
PiperOrigin-RevId: 773647308
Change-Id: I11605518c4bb1d257763b7f3334de358bacc194c
2025-06-20 04:48:09 -07:00
Kyle Bayes 56b88b59f0 Support 0-simplex in GJK code, and refactor code for efficiency and readability.
PiperOrigin-RevId: 764197889
Change-Id: Ie0d57474060a34a6b908be0386094f442cda448a
2025-05-28 04:19:13 -07:00
Alessio Quaglino 7edbdd0ad6 Remove the Shell plugin and integrate it into the engine.
PiperOrigin-RevId: 760688502
Change-Id: Ia70988d42b7edf571d7cb4a4f48f8fc50b51667d
2025-05-19 10:51:25 -07:00
Yuval Tassa 45fc15b844 Speed up sparse supernode detection by combining it with transposition.
PiperOrigin-RevId: 760673008
Change-Id: I6d66580e675fd86e5b974859383f93f87482ca16
2025-05-19 10:14:15 -07:00
Yuval Tassa ced630181d Replace mjv_sceneState and related code with mjv_copy{Model,Data}
PiperOrigin-RevId: 760662776
Change-Id: I512bda9187fbc19ade6924b91d5cb2275078de42
2025-05-19 09:51:58 -07:00
Yuval Tassa 8268c6d1ff Add mjv_copyData
PiperOrigin-RevId: 760642972
Change-Id: I16227fd91bf42618fda684b15b3650758ae29b13
2025-05-19 08:59:43 -07:00
Yuval Tassa ee8abdf854 Speed up mju_sqrMatTDSparse
PiperOrigin-RevId: 759593417
Change-Id: I0168e1f96333769d09d61e835560910d43aac608
2025-05-16 06:42:17 -07:00
Yuval Tassa e1baa15776 Remove unnecessary argument in mju_mulSymVecSparse
PiperOrigin-RevId: 758688536
Change-Id: Ife1099b948215363ddaa6d0b0edcf3492edcddcc
2025-05-14 08:12:15 -07:00
Yuval Tassa d8bebdc675 Remove unnecessary diagnum argument in mj_solveLD and mj_factorI
PiperOrigin-RevId: 758669364
Change-Id: Icfefc4a7a1e7d28da373725358ccf9d5f589f689
2025-05-14 07:13:27 -07:00
Yuval Tassa dd28b887d4 Rename C sparse structure to M in mjdata, improve docstrings.
PiperOrigin-RevId: 758636638
Change-Id: If78acc423601d2911f514929b27f7b6d0af9ef58
2025-05-14 05:26:19 -07:00
Alessio Quaglino 2386dfd7da Add touch sensor for estimating the surface contact stresses from the SDF.
PiperOrigin-RevId: 758556339
Change-Id: Ib56d76fab084b530fd68d61a29294cb6f1d05f3f
2025-05-14 00:45:58 -07:00