Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sfwatergit
Flatland
Commits
2772cd22
Commit
2772cd22
authored
5 years ago
by
Egli Adrian (IT-SCI-API-PFI)
Browse files
Options
Downloads
Patches
Plain Diff
Editor removed : Player : step()
parent
799be88d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/utils/editor.py
+0
-29
0 additions, 29 deletions
flatland/utils/editor.py
notebooks/Scene_Editor.ipynb
+1
-1
1 addition, 1 deletion
notebooks/Scene_Editor.ipynb
with
1 addition
and
30 deletions
flatland/utils/editor.py
+
0
−
29
View file @
2772cd22
...
...
@@ -9,7 +9,6 @@ from ipywidgets import IntSlider, VBox, HBox, Checkbox, Output, Text, RadioButto
from
numpy
import
array
import
flatland.utils.rendertools
as
rt
from
examples.play_model
import
Player
from
flatland.envs.agent_utils
import
EnvAgent
,
EnvAgentStatic
from
flatland.envs.env_utils
import
mirror
from
flatland.envs.generators
import
complex_rail_generator
,
empty_rail_generator
...
...
@@ -113,9 +112,6 @@ class View(object):
VBox
([
self
.
wShowObs
]),
]
# Progress bar intended for stepping in the background (not yet working)
self
.
wProg_steps
=
ipywidgets
.
IntProgress
(
value
=
0
,
min
=
0
,
max
=
20
,
step
=
1
,
description
=
"
Step
"
)
# abbreviated description of buttons and the methods they call
ldButtons
=
[
dict
(
name
=
"
Refresh
"
,
method
=
self
.
controller
.
refresh
,
tip
=
"
Redraw only
"
),
...
...
@@ -128,7 +124,6 @@ class View(object):
tip
=
"
Regenerate the rails using the method selected below
"
),
dict
(
name
=
"
Load
"
,
method
=
self
.
controller
.
load
),
dict
(
name
=
"
Save
"
,
method
=
self
.
controller
.
save
),
dict
(
name
=
"
Step
"
,
method
=
self
.
controller
.
step
)
]
self
.
lwButtons
=
[]
...
...
@@ -360,7 +355,6 @@ class Controller(object):
self
.
model
.
init_agents_static
]
self
.
model
.
env
.
agents
=
None
self
.
model
.
init_agents_static
=
None
self
.
player
=
None
self
.
model
.
env
.
restart_agents
()
self
.
model
.
env
.
reset
(
False
,
False
)
self
.
refresh
(
event
)
...
...
@@ -413,7 +407,6 @@ class EditorModel(object):
self
.
env_filename
=
"
temp.pkl
"
self
.
set_env
(
env
)
self
.
iSelectedAgent
=
None
self
.
player
=
None
self
.
init_agents_static
=
None
self
.
thread
=
None
...
...
@@ -616,7 +609,6 @@ class EditorModel(object):
self
.
env
.
rail
.
grid
[:,
:]
=
0
self
.
env
.
agents
=
[]
self
.
env
.
agents_static
=
[]
self
.
player
=
None
self
.
redraw
()
...
...
@@ -631,7 +623,6 @@ class EditorModel(object):
def
restartAgents
(
self
):
self
.
env
.
agents
=
EnvAgent
.
list_from_static
(
self
.
env
.
agents_static
)
self
.
player
=
None
self
.
redraw
()
def
setFilename
(
self
,
filename
):
...
...
@@ -689,7 +680,6 @@ class EditorModel(object):
self
.
env
.
reset
(
regen_rail
=
True
)
self
.
fix_env
()
self
.
set_env
(
self
.
env
)
self
.
player
=
None
self
.
view
.
new_env
()
self
.
redraw
()
...
...
@@ -722,7 +712,6 @@ class EditorModel(object):
# Create a new agent and select it.
agent_static
=
EnvAgentStatic
(
rcCell
,
0
,
rcCell
,
moving
=
False
)
self
.
iSelectedAgent
=
self
.
env
.
add_agent_static
(
agent_static
)
self
.
player
=
None
# will need to start a new player
self
.
view
.
oRT
.
update_background
()
else
:
# Move the selected agent to this cell
...
...
@@ -750,24 +739,6 @@ class EditorModel(object):
self
.
view
.
oRT
.
update_background
()
self
.
redraw
()
def
step
(
self
):
if
self
.
init_agents_static
is
None
:
self
.
init_agents_static
=
[
agent
.
to_list
()
for
agent
in
self
.
env
.
agents_static
]
if
self
.
player
is
None
:
self
.
player
=
Player
(
self
.
env
)
self
.
env
.
reset
(
regen_rail
=
False
,
replace_agents
=
False
)
self
.
player
.
step
()
self
.
redraw
()
def
bg_updater
(
self
,
wProg_steps
):
try
:
for
i
in
range
(
20
):
self
.
step
()
time
.
sleep
(
0.2
)
wProg_steps
.
value
=
i
+
1
# indicate progress on bar
finally
:
self
.
thread
=
None
def
fix_env
(
self
):
self
.
env
.
width
=
self
.
env
.
rail
.
width
self
.
env
.
height
=
self
.
env
.
rail
.
height
...
...
This diff is collapsed.
Click to expand it.
notebooks/Scene_Editor.ipynb
+
1
−
1
View file @
2772cd22
...
...
@@ -70,7 +70,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
0df10947fb0a4b378dc0d2fe9e9638cd
",
"model_id": "
155b149b140940acbc810a986a4c10f1
",
"version_major": 2,
"version_minor": 0
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment