diff --git a/env-data/railway/example_flatland_000.pkl b/env-data/railway/example_flatland_000.pkl index 229a7dc1379de670255a8b2f601fea4882fdbc19..64de2138400ee32332402e25f9eac810b5c8bfad 100644 Binary files a/env-data/railway/example_flatland_000.pkl and b/env-data/railway/example_flatland_000.pkl differ diff --git a/examples/demo.py b/examples/demo.py index 475003cad391193052e23028d244c9fb368bab28..105396cf9977b3855dd39468880ad839ce41a4a0 100644 --- a/examples/demo.py +++ b/examples/demo.py @@ -140,9 +140,14 @@ class Demo: # Action for iAgent in range(self.env.get_num_agents()): action = 2 - agent = self.env.agents[iAgent] - if not self.env.check_action(agent, action)[1]: - action = np.random.choice(self.action_size) + if False: + agent = self.env.agents[iAgent] + trial = 0 + while not self.env.check_action(agent, action)[1]: + action = np.random.choice(self.action_size) + trial += 1 + if trial > 10: + break action_dict.update({iAgent: action}) self.renderer.renderEnv(show=True, action_dict=action_dict) diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py index 9db3cdefb9798bbd3ae42b87345fa2e00e474652..c3ba40f7e21083bdc04a989d7477f6c154a07b85 100644 --- a/flatland/utils/rendertools.py +++ b/flatland/utils/rendertools.py @@ -769,7 +769,7 @@ class RenderTool(object): self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor) else: print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction) - self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction) + # self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction) self.gl.show() for i in range(3): diff --git a/notebooks/Editor2.ipynb b/notebooks/Editor2.ipynb index bc02130d6e820d5e4cb600af4d67973d8a04e71c..76f200ee2c87df268a39ae2bd00bfafe1ec06719 100644 --- a/notebooks/Editor2.ipynb +++ b/notebooks/Editor2.ipynb @@ -106,7 +106,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "71dda738592e49abafe596b348dfc3a1", + "model_id": "e86e118aa3dc4387857ec6bd80a1966b", "version_major": 2, "version_minor": 0 }, @@ -132,7 +132,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b7c1f13e789747b5ac7b65eba3584752", + "model_id": "48a4f97d8d1446f48314d9d72d733d98", "version_major": 2, "version_minor": 0 },