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

wrapping HFO for Multi-agents RL #121

Open
torressliu opened this issue Dec 4, 2021 · 2 comments
Open

wrapping HFO for Multi-agents RL #121

torressliu opened this issue Dec 4, 2021 · 2 comments

Comments

@torressliu
Copy link

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.
image
image

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)

@mhauskn

@fanchunpeng
Copy link

兄弟,你搞的咋样的,我最近也在研究如何把HFO改成多智能体,没搞出来?
你这个错误是:两个thread之间要加延时就可以了,time.sleep(5).

@torressliu
Copy link
Author

Hi ,chunpeng. My MA-HFO wrapper is finished.however, the reward functions is not very suitful . we can create a wechat group if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants