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

Add render method with same signature as SB3 underlying class #228

Merged
Merged
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
9 changes: 8 additions & 1 deletion supersuit/vector/sb3_vector_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, List
import warnings
from typing import Any, List, Optional

import numpy as np
from stable_baselines3.common.vec_env import VecEnvWrapper
Expand Down Expand Up @@ -45,3 +46,9 @@ def get_attr(self, attr_name: str, indices: VecEnvIndices = None) -> List[Any]:
return [attr for _ in range(self.num_envs)]
else:
return attr

def render(self, mode: Optional[str] = None) -> Optional[np.ndarray]:
warnings.warn(
"PettingZoo environments do not take the `render(mode)` argument, to change rendering mode, re-initialize the environment using the `render_mode` argument."
)
return self.venv.render()