Commit Graph

754 Commits

Author SHA1 Message Date
Alessio Quaglino 7baaa39846 Add SDF geom to test/testdata/model.xml.
Also, when a mesh has both an octree and a bvh, render only the octree.

PiperOrigin-RevId: 790680831
Change-Id: Iaf3896933f6728af4db1eaa83ff5b06558ab0d19
2025-08-04 03:53:51 -07:00
Alessio Quaglino 100b1a06fd Decrease opacity of taxels with zero value.
This prevents the taxels from being occluded by the convex hull for meshes that do not provide face connectivity.

PiperOrigin-RevId: 790420616
Change-Id: I543fd7b52e4625d921b6b5b5b77b4720020df42a
2025-08-03 08:36:39 -07:00
Alessio Quaglino 80befd64ae Do not cull mjGEOM_TRIANGLE.
PiperOrigin-RevId: 789723631
Change-Id: I8a5aaa78a9fe63458c07b823c7550846c14413b1
2025-08-01 05:28:30 -07:00
Matija Kecman ee63b82e1c Fix the format string when printing uintptr_t
PiperOrigin-RevId: 789333383
Change-Id: I32b190ffa6579a93970650df58865083aa0a18ab
2025-07-31 07:50:45 -07:00
Matija Kecman 23fa7c00d5 Remove usage of size_t types in mjModel, use mjtSize (uint64_t) instead to improve portabilty of MJB files to WASM.
PiperOrigin-RevId: 789321991
Change-Id: Ic25fab876c347fc75f5ca24cad09e8fd972f035f
2025-07-31 07:08:33 -07:00
Bogdan Graur 82cf27992d Initialize variables in copyM2Sparse
PiperOrigin-RevId: 788875024
Change-Id: I87068a3878e0b6bc5227bb61e84c07e75e448eea
2025-07-30 06:16:17 -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 4575089f48 Prevent ray casting from stopping at the SDF bounding box.
The SDF value of the closest point on the bounding box is added to the distance from the bounding box when the query point is outside of it.

PiperOrigin-RevId: 788377943
Change-Id: Id8e489a1d112918c484f5615223d557f2d14b822
2025-07-29 03:10:02 -07:00
Copybara-Service 6416e548aa Merge pull request #2348 from jjyyxx:patch-3
PiperOrigin-RevId: 785518837
Change-Id: I2bbdcb6aea0ff3edfa354389ef758c2d34b93f68
2025-07-21 11:49:39 -07:00
Kyle Bayes 3283fb8655 Fix sign in cylinder support function.
PiperOrigin-RevId: 785394029
Change-Id: I010edab0ba8734a9b91626669fa309a0ddb346e5
2025-07-21 05:12:16 -07:00
Kyle Bayes db72d0d53c Clamp dist in mj_geomDistanceCCD. Closes #2710
PiperOrigin-RevId: 785393424
Change-Id: I508cd2ad6f47ca022cc54f228247ca498fda691f
2025-07-21 05:09:38 -07:00
Yuval Tassa 5e666635f6 Remove mjtVisFlag.mjVIS_FLEXBVH and mjvOption.oct_depth
PiperOrigin-RevId: 783355711
Change-Id: I1e11999d5c533925f1d07266aeca95598a5691ba
2025-07-15 09:08:22 -07:00
Alessio Quaglino 4ea778f2d3 Add octree support to MJX API.
Also, enable the touch sensor to use the octree SDF.

PiperOrigin-RevId: 783313462
Change-Id: I0032c2a7164f4770aa10a3612db3fd70bea954db
2025-07-15 06:44:43 -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
Yuval Tassa 7d5b360dea Add clarifying comments to mju_transformSpatial
PiperOrigin-RevId: 782842640
Change-Id: I1e6fc27a860b4afc3a00ab4be6d5cb2897b4426b
2025-07-14 04:03:14 -07:00
Rishi Krishnan 3c99705f85 Update MuJoCo's version number following the 3.3.4 release.
PiperOrigin-RevId: 781596261
Change-Id: Iac050c4b9cb65542b52fa6b8c54ff2537bc6a648
2025-07-10 10:47:26 -07:00
Yuval Tassa 58c95219dc Modify mjSORT to remove some unnecessary copies.
PiperOrigin-RevId: 781573097
Change-Id: I60148bc88fb64ea6dfee9390efb3fd161ad3f1d8
2025-07-10 09:51:40 -07:00
Alessio Quaglino 2d69610abd Use the geom frame for SDF collisions.
Also disables mesh reorientation for meshes autogenerated with marching cubes from analytic SDFs.

