Skip to content
Snippets Groups Projects
Commit 8ab7912e authored by hagrid67's avatar hagrid67
Browse files

initial commit for reintroducing PyQT rendering

parent 144b7460
No related branches found
No related tags found
No related merge requests found
from flatland.envs.rail_env import RailEnv, random_rail_generator from flatland.envs.rail_env import RailEnv, random_rail_generator
# from flatland.core.env_observation_builder import TreeObsForRailEnv # from flatland.core.env_observation_builder import TreeObsForRailEnv
from flatland.utils.rendertools import RenderTool from flatland.utils.rendertools import RenderTool
from flatland.utils.render_qt import QtRailRender
from flatland.baselines.dueling_double_dqn import Agent from flatland.baselines.dueling_double_dqn import Agent
from collections import deque from collections import deque
import torch import torch
...@@ -31,7 +32,8 @@ def main(): ...@@ -31,7 +32,8 @@ def main():
height=7, height=7,
rail_generator=random_rail_generator(cell_type_relative_proportion=transition_probability), rail_generator=random_rail_generator(cell_type_relative_proportion=transition_probability),
number_of_agents=1) number_of_agents=1)
env_renderer = RenderTool(env) # env_renderer = RenderTool(env)
env_renderer = QtRailRender(env)
plt.figure(figsize=(5,5)) plt.figure(figsize=(5,5))
# fRedis = redis.Redis() # fRedis = redis.Redis()
...@@ -101,7 +103,6 @@ def main(): ...@@ -101,7 +103,6 @@ def main():
score += all_rewards[a] score += all_rewards[a]
env_renderer.renderEnv(show=True, frames=True, iEpisode=trials, iStep=step) env_renderer.renderEnv(show=True, frames=True, iEpisode=trials, iStep=step)
sEnv = fR.set("RailEnv0")
obs = next_obs.copy() obs = next_obs.copy()
if done['__all__']: if done['__all__']:
......
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