google-deepmind / google-deepmind/mujoco
Add distance sensing for SDF geoms
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### The feature, motivation and pitch
The distance sensor returns the distance between two bodies/geoms normally, but if one of the elements is an SDF geom, then it will only return the penetration distance if the geoms are in contact. So if the objects are not in contact then the distance sensor doesn't actually sense the distance and will just return the `cutoff` value.
I'll make this a feature request rather than a bug since this behavior seems intentional/place-holding based on the [mjc_SDF](https://github.com/google-deepmind/mujoco/blob/a2a0b95de01eebf08fa83e5f895a8212d3410a90/src/engine/engine_collision_sdf.c#L662) function that gets used when a distance sensor between an SDF and most other geom types is created.
### Alternatives
_No response_
### Additional context
I used the following model to test:
```
```
You can see that the distance sensor reading between the mobile sphere and the sphere changes value as you slide the mobile sphere around. But the distance sensor reading between the torus (SDF) and the mobile sphere never changes unless the two geoms come into contact.
Contributor guide
Assessment
This issue has not been assessed yet.