Only do auto-rendering for render_mode = human

(https://gymnasium.farama.org/api/env/#gymnasium.Env.render)
This commit is contained in:
Dominik Moritz Roth 2024-02-10 14:11:54 +01:00
parent e8fb90f1ae
commit a32343807f
11 changed files with 11 additions and 11 deletions

View File

@ -154,7 +154,7 @@ class AntJumpEnv(AntEnvCustomXML):
} }
truncated = False truncated = False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return obs, reward, terminated, truncated, info return obs, reward, terminated, truncated, info

View File

@ -170,7 +170,7 @@ class BeerPongEnv(MujocoEnv, utils.EzPickle):
truncated = False truncated = False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return ob, reward, terminated, truncated, infos return ob, reward, terminated, truncated, infos

View File

@ -110,7 +110,7 @@ class BoxPushingEnvBase(MujocoEnv, utils.EzPickle):
terminated = episode_end and infos['is_success'] terminated = episode_end and infos['is_success']
truncated = episode_end and not infos['is_success'] truncated = episode_end and not infos['is_success']
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return obs, reward, terminated, truncated, infos return obs, reward, terminated, truncated, infos

View File

@ -124,7 +124,7 @@ class HalfCheetahJumpEnv(HalfCheetahEnvCustomXML):
'max_height': self.max_height 'max_height': self.max_height
} }
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info

View File

@ -208,7 +208,7 @@ class HopperJumpEnv(HopperEnvCustomXML):
contact_dist=self.contact_dist or 0 contact_dist=self.contact_dist or 0
) )
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info

View File

@ -140,7 +140,7 @@ class HopperJumpOnBoxEnv(HopperEnvCustomXML):
truncated = self.current_step >= self.max_episode_steps and not terminated truncated = self.current_step >= self.max_episode_steps and not terminated
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info

View File

@ -96,7 +96,7 @@ class HopperThrowEnv(HopperEnvCustomXML):
} }
truncated = False truncated = False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info

View File

@ -119,7 +119,7 @@ class HopperThrowInBasketEnv(HopperEnvCustomXML):
} }
truncated = False truncated = False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info

View File

@ -79,7 +79,7 @@ class ReacherEnv(MujocoEnv, utils.EzPickle):
goal=self.goal if hasattr(self, "goal") else None goal=self.goal if hasattr(self, "goal") else None
) )
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return ob, reward, terminated, truncated, info return ob, reward, terminated, truncated, info

View File

@ -160,7 +160,7 @@ class TableTennisEnv(MujocoEnv, utils.EzPickle):
terminated, truncated = self._terminated, False terminated, truncated = self._terminated, False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return self._get_obs(), reward, terminated, truncated, info return self._get_obs(), reward, terminated, truncated, info

View File

@ -147,7 +147,7 @@ class Walker2dJumpEnv(Walker2dEnvCustomXML):
} }
truncated = False truncated = False
if self.render_active: if self.render_active and self.render_mode=='human':
self.render() self.render()
return observation, reward, terminated, truncated, info return observation, reward, terminated, truncated, info