PiperOrigin-RevId: 781487195
Change-Id: I36b66384f240a764823c489f78f22ba9fe32f15f
2025-07-10 05:16:51 -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 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
Taylor Howell 13621879c6 Remove unnecessary loop from mj_collideOBB.
PiperOrigin-RevId: 780629489
Change-Id: I715cd1f72012c0655997ba4c967fa7b5b8731d54
2025-07-08 10:50:33 -07:00
Yuval Tassa d464165e30 Print contact forces in mj_printData.
PiperOrigin-RevId: 780503111
Change-Id: I17c6f1584d5260fa9c88c54d0aea9ec0101c082b
2025-07-08 04:11:10 -07:00
Yuval Tassa 783e6499d8 Remove explicit mjModel dependency from engine_util_misc.c
PiperOrigin-RevId: 780123513
Change-Id: I567e09db3cd13a93a4720742affb62b54bfa5426
2025-07-07 08:33:19 -07:00
Yuval Tassa 2937efd5f2 Use sparse math in mjd_actuator_vel.
PiperOrigin-RevId: 778924297
Change-Id: I221fb338c894f278e9f8401f25056539c62ccc65
2025-07-03 10:52:54 -07:00
Taylor Howell 9eb0745968 Fix comment typo in getimpedance.
PiperOrigin-RevId: 777997980
Change-Id: I0fe87196360e6771db10f4d9b08d43448ea5f54e
2025-07-01 05:33:47 -07:00
Alessio Quaglino 5c1f1f9dba Add octree to meshes of SDF geoms.
PiperOrigin-RevId: 777634862
Change-Id: I3210c2f8d73fd30ceecb0a11abd1d82e086b3d5d
2025-06-30 10:50:15 -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
Taylor Howell 862300def5 Fix comment typo in _resetData.
PiperOrigin-RevId: 774705647
Change-Id: Id933cae9a219798eae266b36bd3efba2a3b88163
2025-06-23 03:49:55 -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 14dc7c2a60 Add "cameraid" attribute to visual/global specifying the default camera to use at model load.
PiperOrigin-RevId: 773783069
Change-Id: I2fff2abdceedc982d89cee8d14b95abceea1c113
2025-06-20 11:41:27 -07:00
Yuval Tassa 4ce6293217 Fix bug in inverse dynamics when tendon armature is present.
PiperOrigin-RevId: 773604419
Change-Id: Iaffe3d831c6a5aba8a0a99c05aa76cbd862745f5
2025-06-20 02:25:04 -07:00
Yuval Tassa 335a9ce0c2 Use early-exit to improve readability of mj_instantiateEquality.
PiperOrigin-RevId: 772917213
Change-Id: I106402d063a8fd0e95154bd8608eb4359d4dfdab
2025-06-18 07:45:23 -07:00
Yuval Tassa 998769a995 Return the total non-zeros from mju_sqrMatTDSparseCount.
PiperOrigin-RevId: 772414653
Change-Id: Ic1cac868af0034196f33d08b2456be77c72cbd50
2025-06-17 04:27:15 -07:00
Kevin Sayed a4ab35c194 update scrubs and set next version
PiperOrigin-RevId: 770740070
Change-Id: I6b2f1356706b1849872df2583adbbb3f72057884
2025-06-12 11:39:45 -07:00
Google DeepMind 9b2b7cf92a Set light intensity to 0 by default (not 1000).
PiperOrigin-RevId: 764257692
Change-Id: If656095e3f8d4b4d9c97fa67bdad508a49095eb3
2025-05-28 07:47:28 -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
Google DeepMind 568620dd2f Add texture attribute to lights.
PiperOrigin-RevId: 763739805
Change-Id: I333ed2ac68f30f79f688ca01d7b5fd6bf2d836c9
2025-05-27 05:04:01 -07:00
Yuval Tassa 89e39dc0a7 Expose mj_makeM as a sub-component.
PiperOrigin-RevId: 763662068
Change-Id: I55ced456dca751c1de09fb35e2f73c60ffc0d626
2025-05-27 00:35:55 -07:00
Google DeepMind eb6f7dc6b7 Gate some calls with __EMSCRIPTEN__
PiperOrigin-RevId: 762520516
Change-Id: If9f7729721bab8c947861a968cf96eecc6591228
2025-05-23 12:10:52 -07:00
Google DeepMind 74cc904edc Convert light directional boolean into a type enum.
PiperOrigin-RevId: 761983728
Change-Id: Id5bf93c103e5358d9c5cd9f1176532a978e0b3a8
2025-05-22 08:51:18 -07:00
Google DeepMind 373b4c0437 Support image/ktx format for textures.
PiperOrigin-RevId: 761926074
Change-Id: I6a312634b5bdc706ea5166bc3b2be273e14c1c8a
2025-05-22 05:47:55 -07:00
Yuval Tassa 94803d772c Enable multithreading of Newton solver.
PiperOrigin-RevId: 760723081
Change-Id: Ib7d3c9cec2fdf7dd0e46a570f37c0a6fc5424c7b
2025-05-19 12:18:22 -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 84d658a5ad Remove redundant variable in mj_factorI
PiperOrigin-RevId: 760604094
Change-Id: I664b4cc9d717bc12a4711feb3fa585777fb7a1aa
2025-05-19 06:42:11 -07:00