Skip to content

Commit 627a647

Browse files
committed
Use nxn_geom_pair_filtered as criteria for nxn.
1 parent 083b203 commit 627a647

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

mujoco_warp/_src/io.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,12 @@ def create_nmodel_batched_array(mjm_array, dtype, expand_dim=True):
396396
# contact sensor
397397
sensor_adr_to_contact_adr = np.clip(np.cumsum(mjm.sensor_type == mujoco.mjtSensor.mjSENS_CONTACT) - 1, a_min=0, a_max=None)
398398

399-
# TODO(team): improve heuristic for selecting broadphase routine
400-
if mjm.ngeom > 1000:
401-
broadphase = types.BroadphaseType.SAP_SEGMENTED
402-
elif mjm.ngeom > 100:
399+
if nxn_geom_pair_filtered.shape[0] < 250_000:
400+
broadphase = types.BroadphaseType.NXN
401+
elif mjm.ngeom < 1000:
403402
broadphase = types.BroadphaseType.SAP_TILE
404403
else:
405-
broadphase = types.BroadphaseType.NXN
404+
broadphase = types.BroadphaseType.SAP_SEGMENTED
406405

407406
condim = np.concatenate((mjm.geom_condim, mjm.pair_dim))
408407
condim_max = np.max(condim) if len(condim) > 0 else 0

0 commit comments

Comments
 (0)