Skip to content

Commit

Permalink
Merge pull request #15 from Co-Evolve/develop
Browse files Browse the repository at this point in the history
v1.0.6
  • Loading branch information
driesmarzougui authored Mar 27, 2024
2 parents 77f9fcf + e479f2f commit 1dd3a9d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
18 changes: 5 additions & 13 deletions moojoco/environment/mjc_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1dd3a9d

Please sign in to comment.