Commit Graph

767 Commits

Author SHA1 Message Date
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 7eb13777f8 Put sparsity structures in mjModel, don't use them yet.
PiperOrigin-RevId: 795032051
Change-Id: I75c69e881980ff9c308acf00bb3a65f4b2ef12f5
2025-08-14 07:37:42 -07:00
Alessio Quaglino dcdf0a9c5c Use mj_rayMesh for computing an inexact SDF for mesh-SDF collisions.
PiperOrigin-RevId: 794576123
Change-Id: I3c688056a5ed617a0787ccf1f4aa683f9409040f
2025-08-13 07:50:06 -07:00
Yuval Tassa 84ba12e7b3 Clean up and standardize mj_printFormattedData
PiperOrigin-RevId: 793087071
Change-Id: I99d45ccf6591af02ee26e7f800bfbcc872336eb1
2025-08-09 14:03:13 -07:00
Alessio Quaglino ca4ca173ab Fix oct_distance return value.
PiperOrigin-RevId: 792924045
Change-Id: I42b8d0adaae7282d5c4e787fd1c85162720e977b
2025-08-09 00:33:38 -07:00
Rishi Krishnan ed3ff15870 Update MuJoCo's version number following the 3.3.5 release.
PiperOrigin-RevId: 792806341
Change-Id: Ic68ecceacc48ddbd6b0c741ae8f0791551e1b4dd
2025-08-08 16:45:12 -07:00
Kyle Bayes 50fa598d93 Update x_norm in tetrahedron case in GJK.
This check is never called due to the fallback to gjkIntersection, however it's needed for debugging when disabling the fallback.

PiperOrigin-RevId: 792623394
Change-Id: I7178d9afae697bd22984688e89fd1865d3c6a37f
2025-08-08 07:52:00 -07:00
Yuval Tassa 3c6e4f1ece Clean up engine_core_smooth.c
PiperOrigin-RevId: 792564094
Change-Id: I47b3f1953db5402acc49dac373a039c9c0bf1ad9
2025-08-08 04:05:13 -07:00
Alessio Quaglino 49f45a93c8 Guard against division by zero when calculating pressure in tactile sensor.
PiperOrigin-RevId: 791641958
Change-Id: I457bc7f55c0b03e14b9c3944935866ede14f1d51
2025-08-06 05:07:12 -07:00
Kyle Bayes e543ba95c5 Fix comments in meshNormals.
PiperOrigin-RevId: 791169316
Change-Id: I540f06a56862774ae0feb666ab38762853cb1c36
2025-08-05 05:27:41 -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 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