Skip to content
Snippets Groups Projects
Commit c7d40119 authored by Erik Nygren's avatar Erik Nygren
Browse files

Merge branch 'master' of gitlab.aicrowd.com:flatland/flatland

parents 80189222 01da99f3
No related branches found
No related tags found
No related merge requests found
......@@ -164,7 +164,6 @@ class Demo:
agent_obs[a] = np.concatenate((time_obs[0][a], time_obs[1][a]))
for step in range(max_nbr_of_steps):
self.renderer.renderEnv(show=True)
time.sleep(.2)
......@@ -175,6 +174,8 @@ class Demo:
action_prob[action] += 1
action_dict.update({a: action})
self.renderer.renderEnv(show=True,action_dict=action_dict)
# Environment step
next_obs, all_rewards, done, _ = self.env.step(action_dict)
for a in range(self.env.get_num_agents()):
......
......@@ -121,7 +121,7 @@ class QTSVG(GraphicsLayer):
self.layout = QGridLayout()
self.layout.setSpacing(0)
self.wMain.setLayout(self.layout)
self.wWinMain.resize(1000, 1000)
self.wWinMain.resize(600, 600)
self.wWinMain.show()
self.wWinMain.setFocus()
......
......@@ -605,7 +605,7 @@ class RenderTool(object):
)
def renderEnv(self, show=False, curves=True, spacing=False,
arrows=False, agents=True, show_observations=True, sRailColor="gray", frames=False,
arrows=False, agents=True, renderobs=True, show_observations=True, sRailColor="gray", frames=False,
iEpisode=None, iStep=None,
iSelectedAgent=None, action_dict=None):
"""
......@@ -618,9 +618,10 @@ class RenderTool(object):
if not self.gl.is_raster():
self.renderEnv2(show, curves, spacing,
arrows, agents, sRailColor,
arrows, agents, renderobs,sRailColor,
frames, iEpisode, iStep,
iSelectedAgent, action_dict)
return
if type(self.gl) in (QTGL, PILGL):
......@@ -764,13 +765,13 @@ class RenderTool(object):
# ** TODO ***
# why should we only update if the action is valid ?
if False:
if True:
if action_isValid:
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor)
else:
pass
# print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
# self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
# pass
print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
else:
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor)
......
......@@ -80,6 +80,7 @@ class Zug(object):
self.svg_curve2 = SVG("svg/Zug_2_Weiche_#0091ea.svg")
def getSvg(self, iAgent, iDirIn, iDirOut, color=None):
delta_dir = (iDirOut - iDirIn) % 4
# if delta_dir != 0:
# print("Bend:", iAgent, iDirIn, iDirOut)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment