Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Flatland
Flatland
Commits
b44c9c26
Commit
b44c9c26
authored
Jun 13, 2019
by
u214892
Browse files
fix flake8
parent
b09e71e7
Pipeline
#1076
passed with stage
in 10 minutes and 58 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
flatland/envs/env_utils.py
View file @
b44c9c26
...
...
@@ -94,6 +94,7 @@ def coordinate_to_position(width, coords):
position
.
append
((
t
[
1
]
*
width
+
t
[
0
]))
return
np
.
array
(
position
)
class
AStarNode
():
"""A node class for A* Pathfinding"""
...
...
flatland/envs/observations.py
View file @
b44c9c26
...
...
@@ -173,12 +173,10 @@ class TreeObsForRailEnv(ObservationBuilder):
in the `handles' list.
"""
if
self
.
predictor
:
self
.
predictions
=
self
.
predictor
.
get
()
pred_pos
=
np
.
concatenate
([[
x
[:,
1
:
3
]]
for
x
in
list
(
self
.
predictions
.
values
())],
axis
=
0
)
pred_pos
=
list
(
map
(
list
,
zip
(
*
pred_pos
)))
pred_dir
=
[
x
[:,
2
]
for
x
in
list
(
self
.
predictions
.
values
())]
observations
=
{}
for
h
in
handles
:
...
...
flatland/utils/graphics_layer.py
View file @
b44c9c26
...
...
@@ -82,6 +82,5 @@ class GraphicsLayer(object):
def
resize
(
self
,
env
):
pass
def
build_background_map
(
self
,
dTargets
):
def
build_background_map
(
self
,
dTargets
):
pass
flatland/utils/graphics_pil.py
View file @
b44c9c26
...
...
@@ -363,7 +363,8 @@ class PILSVG(PILGL):
# Load the target files (which have rails and transitions of their own)
# They are indexed by (binTrans, iAgent), ie a tuple of the binary transition and the agent index
dPilRail2
=
self
.
loadSVGs
(
dTargetFiles
,
rotate
=
False
,
agent_colors
=
self
.
ltAgentColors
,
backgroundImage
=
"Background_rail.svg"
,
dPilRail2
=
self
.
loadSVGs
(
dTargetFiles
,
rotate
=
False
,
agent_colors
=
self
.
ltAgentColors
,
backgroundImage
=
"Background_rail.svg"
,
whitefilter
=
"Background_white_filter.svg"
)
# Merge them with the regular rails.
# https://stackoverflow.com/questions/38987/how-to-merge-two-dictionaries-in-a-single-expression
...
...
flatland/utils/rendertools.py
View file @
b44c9c26
...
...
@@ -47,7 +47,6 @@ class RenderTool(object):
self
.
new_rail
=
True
self
.
update_background
()
def
update_background
(
self
):
# create background map
dTargets
=
{}
...
...
@@ -509,19 +508,19 @@ class RenderTool(object):
)
def
renderEnv
(
self
,
show
=
False
,
# whether to call matplotlib show() or equivalent after completion
# use false when calling from Jupyter. (and matplotlib no longer supported!)
curves
=
True
,
# draw turns as curves instead of straight diagonal lines
spacing
=
False
,
# defunct - size of spacing between rails
arrows
=
False
,
# defunct - draw arrows on rail lines
agents
=
True
,
# whether to include agents
show_observations
=
True
,
# whether to include observations
sRailColor
=
"gray"
,
# color to use in drawing rails (not used with SVG)
frames
=
False
,
# frame counter to show (intended since invocation)
iEpisode
=
None
,
# int episode number to show
iStep
=
None
,
# int step number to show in image
iSelectedAgent
=
None
,
# indicate which agent is "selected" in the editor
action_dict
=
None
):
# defunct - was used to indicate agent intention to turn
show
=
False
,
# whether to call matplotlib show() or equivalent after completion
# use false when calling from Jupyter. (and matplotlib no longer supported!)
curves
=
True
,
# draw turns as curves instead of straight diagonal lines
spacing
=
False
,
# defunct - size of spacing between rails
arrows
=
False
,
# defunct - draw arrows on rail lines
agents
=
True
,
# whether to include agents
show_observations
=
True
,
# whether to include observations
sRailColor
=
"gray"
,
# color to use in drawing rails (not used with SVG)
frames
=
False
,
# frame counter to show (intended since invocation)
iEpisode
=
None
,
# int episode number to show
iStep
=
None
,
# int step number to show in image
iSelectedAgent
=
None
,
# indicate which agent is "selected" in the editor
action_dict
=
None
):
# defunct - was used to indicate agent intention to turn
""" Draw the environment using the GraphicsLayer this RenderTool was created with.
(Use show=False from a Jupyter notebook with %matplotlib inline)
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment