Can we dynamically change the hfield_size at runtime #2569
-
IntroHi! I am a PhD student at UCLA, I use MJX for my research on a humanoid robot. My setupMJX=3.3.1, WSL on Win11. My questionWe noticed that the in MJX, the Hence, I am wondering if it is possible to change the
Minimal model and/or code that explain my questionCode: # scene from MJX Example
mj_model = mujoco.MjModel.from_xml_path('scene_hfield_mjx.xml')
mj_data = mujoco.MjData(mj_model)
mjx_model = mjx.put_model(mj_model)
# This is numpy
print(type(mjx_model.hfield_size))
# This is jax
print(type(mjx_model.hfield_data)) Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I came to a solution to this, and if you have the same issues, here is how you can deal with them.
This method changes the hfield contact, but the visualization will use the initial |
Beta Was this translation helpful? Give feedback.
I came to a solution to this, and if you have the same issues, here is how you can deal with them.
hfield_size: (radius_x, radius_y, elevation_z, base_z)
is not batchable, meaning all the parallel environments will have the same values.However, the
hfield_data
, representing each node height normalized in [0, 1], is batchable. Hence, you can set theelevation_z
to be the maximum height you want in the randomization. If you want to reduce the roughness i.e. 10% ofelevation_z
, then yourhfield_data
should be in the range of [0, 0.1].This method changes the hfield contact, but the visualization will use the initial
hfield_data
values.