From c8308767adf6ad86570ba31c37d52d4f073f9dc8 Mon Sep 17 00:00:00 2001
From: hagrid67 <jdhwatson@gmail.com>
Date: Thu, 27 Aug 2020 10:35:51 +0100
Subject: [PATCH] changes prior to adding render_episode notebook

---
 flatland/envs/agent_chains.py        |  3 ++-
 flatland/envs/schedule_generators.py | 10 +++++++---
 requirements_dev.txt                 |  1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/flatland/envs/agent_chains.py b/flatland/envs/agent_chains.py
index d13b734b..52789f09 100644
--- a/flatland/envs/agent_chains.py
+++ b/flatland/envs/agent_chains.py
@@ -16,7 +16,8 @@ class MotionCheck(object):
     def addAgent(self, iAg, rc1, rc2, xlabel=None):
         """ add an agent and its motion as row,col tuples of current and next position.
             The agent's current position is given an "agent" attribute recording the agent index.
-            If an agent does not move this round then its cell is 
+            If an agent does not want to move this round (rc1 == rc2) then a self-loop edge is created.
+            xlabel is used for test cases to give a label (see graphviz)
         """
 
         # Agents which have not yet entered the env have position None.
diff --git a/flatland/envs/schedule_generators.py b/flatland/envs/schedule_generators.py
index 1cd10a4b..7d5656dd 100644
--- a/flatland/envs/schedule_generators.py
+++ b/flatland/envs/schedule_generators.py
@@ -329,13 +329,17 @@ def schedule_from_file(filename, load_from_package=None) -> ScheduleGenerator:
 
         # setup with loaded data
         agents_position = [a.initial_position for a in agents]
-        agents_direction = [a.direction for a in agents]
+
+        # this logic is wrong - we should really load the initial_direction as the direction.
+        #agents_direction = [a.direction for a in agents]
+        agents_direction = [a.initial_direction for a in agents]
         agents_target = [a.target for a in agents]
         agents_speed = [a.speed_data['speed'] for a in agents]
-        agents_malfunction = [a.malfunction_data['malfunction_rate'] for a in agents]
+        #agents_malfunction = [a.malfunction_data['malfunction_rate'] for a in agents]
 
         return Schedule(agent_positions=agents_position, agent_directions=agents_direction,
-                        agent_targets=agents_target, agent_speeds=agents_speed, agent_malfunction_rates=None,
+                        agent_targets=agents_target, agent_speeds=agents_speed, 
+                        agent_malfunction_rates=None,
                         max_episode_steps=max_episode_steps)
 
     return generator
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 4ef1cd5b..ca1d82c2 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -22,3 +22,4 @@ gym==0.14.0
 networkx
 ipycanvas
 graphviz
+imagio
-- 
GitLab