Skip to content

Commit 2196dba

Browse files
btabacopybara-github
authored andcommitted
Updates to Playground for warp.
PiperOrigin-RevId: 797037846 Change-Id: Ibbfdc590c78b1a3dd32e6e09e5575256174eec61
1 parent 417b030 commit 2196dba

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

mujoco_playground/_src/dm_control_suite/finger.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def default_config() -> config_dict.ConfigDict:
5050
vision=False,
5151
impl="jax",
5252
nconmax=25_000,
53-
njmax=25,
53+
njmax=50,
5454
)
5555

5656

@@ -114,10 +114,11 @@ def reset(self, rng: jax.Array) -> mjx_env.State:
114114
data = mjx_env.make_data(
115115
self._mj_model,
116116
qpos=qpos,
117-
impl=self._mjx_model.impl.value,
117+
impl=self.mjx_model.impl.value,
118118
nconmax=self._config.nconmax,
119119
njmax=self._config.njmax,
120120
)
121+
data = mjx.forward(self.mjx_model, data)
121122

122123
metrics = {}
123124
info = {"rng": rng}
@@ -249,7 +250,14 @@ def reset(self, rng: jax.Array) -> mjx_env.State:
249250
)
250251
qpos = qpos.at[2].set(jax.random.uniform(rng1, minval=-jp.pi, maxval=jp.pi))
251252

252-
data = mjx_env.make_data(self._mj_model, qpos=qpos, impl=self._config.impl)
253+
data = mjx_env.make_data(
254+
self._mj_model,
255+
qpos=qpos,
256+
impl=self.mjx_model.impl.value,
257+
nconmax=self._config.nconmax,
258+
njmax=self._config.njmax,
259+
)
260+
data = mjx.forward(self.mjx_model, data)
253261

254262
target_angle = jax.random.uniform(rng2, minval=-jp.pi, maxval=jp.pi)
255263
hinge_x = data.xanchor[self._hinge_joint_id, 0]

mujoco_playground/_src/locomotion/t1/joystick.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,12 @@ def _reward_alive(self) -> jax.Array:
640640
return jp.array(1.0)
641641

642642
def _cost_collision(self, data: mjx.Data) -> jax.Array:
643-
return jp.array([
643+
return jp.array(
644644
data.sensordata[
645645
self._mj_model.sensor_adr[self._left_foot_right_foot_found_sensor]
646646
]
647647
> 0
648-
])
648+
)
649649

650650
# Pose-related rewards.
651651

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<mujoco>
22
<sensor>
3-
<contact name="left_foot_1_floor_found" geom1="left_foot_1" geom2="floor" num="1" data="found"/>
4-
<contact name="left_foot_2_floor_found" geom1="left_foot_2" geom2="floor" num="1" data="found"/>
5-
<contact name="left_foot_3_floor_found" geom1="left_foot_3" geom2="floor" num="1" data="found"/>
6-
<contact name="left_foot_4_floor_found" geom1="left_foot_4" geom2="floor" num="1" data="found"/>
7-
<contact name="right_foot_1_floor_found" geom1="right_foot_1" geom2="floor" num="1" data="found"/>
8-
<contact name="right_foot_2_floor_found" geom1="right_foot_2" geom2="floor" num="1" data="found"/>
9-
<contact name="right_foot_3_floor_found" geom1="right_foot_3" geom2="floor" num="1" data="found"/>
10-
<contact name="right_foot_4_floor_found" geom1="right_foot_4" geom2="floor" num="1" data="found"/>
11-
<contact name="left_foot_right_foot_found" geom1="left_foot" geom2="right_foot" num="1" data="found"/>
3+
<contact name="left_foot_1_floor_found" geom1="left_foot_1" geom2="floor" num="1" reduce="mindist" data="found"/>
4+
<contact name="left_foot_2_floor_found" geom1="left_foot_2" geom2="floor" num="1" reduce="mindist" data="found"/>
5+
<contact name="left_foot_3_floor_found" geom1="left_foot_3" geom2="floor" num="1" reduce="mindist" data="found"/>
6+
<contact name="left_foot_4_floor_found" geom1="left_foot_4" geom2="floor" num="1" reduce="mindist" data="found"/>
7+
<contact name="right_foot_1_floor_found" geom1="right_foot_1" geom2="floor" num="1" reduce="mindist" data="found"/>
8+
<contact name="right_foot_2_floor_found" geom1="right_foot_2" geom2="floor" num="1" reduce="mindist" data="found"/>
9+
<contact name="right_foot_3_floor_found" geom1="right_foot_3" geom2="floor" num="1" reduce="mindist" data="found"/>
10+
<contact name="right_foot_4_floor_found" geom1="right_foot_4" geom2="floor" num="1" reduce="mindist" data="found"/>
11+
<contact name="left_foot_right_foot_found" geom1="left_foot" geom2="right_foot" num="1" reduce="mindist" data="found"/>
1212
</sensor>
1313
</mujoco>

0 commit comments

Comments
 (0)