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

#45 fixed, change in callin grenderer.

parent ead89488
No related branches found
No related tags found
No related merge requests found
......@@ -683,6 +683,7 @@ class RenderTool(object):
self.gl.pause(0.00001)
return
def _draw_square(self, center, size, color, opacity=255, layer=0):
......
%% Cell type:markdown id: tags:
# Rail Editor v0.2
%% Cell type:code id: tags:
``` python
%load_ext autoreload
%autoreload 2
```
%% Cell type:code id: tags:
``` python
import numpy as np
from numpy import array
import ipywidgets
import IPython
from IPython.core.display import display, HTML
```
%% Cell type:code id: tags:
``` python
display(HTML("<style>.container { width:95% !important; }</style>"))
```
%% Output
%% Cell type:code id: tags:
``` python
from flatland.utils.editor import EditorMVC, EditorModel, View, Controller
```
%% Output
cpu
%% Cell type:code id: tags:
``` python
mvc = EditorMVC(sGL="PIL" ) # sGL="PIL")
```
%% Output
%% Cell type:markdown id: tags:
## Instructions
- Drag to draw (improved dead-ends)
- Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
- ctrl-click to add agent
- direction chosen randomly to fit rail
- ctrl-shift-click to add target for last agent
- target can be moved by repeating
- to Resize the env (cannot preserve work):
- select "Regen" tab, set regen size slider, click regenerate.
%% Cell type:code id: tags:
``` python
mvc.view.display()
```
%% Output
len: 190 <class 'bytes'> temp.pkl /home/jeremy/projects/aicrowd/rl-trains/notebooks
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\flatland\utils\editor.py in regenerate(self, event)
309 method = self.view.wRegenMethod.value
310 nAgents = self.view.wNAgents.value
--> 311 self.model.regenerate(method, nAgents)
312
313 def setRegenSize(self, event):
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\flatland\utils\editor.py in regenerate(self, method, nAgents)
582 self.fix_env()
583 self.set_env(self.env)
--> 584 self.player = Player(self.env)
585 self.view.new_env()
586 self.redraw()
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\examples\play_model.py in __init__(self, env)
30 # self.agent.qnetwork_local.load_state_dict(torch.load('../flatland/baselines/Nets/avoid_checkpoint9900.pth'))
31 self.agent.qnetwork_local.load_state_dict(torch.load(
---> 32 '../flatland/flatland/baselines/Nets/avoid_checkpoint15000.pth'))
33
34 self.iFrame = 0
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module)
354 (sys.version_info[0] == 3 and isinstance(f, pathlib.Path)):
355 new_fd = True
--> 356 f = open(f, 'rb')
357 try:
358 return _load(f, map_location, pickle_module)
FileNotFoundError: [Errno 2] No such file or directory: '../flatland/flatland/baselines/Nets/avoid_checkpoint15000.pth'
%% Cell type:code id: tags:
``` python
mvc.view.wOutput.clear_output()
mvc.view.wOutput
```
%% Output
%% Cell type:code id: tags:
``` python
len(mvc.editor.env.agents), len(mvc.editor.env.agents_static)
```
%% Output
(0, 0)
......
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