Action space thoughts

This commit is contained in:
Timothyxxx
2023-12-02 18:02:06 +08:00
parent 992d8f8fce
commit 9b214b3d23
4 changed files with 16 additions and 55 deletions

View File

@@ -39,3 +39,10 @@ class PythonController:
return response.json()
except requests.exceptions.RequestException as e:
print("An error occurred while trying to execute the command:", e)
def execute_action(self, action: str):
"""
Executes an action on the server computer.
"""
raise NotImplementedError

View File

@@ -35,7 +35,6 @@ class DesktopEnv(gym.Env):
print("Initializing...")
self._start_emulator()
self.controller = PythonController(http_server=self.host)
# todo: define the action space and the observation space as gym did
def _start_emulator(self):
@@ -87,6 +86,7 @@ class DesktopEnv(gym.Env):
return observation
def step(self, action):
# todo: support both the action space of our-designed space and the executable code space in pyautogui
# Our action space is the set of all possible python commands insides `pyautogui`
self.controller.execute_python_command(action)
observation = self._get_obs()