-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Description
When contact configurations exhaust the GJK/EPA iteration budget, the resulting wp.printf warnings can flood stdout and currently cannot be suppressed: Warning: opt.ccd_iterations, currently set to 500, needs to be increased.
Raising ccd_iterations didn't help: even at 500, warnings persist. It seems that ccd_tolerance has no effect on discrete geom pairs, epsilon is hardcoded to 0.0 (GJK) / 1e-15 (EPA) in collision_gjk.py:584. Would it be helpful to let users change tolerance in such cases?
Environment: mujoco-warp 3.6.0, warp-lang 1.13.0.dev20260316, Tesla T4
Repro
The issue originally came up on custom convex meshs, I tried to reproduce in a rather contrived, self-contained version below:
"""Eight synthetic 128-vert blobs + box, randomized across parallel worlds."""
import numpy as np, mujoco, mujoco_warp, warp as wp
def make_blob(n=128, seed=0):
rng = np.random.default_rng(seed)
pts = rng.normal(size=(n, 3))
pts /= np.linalg.norm(pts, axis=1, keepdims=True)
pts *= 0.01 + 0.02 * rng.uniform(0, 1, (n, 1)) ** 0.3
pts[:, 0] *= 2.0; pts[:, 2] *= 0.5
return " ".join(f"{x:.6f} {y:.6f} {z:.6f}" for x, y, z in pts)
meshes = [make_blob(128, seed=i) for i in range(8)]
mesh_xml = "\n".join(f'<mesh name="m{i}" vertex="{v}"/>' for i, v in enumerate(meshes))
body_xml = "\n".join(
f'<body pos="{0.025*np.cos(2*np.pi*i/8):.4f} {0.025*np.sin(2*np.pi*i/8):.4f} 0.04"'
f' euler="{np.degrees(2*np.pi*i/8):.1f} 45 0"><freejoint/>'
f'<geom type="mesh" mesh="m{i}"/></body>' for i in range(8))
xml = f"""<mujoco><option ccd_iterations="100"/>
<asset>{mesh_xml}</asset>
<worldbody><geom type="plane" size="1 1 0.1"/>
<body pos="0 0 0.04"><freejoint/><geom type="box" size=".015 .015 .015"/></body>
{body_xml}
</worldbody></mujoco>"""
mjm = mujoco.MjModel.from_xml_string(xml)
mjd = mujoco.MjData(mjm); mujoco.mj_forward(mjm, mjd)
m = mujoco_warp.put_model(mjm)
d = mujoco_warp.make_data(mjm, nworld=4096, njmax=200)
qpos = np.tile(mjd.qpos, (4096, 1)) + np.random.default_rng(42).normal(0, 0.03, (4096, mjm.nq))
d.qpos.assign(wp.array(qpos.astype(np.float32), dtype=float))
for _ in range(10): mujoco_warp.step(m, d)
wp.synchronize()
# Prints: Warning: opt.ccd_iterations, currently set to 100, needs to be increased.ccd_iterations |
worlds | warnings |
|---|---|---|
| 100 | 2048 | yes |
| 500 | 4096 | yes |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels