Skip to content

Commit

Permalink
Merge pull request #10 from Co-Evolve/develop
Browse files Browse the repository at this point in the history
v1.0.4
  • Loading branch information
driesmarzougui authored Mar 25, 2024
2 parents e1da263 + e2b05db commit 09fc72a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions moojoco/environment/dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def observation_space(self) -> SpaceType:
def step(
self, state: BaseEnvState, action: chex.Array, *args, **kwargs
) -> BaseEnvState:
return self._env.step(state=state, action=action)
return self._env.step(state=state, action=action, *args, **kwargs)

def reset(
self, rng: np.random.RandomState | chex.PRNGKey, *args, **kwargs
) -> BaseEnvState:
return self._env.reset(rng=rng)
return self._env.reset(rng=rng, *args, **kwargs)

def render(self, state: BaseEnvState) -> List[RenderFrame] | None:
return self._env.render(state=state)
Expand Down
8 changes: 6 additions & 2 deletions moojoco/environment/mjc_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def step(
) -> VectorMJCEnvState:
self._states = list(
self._pool.map(
lambda env, ste, act: env.step(state=ste, action=act),
lambda env, ste, act: env.step(state=ste, action=act, *args, **kwargs),
self._envs,
self._states,
action,
Expand All @@ -277,7 +277,11 @@ def reset(
self, rng: List[np.random.RandomState], *args, **kwargs
) -> VectorMJCEnvState:
self._states = list(
self._pool.map(lambda env, sub_rng: env.reset(sub_rng), self._envs, rng)
self._pool.map(
lambda env, sub_rng: env.reset(sub_rng, *args, **kwargs),
self._envs,
rng,
)
)

return self._merged_states
Expand Down
10 changes: 5 additions & 5 deletions moojoco/environment/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def observation_space(self) -> SpaceType:
def step(
self, state: BaseEnvState, action: chex.Array, *args, **kwargs
) -> BaseEnvState:
return self._env.step(state=state, action=action)
return self._env.step(state=state, action=action, *args, **kwargs)

def reset(
self, rng: np.random.RandomState | chex.PRNGKey, *args, **kwargs
) -> BaseEnvState:
return self._env.reset(rng=rng)
return self._env.reset(rng=rng, *args, **kwargs)

def render(self, state: BaseEnvState) -> List[RenderFrame] | None:
return self._env.render(state=state)
Expand All @@ -83,14 +83,14 @@ def _transform_observations(self, state: BaseEnvState) -> BaseEnvState:
def step(
self, state: BaseEnvState, action: chex.Array, *args, **kwargs
) -> BaseEnvState:
state = self._env.step(state=state, action=action)
state = self._env.step(state=state, action=action, *args, **kwargs)
state = self._transform_observations(state=state)
return state

def reset(
self, rng: np.random.RandomState | chex.PRNGKey, *args, **kwargs
) -> BaseEnvState:
state = self._env.reset(rng=rng)
state = self._env.reset(rng=rng, *args, **kwargs)
state = self._transform_observations(state=state)
return state

Expand All @@ -114,5 +114,5 @@ def step(
self, state: BaseEnvState, action: chex.Array, *args, **kwargs
) -> BaseEnvState:
action, state = self._transform_action(action=action, state=state)
state = self._env.step(state=state, action=action)
state = self._env.step(state=state, action=action, *args, **kwargs)
return state
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.3"
version = "1.0.4"
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.3',
version='1.0.4',
description='A unified framework for implementing and interfacing with MuJoCo and MuJoCo-XLA simulation '
'environments.',
long_description=readme,
Expand Down

0 comments on commit 09fc72a

Please sign in to comment.