Skip to content

Commit

Permalink
Update mujoco_env.py xml file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
KarahanS authored Dec 16, 2024
1 parent 6137784 commit f551d1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gymnasium/envs/mujoco/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def _initialize_simulation(
"""
Initialize MuJoCo simulation data structures `mjModel` and `mjData`.
"""
model = mujoco.MjModel.from_xml_path(self.fullpath)
with open(self.fullpath, 'r') as f:
xml_content = f.read()
model = mujoco.MjModel.from_xml_string(xml_content)
# MjrContext will copy model.vis.global_.off* to con.off*
model.vis.global_.offwidth = self.width
model.vis.global_.offheight = self.height
Expand Down

0 comments on commit f551d1c

Please sign in to comment.