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
yoogottamk
Flatland
Commits
3fc5f53d
Commit
3fc5f53d
authored
5 years ago
by
adrian_egli
Browse files
Options
Downloads
Plain Diff
Merge branch 'adrian' into 'master'
TopLevel (tk => root) passed See merge request
!75
parents
e843cc1f
67ec235e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/simple_example_3.py
+1
-1
1 addition, 1 deletion
examples/simple_example_3.py
flatland/utils/graphics_pil.py
+6
-1
6 additions, 1 deletion
flatland/utils/graphics_pil.py
tests/test_environments.py
+2
-1
2 additions, 1 deletion
tests/test_environments.py
with
9 additions
and
3 deletions
examples/simple_example_3.py
+
1
−
1
View file @
3fc5f53d
...
...
@@ -2,7 +2,7 @@ import random
import
numpy
as
np
from
flatland.envs.generators
import
random_rail_generator
,
complex_rail_generator
from
flatland.envs.generators
import
random_rail_generator
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.envs.rail_env
import
RailEnv
from
flatland.utils.rendertools
import
RenderTool
...
...
This diff is collapsed.
Click to expand it.
flatland/utils/graphics_pil.py
+
6
−
1
View file @
3fc5f53d
...
...
@@ -75,6 +75,7 @@ class PILGL(GraphicsLayer):
self
.
ltAgentColors
=
[
self
.
rgb_s2i
(
sColor
)
for
sColor
in
sColors
.
split
(
"
#
"
)]
self
.
nAgentColors
=
len
(
self
.
ltAgentColors
)
self
.
window_root
=
None
self
.
window_open
=
False
self
.
firstFrame
=
True
self
.
create_layers
()
...
...
@@ -131,7 +132,9 @@ class PILGL(GraphicsLayer):
assert
self
.
window_open
is
False
,
"
Window is already open!
"
# use tk.Toplevel() instead of tk.Tk()
# https://stackoverflow.com/questions/26097811/image-pyimage2-doesnt-exist
self
.
window
=
tk
.
Toplevel
()
self
.
window_root
=
tk
.
Tk
()
self
.
window_root
.
withdraw
()
self
.
window
=
tk
.
Toplevel
(
self
.
window_root
)
self
.
window
.
title
(
"
Flatland
"
)
self
.
window
.
configure
(
background
=
'
grey
'
)
self
.
window_open
=
True
...
...
@@ -140,6 +143,8 @@ class PILGL(GraphicsLayer):
self
.
panel
.
destroy
()
self
.
window
.
quit
()
self
.
window
.
destroy
()
self
.
window_root
.
destroy
()
self
.
window
=
None
def
text
(
self
,
*
args
,
**
kwargs
):
pass
...
...
This diff is collapsed.
Click to expand it.
tests/test_environments.py
+
2
−
1
View file @
3fc5f53d
...
...
@@ -107,7 +107,6 @@ def test_rail_environment_single_agent():
if
prev_pos
!=
pos
:
valid_active_actions_done
+=
1
# After 6 movements on this railway network, the train should be back
# to its original height on the map.
assert
(
initial_pos
[
0
]
==
agent
.
position
[
0
])
...
...
@@ -124,8 +123,10 @@ def test_rail_environment_single_agent():
_
,
_
,
dones
,
_
=
rail_env
.
step
({
0
:
action
})
done
=
dones
[
'
__all__
'
]
test_rail_environment_single_agent
()
def
test_dead_end
():
transitions
=
Grid4Transitions
([])
...
...
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