Skip to content

Commit

Permalink
Fix AttributeError in 'mujoco_py.cymj.PyMjData'
Browse files Browse the repository at this point in the history
Fix error: `AttributeError: attribute 'qpos' of 'mujoco_py.cymj.PyMjData' objects is not writable` when running `reset_mujoco()` on `MujocoEnv`. See https://github.com/rlworkgroup/garage/issues/452
  • Loading branch information
henry-zhang-bohan authored Dec 22, 2018
1 parent 33349d9 commit e001cd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion garage/envs/mujoco/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def reset_mujoco(self, init_state=None):
datum = getattr(self.sim.data, datum_name)
datum_dim = datum.shape[0]
datum = init_state[start:start + datum_dim]
setattr(self.sim.data, datum_name, datum)
exec('self.sim.data.%s[:] = datum' % datum_name)
start += datum_dim

@overrides
Expand Down

0 comments on commit e001cd8

Please sign in to comment.