Commit Graph

14 Commits

Author SHA1 Message Date
Alessio Quaglino 0995af83f9 Add documentation for SdfLib plugin.
Fixes #2182.

PiperOrigin-RevId: 690980373
Change-Id: Ifc94f928e9cfbdbef3cb6f11ad4bffed542bf49a
2024-10-29 05:32:13 -07:00
Yuval Tassa 8e2f830fd2 Fix type errors in compiler and tests.
In preparation for a float32 build of MuJoCo.

PiperOrigin-RevId: 644407674
Change-Id: I60069f0f865ef89fbf613f5a2ca0c336cc63461e
2024-06-18 09:12:44 -07:00
Yuval Tassa 19388eee0c Fix type errors in engine and plugins.
- Preparation for a float32 build of MuJoCo.
- Fix use of `float`-typed `fabs` in `mju_eig3`.

PiperOrigin-RevId: 643804942
Change-Id: I89f64e8fd39f4e70e78d7607816283e217912383
2024-06-16 12:35:05 -07:00
Yuval Tassa 6067048537 Deprecate mju_rotVecMat and mju_rotVecMatT in favor of mju_mulMatVec3 and mju_mulMatTVec3.
These functions names and argument ordering are more consistent with the rest of the API.

PiperOrigin-RevId: 643788290
Change-Id: I783eda8021b80b82098e23ed95669b102bb82508
2024-06-16 10:02:36 -07:00
Alessio Quaglino 1d181786a2 Prevent visualization of SDF iterations from writing outside the maximum allocated vector. Fixes #1539.
PiperOrigin-RevId: 632071103
Change-Id: Idf91ede1661e717ad338f601a5482ab171d7f625
2024-05-09 01:42:35 -07:00
Alessio Quaglino 5d46c39529 Increased SdfLib bounding box by 10% to prevent querying outside it during collision detection.
In case a query outside is performed, add SDF gradient computation using finite differences.

For SDFs generated from meshes, when the query point lies outside of the bounding box, the gradient provided by SdfLib ignores the SDF and is equivalent to the gradient of the distance from the bounding box, causing local minima in the contact point optimization. This CL increased the size of the bounding boxes and replaces the SdfLib gradient with a finite difference approximation of the gradient if a point lies outside it.

PiperOrigin-RevId: 597839637
Change-Id: I79dfddbe25288eca7eb235db51781fc2bb2c3c5f
2024-01-12 07:54:10 -08:00
Kevin Zakka 2940b934fe Fix typo in sdf plugin readme.
PiperOrigin-RevId: 595404942
Change-Id: I43eb079779538e4ff82d0f549b5a49819ebcd9cb
2024-01-03 08:10:01 -08:00
Alessio Quaglino 4c8ffb44bf Extend SDF outside the bounding box for SdfLib plugin.
SdfLib returns the sum of the distance from a given point to the bounding box and a saved minimum distance from the surface over the whole box boundary. This underestimates the true distance and can cause spurious contacts and jittering. This CL performs a box projection of points outside the bounding box and adds the distance of the original point from the box to the distance of the projected point to the surface. This overestimates the true distance and avoids spurious collisions.

PiperOrigin-RevId: 586701933
Change-Id: I22eecb9757fa22359440156ef6433135648fa3ff
2023-11-30 09:43:06 -08:00
Alessio Quaglino 8ca51b5318 Backtracking line search for SDF collisions.
Increased tolerance above zero in nutbolt.xml since now the two parts lock otherwise. Measured speedup of 2x in this example.

This solves the issue of scale-dependent step sizes. Tested on gears with 10cm diameter and 2cm thickness.

PiperOrigin-RevId: 584009449
Change-Id: Ied2f62dbbbc592470b91cf910f3553802a57c752
2023-11-20 06:33:01 -08:00
Google DeepMind e6dc5ed176 Add inner radius as a parameter for the sdf gear plugin.
PiperOrigin-RevId: 578789045
Change-Id: Id69418d6b1adcce404927de4ed68c94a5ec1f66f
2023-11-02 03:02:32 -07:00
Alessio Quaglino 50843cad30 Add defaults to SDF plugin attributes.
Expose diameter and number of teeth for the gear SDF.

PiperOrigin-RevId: 577779297
Change-Id: Iec5890ab7f39080b395cf06a76f9c2216f4f39ed
2023-10-30 03:09:25 -07:00
Alessio Quaglino 1afd98ec4b Add [SdfLib](https://github.com/UPC-ViRVIG/SdfLib) plugin to first-party SDFs.
The following dependencies are disabled with a cmake patch file.
- Enoki
- OpenMP
- Assimp
- FCPW

PiperOrigin-RevId: 565352386
Change-Id: Icff9de68408e0afa2032bb83b24491fc4e41d181
2023-09-14 06:42:42 -07:00
Alessio Quaglino 15d74ba939 Add missing include to sdf.cc.
PiperOrigin-RevId: 557529739
Change-Id: Iff85d95b35977f7c329baf9a938f4580efd4b606
2023-08-16 10:30:09 -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