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

Migrating to gymnasium #149

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
12 changes: 9 additions & 3 deletions deepbots/supervisor/controllers/deepbots_supervisor_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gym
import gymnasium as gym
from controller import Supervisor


Expand Down Expand Up @@ -43,7 +43,7 @@ def step(self, action):
"""
raise NotImplementedError

def reset(self):
def reset(self, **kwargs):
"""
Used to reset the world to an initial state.

Expand All @@ -62,7 +62,7 @@ def reset(self):
self.simulationReset()
self.simulationResetPhysics()
super(Supervisor, self).step(int(self.getBasicTimeStep()))
return self.get_default_observation()
return self.get_default_observation(), {}

def get_default_observation(self):
"""
Expand Down Expand Up @@ -109,6 +109,12 @@ def is_done(self):
"""
raise NotImplementedError

def is_terminated(self):
raise NotImplementedError

def is_truncated(self):
raise NotImplementedError

def get_info(self):
"""
This method can be implemented to return any diagnostic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def step(self, action):
return (
self.get_observations(),
self.get_reward(action),
self.is_done(),
self.is_terminated(),
self.is_truncated(),
self.get_info(),
)

Expand Down
3 changes: 2 additions & 1 deletion deepbots/supervisor/controllers/robot_supervisor_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def step(self, action):
return (
self.get_observations(),
self.get_reward(action),
self.is_done(),
self.is_terminated(),
self.is_truncated(),
self.get_info(),
)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gym==0.21
gymnasium>=0.28.1,<0.30
tensorboardX
Loading