From 2af8274305f8e4882764a90cee9c7aaac64e888b Mon Sep 17 00:00:00 2001 From: Flim de Jong Date: Wed, 13 Nov 2024 09:22:46 +0100 Subject: [PATCH] updated env.py file --- roboteam_ai/src/RL/env.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/roboteam_ai/src/RL/env.py b/roboteam_ai/src/RL/env.py index d8d59b722..30f0c0a7d 100644 --- a/roboteam_ai/src/RL/env.py +++ b/roboteam_ai/src/RL/env.py @@ -5,13 +5,22 @@ import numpy as np from google.protobuf.message import DecodeError import time +import os +import sys + +# Make root folder /roboteam +current_dir = os.path.dirname(os.path.abspath(__file__)) +roboteam_path = os.path.abspath(os.path.join(current_dir, "../../..")) + +# Add to sys.path +sys.path.append(roboteam_path) # Now import the functions -from src.sentActionCommand import send_action_command -from src.getState import get_ball_state, get_robot_state, get_referee_state -from src.teleportBall import teleport_ball -from src.resetRefereeAPI import reset_referee_state -from src.changeGameState import start_game +from roboteam_ai.src.RL.src.sentActionCommand import send_action_command +from roboteam_ai.src.RL.src.getState import get_ball_state, get_robot_state, get_referee_state +from roboteam_ai.src.RL.src.teleportBall import teleport_ball +from roboteam_ai.src.RL.src.resetRefereeAPI import reset_referee_state +from roboteam_ai.src.RL.src.changeGameState import start_game """ This environment file is in the form of a gymnasium environment. @@ -22,7 +31,9 @@ class RoboTeamEnv(gymnasium.Env): - def __init__(self): + def __init__(self, config=None): + self.config = config or {} # Config placeholder + self.MAX_ROBOTS_US = 10 @@ -242,6 +253,8 @@ def reset(self, seed=None): self.is_blue_dribbling = False observation, _ = self.get_observation() + + print("Reset completed") return observation,{}