From 7a28373a1087a9910c0c7a04b64d8467530fdd53 Mon Sep 17 00:00:00 2001
From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch>
Date: Mon, 24 Jun 2019 17:36:13 +0200
Subject: [PATCH] .

---
 examples/demo.py              |  5 +++--
 flatland/utils/rendertools.py | 12 +++---------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/examples/demo.py b/examples/demo.py
index 06f8f5bd..25e9b8cb 100644
--- a/examples/demo.py
+++ b/examples/demo.py
@@ -101,11 +101,12 @@ class Demo:
                 # update the actions
                 action_dict.update({iAgent: action})
 
+            # render
+            self.renderer.renderEnv(show=True, show_observations=False)
+
             # environment step (apply the actions to all agents)
             next_obs, all_rewards, done, _ = self.env.step(action_dict)
 
-            # render
-            self.renderer.renderEnv(show=True, show_observations=False)
 
             if done['__all__']:
                 break
diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py
index 759b55a9..b4edd99c 100644
--- a/flatland/utils/rendertools.py
+++ b/flatland/utils/rendertools.py
@@ -673,15 +673,9 @@ class RenderTool(object):
                 direction = agent.direction
                 old_direction = agent.direction
 
-            if agent.position[0] == agent.target[0] and agent.position[1] == agent.target[1]:
-                # setAgentAt uses the agent index for the color
-                self.gl.setCellOccupied(iAgent, *(agent.position))
-                self.gl.setCellOccupied(iAgent, *(agent.old_position))
-            else:
-                # setAgentAt uses the agent index for the color
-                self.gl.setCellOccupied(iAgent, *(agent.position))
-                position = agent.position
-                self.gl.setAgentAt(iAgent, *position, old_direction, direction, iSelectedAgent == iAgent)
+            # setAgentAt uses the agent index for the color
+            self.gl.setCellOccupied(iAgent, *(agent.position))
+            self.gl.setAgentAt(iAgent, *position, old_direction, direction, iSelectedAgent == iAgent)
 
         if show_observations:
             self.renderObs(range(env.get_num_agents()), env.dev_obs_dict)
-- 
GitLab