@@ -52,9 +52,9 @@ def default_config() -> config_dict.ConfigDict:
5252
5353
5454def _make_turn_model (
55- xml_path : epath .Path , target_radius : float
55+ xml_path : epath .Path , target_radius : float , assets : Dict [ str , Any ]
5656) -> mujoco .MjModel :
57- spec = mujoco .MjSpec .from_string (xml_path .read_text (), common . get_assets () )
57+ spec = mujoco .MjSpec .from_string (xml_path .read_text (), assets )
5858 target_site = None
5959 for site in spec .sites :
6060 if site .name == "target" :
@@ -65,10 +65,10 @@ def _make_turn_model(
6565 return spec .compile ()
6666
6767
68- def _make_spin_model (xml_path : epath . Path ) -> mujoco . MjModel :
69- model = mujoco . MjModel . from_xml_string (
70- xml_path . read_text (), common . get_assets ()
71- )
68+ def _make_spin_model (
69+ xml_path : epath . Path , assets : Dict [ str , Any ]
70+ ) -> mujoco . MjModel :
71+ model = mujoco . MjModel . from_xml_string ( xml_path . read_text (), assets )
7272 model .site_rgba [model .site ("target" ).id , 3 ] = 0
7373 model .site_rgba [model .site ("tip" ).id , 3 ] = 0
7474 model .dof_damping [model .joint ("hinge" ).id ] = 0.03
@@ -90,7 +90,8 @@ def __init__(
9090 )
9191
9292 self ._xml_path = _XML_PATH .as_posix ()
93- self ._mj_model = _make_spin_model (_XML_PATH )
93+ self ._model_assets = common .get_assets ()
94+ self ._mj_model = _make_spin_model (_XML_PATH , self ._model_assets )
9495 self ._mj_model .opt .timestep = self .sim_dt
9596 self ._mjx_model = mjx .put_model (self ._mj_model )
9697 self ._post_init ()
@@ -214,7 +215,10 @@ def __init__(
214215 )
215216
216217 self ._xml_path = _XML_PATH .as_posix ()
217- self ._mj_model = _make_turn_model (_XML_PATH , target_radius )
218+ self ._model_assets = common .get_assets ()
219+ self ._mj_model = _make_turn_model (
220+ _XML_PATH , target_radius , self ._model_assets
221+ )
218222 self ._mj_model .opt .timestep = self .sim_dt
219223 self ._mjx_model = mjx .put_model (self ._mj_model )
220224 self ._post_init ()
0 commit comments