def _take_action(self, actions):
# if there is only one action space, it wasn't wrapped in Tuple
if len(self.action_spaces) == 1:
actions = [actions]
# send appropriate command for different actions
for spc, cmds, acts in zip(self.action_spaces, self.action_names, actions):
if isinstance(spc, spaces.Discrete):
logger.debug(cmds[acts])
self.agent_host.sendCommand(cmds[acts])
elif isinstance(spc, spaces.Box):
for cmd, val in zip(cmds, acts):
logger.debug(cmd + " " + str(val))
self.agent_host.sendCommand(cmd + " " + str(val))
elif isinstance(spc, spaces.MultiDiscrete):
for cmd, val in zip(cmds, acts):
logger.debug(cmd + " " + str(val))
self.agent_host.sendCommand(cmd + " " + str(val))
else:
logger.warn("Unknown action space for %s, ignoring." % cmds)
评论列表
文章目录