-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mujoco.mj_geomDistance() returns negative values for non-colliding (sphere, hfield) geom pairs #1784
Comments
Thanks for this. We are currently in the process of significantly improving the collision functions which should hopefully solve this. We will make sure to include height fields in our tests. |
here is a minimal example to reproduce the bug:
kek-.2.mp4 |
Hi @nikisalli, For boxes, MuJoCo is using a bespoke box-box collider. I recommend trying meshes for boxes, so it forces the collider to use the more general MPR collider from libccd. I think that should give you better results for geom distances. In the case of contact, you might need to enable the multiccd flag to generate multiple contacts to give more stable contacts (the box-box collider by default gives multiple contacts). |
thank you but libccd is too slow for my use case, I think I'll stick to multiple capsules to approximate my geometry as I see capsule-box colliders work much better than anything else |
mujoco.mj_geomDistance() returns negative values for non-colliding (sphere, hfield) geom pairs.
In contrast, when testing with (sphere, plane) geom pairs, the function returns positive values as expected.
I am using the mujoco_menagerie/google_barkour_vb scenes for testing, since these include floor geoms of both the planar and hfield types.
To make the measurements, I added the attribute
name="neck_geom"
to the geom with the "neck" mesh in mujoco_menagerie/google_barkour_vb/barkour_vb_mjx.xml and then I ran the code I provided at the end of this report.I raise the height of the freejoint of the robot before simulation because it gets spawned too low into the hfield by default.
For non-colliding (sphere, plane) geom pairs, mujoco.mj_geomDistance() returns positive values as expected.
Example scene: mujoco_menagerie/google_barkour_vb/scene_mjx.xml
For non-colliding (sphere, hfield) geom pairs, mujoco.mj_geomDistance() returns negative values.
Example scene: mujoco_menagerie/google_barkour_vb/scene_hfield_mjx.xml
According to the code linked from the documentation, the mjc_ConvexHField() function handles these collisions.
mujoco.mj_geomDistance() produces negative falues for (sphere, hfield) geom pairs both with and without jax acceleration.
Video of the hfield scene:
video_hfieldO_mj_elevate1.0.mp4
The code I used for generating the figures and the video:
Planar and hfield configurations respecitvely:
OS: ArchLinux 2024.07.01
MuJoCo version: 3.1.6
mujoco_menagerie commit id: 143ae53
Using mujoco python bindings
The text was updated successfully, but these errors were encountered: