Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/diambra env done #98

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sheeprl/configs/env/diambra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ frame_stack: 4
sync_env: True

env:
_target_: sheeprl.envs.diambra_wrapper.DiambraWrapper
_target_: sheeprl.envs.diambra.DiambraWrapper
id: ${env.id}
action_space: discrete
screen_size: ${env.screen_size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _convert_obs(self, obs: Dict[str, Union[int, np.ndarray]]) -> Dict[str, np.n
def step(self, action: Any) -> Tuple[Any, SupportsFloat, bool, bool, Dict[str, Any]]:
obs, reward, done, infos = self._env.step(action)
infos["env_domain"] = "DIAMBRA"
return self._convert_obs(obs), reward, done, False, infos
return self._convert_obs(obs), reward, done or infos.get("env_done", False), False, infos

def render(self, mode: str = "rgb_array", **kwargs) -> Optional[Union[RenderFrame, List[RenderFrame]]]:
return self._env.render("rgb_array")
Expand All @@ -114,3 +114,7 @@ def reset(
self, *, seed: Optional[int] = None, options: Optional[Dict[str, Any]] = None
) -> Tuple[Any, Dict[str, Any]]:
return self._convert_obs(self._env.reset()), {"env_domain": "DIAMBRA"}

def close(self) -> None:
self._env.close()
super().close()
2 changes: 1 addition & 1 deletion sheeprl/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from sheeprl.utils.imports import _IS_DIAMBRA_ARENA_AVAILABLE, _IS_DIAMBRA_AVAILABLE, _IS_DMC_AVAILABLE

if _IS_DIAMBRA_ARENA_AVAILABLE and _IS_DIAMBRA_AVAILABLE:
from sheeprl.envs.diambra_wrapper import DiambraWrapper
from sheeprl.envs.diambra import DiambraWrapper
if _IS_DMC_AVAILABLE:
pass

Expand Down