diff --git a/moojoco/environment/mjc_env.py b/moojoco/environment/mjc_env.py index 1f5fb03..e2c8a8c 100644 --- a/moojoco/environment/mjc_env.py +++ b/moojoco/environment/mjc_env.py @@ -98,25 +98,17 @@ def _update_observations(self, state: MJCEnvState) -> MJCEnvState: return state.replace(observations=observations) def _update_simulation(self, state: MJCEnvState, ctrl: ActType) -> MJCEnvState: - mj_data = copy.deepcopy(state.mj_data) - mj_data.ctrl[:] = ctrl + state.mj_data.ctrl[:] = ctrl mujoco.mj_step( m=state.mj_model, - d=mj_data, + d=state.mj_data, nstep=self.environment_configuration.num_physics_steps_per_control_step, ) - # As of MuJoCo 2.0, force-related quantities like cacc are not computed - # unless there's a force sensor in the model. - # See https://github.com/openai/gym/issues/1541 - mujoco.mj_rnePostConstraint(state.mj_model, mj_data) - - # noinspection PyUnresolvedReferences - return state.replace(mj_data=mj_data) + return state def _prepare_reset(self) -> Tuple[mujoco.MjModel, mujoco.MjData]: - model = copy.deepcopy(self.frozen_mj_model) - data = copy.deepcopy(self.frozen_mj_data) - return model, data + mujoco.mj_resetData(self.frozen_mj_model, self.frozen_mj_data) + return self.frozen_mj_model, self.frozen_mj_data def _finish_reset( self, diff --git a/pyproject.toml b/pyproject.toml index 9bafa9b..15f44ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "moojoco" -version = "1.0.5" +version = "1.0.6" authors = [ { name = "Dries Marzougui", email = "dries.marzougui@gmail.com" }, ] diff --git a/setup.py b/setup.py index 043dafb..97a135c 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='moojoco', - version='1.0.5', + version='1.0.6', description='A unified framework for implementing and interfacing with MuJoCo and MuJoCo-XLA simulation ' 'environments.', long_description=readme,