-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
Hello, what I am doing is packaging HFO into a GYM environment for multi-agent reinforcement learning algorithms. To always maintain the connection between the algorithm and the HFO server. I will" hfo_env connectToServer (hfo. LOW_LEVEL_FEATURE_SET,
'/root/autodl-tmp/HFO-master/bin/teams/base/config/formations-dt',
Args. Port, 'localhost', 'base_left', False) "wraps to a thread. And keep the thread in a loop. However, the connection still cannot be maintained and the server will down. And it is no use to add"config.set_serverWaitSeconds(500);//add" in HFO.cpp, Do you know why? My thread code is at the bottom.


class Player(threading.Thread):
def __init__(self, queue_state, queue_status, queue_next,queue_action, mark, *args, **kwargs):
super(Player, self).__init__(*args, **kwargs)
self.__flag = threading.Event() # 用于暂停线程的标识
self.__flag.set() # 设置为True
#self.__flag.clear()
self.__running = threading.Event() # 用于停止线程的标识
self.__running.set() # 将running设置为True
self.hfo_env = hfo.HFOEnvironment()
self.__reset = False
self.__step = False
self.__close = False
self.action = 0# or
self.next_state = np.zeros([state_space])
self.status=1
self.state = np.zeros([state_space])
self.mark=mark
self.queue_state=queue_state
self.queue_action=queue_action
self.queue_status=queue_status
self.queue_next=queue_next
def run(self):
self.hfo_env.connectToServer(hfo.LOW_LEVEL_FEATURE_SET,
'/root/autodl-tmp/HFO-master/bin/teams/base/config/formations-dt',
6000, 'localhost', 'base_left', False)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels