Skip to content
Snippets Groups Projects
Commit 8bcde5de authored by Egli Adrian (IT-SCI-API-PFI)'s avatar Egli Adrian (IT-SCI-API-PFI)
Browse files

bug fix

parent ffe173bd
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Rail Editor v0.2 # Rail Editor v0.2
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
%load_ext autoreload %load_ext autoreload
%autoreload 2 %autoreload 2
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import numpy as np import numpy as np
from numpy import array from numpy import array
import ipywidgets import ipywidgets
import IPython import IPython
from IPython.core.display import display, HTML from IPython.core.display import display, HTML
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
display(HTML("<style>.container { width:95% !important; }</style>")) display(HTML("<style>.container { width:95% !important; }</style>"))
``` ```
%% Output %% Output
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from flatland.utils.editor import EditorMVC, EditorModel, View, Controller from flatland.utils.editor import EditorMVC, EditorModel, View, Controller
``` ```
%% Output %% Output
cairo installed: OK cairo installed: OK
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
mvc = EditorMVC(sGL="PILSVG" ) # sGL="PIL") mvc = EditorMVC(sGL="PILSVG" ) # sGL="PIL")
``` ```
%% Output %% Output
<flatland.utils.graphics_pil.PILSVG object at 0x00000228826E5048> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x00000228826E5048> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
Clear rails Clear rails
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Instructions ## Instructions
- Drag to draw (improved dead-ends) - Drag to draw (improved dead-ends)
- Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them) - Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
- ctrl-click to add agent - ctrl-click to add agent or select agent
- direction chosen randomly to fit rail - if agent is selected:
- ctrl-shift-click to add target for last agent - ctrl-click to move agent position
- target can be moved by repeating - use rotate agent to rotate 90°
- ctrl-shift-click to set target for selected agent
- target can be moved by repeating
- to Resize the env (cannot preserve work): - to Resize the env (cannot preserve work):
- select "Regen" tab, set regen size slider, click regenerate. - select "Regen" tab, set regen size slider, click regenerate.
- alt-click remove all rails from cell - alt-click remove all rails from cell
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
mvc.view.display() mvc.view.display()
``` ```
%% Output %% Output
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FA48D0> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x0000022882FA48D0> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x000002288301CEB8> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x000002288301CEB8> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x000002288318CD30> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x000002288318CD30> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022883001D30> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x0000022883001D30> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FCC438> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x0000022882FCC438> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022886C20668> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x0000022886C20668> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
complex_rail_generator: num_agents > nr_start_goal, changing num_agents complex_rail_generator: num_agents > nr_start_goal, changing num_agents
complex_rail_generator: num_agents > nr_start_goal, changing num_agents complex_rail_generator: num_agents > nr_start_goal, changing num_agents
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882DF7518> <class 'flatland.utils.graphics_pil.PILSVG'> <flatland.utils.graphics_pil.PILSVG object at 0x0000022882DF7518> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'> <super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
mvc.view.wOutput.clear_output() mvc.view.wOutput.clear_output()
mvc.view.wOutput mvc.view.wOutput
``` ```
%% Output %% Output
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
len(mvc.editor.env.agents), len(mvc.editor.env.agents_static) len(mvc.editor.env.agents), len(mvc.editor.env.agents_static)
``` ```
%% Output %% Output
(0, 0) (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