From 21882949b1300af946e028c51bf7f98ff8d1a078 Mon Sep 17 00:00:00 2001 From: Tobias Juelg Date: Tue, 13 Oct 2026 16:58:39 -0700 Subject: [PATCH] fix(join_blocks): disable midpoint integration to stop wall divergence on reset Since rcs-core 0.7.3 (mujoco 3.2.6 -> 3.10.0), MuJoCo integrates standalone free bodies with a midpoint step under implicitfast (added in 3.7). For the wall's heavily damped free joint (damping 1000) this diverges within a few steps of every reset; MuJoCo's instability auto-reset then restores qpos0, teleporting both blocks back onto the wall at the composer add pose. Enable invdiscrete for this task's model, which disables the midpoint step and restores the mujoco 3.2.6 behaviour the dataset was recorded with: blocks are randomized per seed again and the wall responds to pushes as before (20 N push: 1.5 mm vs 1.6 mm displacement on 3.2.6). --- src/duobench/tasks/join_blocks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/duobench/tasks/join_blocks.py b/src/duobench/tasks/join_blocks.py index 427f1cb..36df93b 100644 --- a/src/duobench/tasks/join_blocks.py +++ b/src/duobench/tasks/join_blocks.py @@ -64,6 +64,11 @@ class JoinBlocksTask(Task[JoinBlocksTaskConfig]): @staticmethod def add_task_mujoco(cfg: JoinBlocksTaskConfig, composer: ModelComposer, env_cfg: SimEnvCreatorConfig): """Add task-specific elements to the Mujoco scene.""" + # MuJoCo >= 3.7 integrates standalone free bodies with a midpoint step under implicitfast, which diverges + # for the heavily damped wall joint; the resulting auto-reset teleports all objects back to their add pose. + # invdiscrete disables the midpoint step (behaviour of MuJoCo < 3.7, which the dataset was recorded with). + composer.spec.option.enableflags |= int(mj.mjtEnableBit.mjENBL_INVDISCRETE) + object2world = env_cfg.root_frame_to_world * cfg.object_center_to_root_frame for name in cfg.objects_to_add: