Why can contact -dist be < cylinder radius even when the box visually fully covers the cylinder cross-section? (box vs cylinder, MuJoCo 3.3.4) #2797
Unanswered
kankanzheli
asked this question in
Asking for Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi!
I am a doctor student at Waseda unv, I use MuJoCo for my research on reinforcement learning.I need to simulate the collision between plants and robotic arms.
My setup
MuJoCo: 3.3.4 (Python package and C library)
OS: Ubuntu (GLFW rendering)
GL backend: MUJOCO_GL=glfw
My question
What I’m doing
I’m studying contact depth during a simple collision between a box and a slender cylinder (axis along z, i.e., circular cross-section lies in xy). Both bodies move along x slide joints toward each other. Each simulation step I print the maximal contact depth as pen = max(0.0, -con.dist) and also a “radial depth” I compute myself for the cylinder (project contact point to the cylinder axis and use radius - radial_distance).
Observation (unexpected)
As the bodies start to overlap slightly, -con.dist increases as expected (always < radius).
Once the cylinder center enters the box and the scene evolves toward the box visually covering the whole circular cross-section, the printed -con.dist starts to decrease.
Even when they look completely overlapped in that cross-section view, the reported -con.dist remains below the cylinder radius.
I understand -con.dist is the minimum translation distance (MTD) from GJK/EPA in 3D. My hypothesis is that when the active feature changes (face→edge→vertex, or cylinder side→cap vs box corner/edge), the shortest separation direction becomes oblique (often toward a nearby edge/corner, possibly with an axial component), so the 3D MTD can indeed be smaller than the cross-sectional (radial) overlap. I want to confirm whether this interpretation is correct for cylinder–box contacts in MuJoCo.
Questions
Is -con.dist exactly the depth used by MuJoCo’s soft contact model to compute the normal force, or is there any other penetration-like quantity internally used together with solref/solimp?
For cylinders/capsules, is there a recommended way to obtain a monotonic “radial overlap depth” consistent with cross-section intuition (e.g., project the contact point to the cylinder axis and use radius - distance_to_axis)?
If MuJoCo already exposes such a metric, which field is it?
Are there recommended settings to reduce feature switching (so MTD aligns more with the box face normal), for example by using certain solimp/solref/margin choices or by modeling choices (capsule vs cylinder vs mesh)?
Is there a way to debug which features are active (face/edge/vertex) for the current contact in MuJoCo (any debug flags or fields to inspect)?
What I expected vs saw
I expected that once the cross-section looks fully overlapped, the depth would at least be around the cylinder radius in that view.
What I see is that -con.dist peaks and then decreases as the situation evolves toward full visual coverage of the circular cross-section, and it stays below the radius even when visually fully overlapped.
Could you please confirm:
whether this is the intended behavior of -con.dist (3D MTD) under feature changes for cylinder–box; and
if there’s a recommended MuJoCo-native metric or workflow to obtain a cross-section-consistent (monotonic) depth for cylinders/capsules?
Thank you!
Minimal model and/or code that explain my question
Code:
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions