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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
elrichgro
Flatland
Commits
c7d40119
Commit
c7d40119
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.aicrowd.com:flatland/flatland
parents
80189222
01da99f3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
examples/demo.py
+2
-1
2 additions, 1 deletion
examples/demo.py
flatland/utils/render_qt.py
+1
-1
1 addition, 1 deletion
flatland/utils/render_qt.py
flatland/utils/rendertools.py
+7
-6
7 additions, 6 deletions
flatland/utils/rendertools.py
flatland/utils/svg.py
+1
-0
1 addition, 0 deletions
flatland/utils/svg.py
with
11 additions
and
8 deletions
examples/demo.py
+
2
−
1
View file @
c7d40119
...
...
@@ -164,7 +164,6 @@ class Demo:
agent_obs
[
a
]
=
np
.
concatenate
((
time_obs
[
0
][
a
],
time_obs
[
1
][
a
]))
for
step
in
range
(
max_nbr_of_steps
):
self
.
renderer
.
renderEnv
(
show
=
True
)
time
.
sleep
(.
2
)
...
...
@@ -175,6 +174,8 @@ class Demo:
action_prob
[
action
]
+=
1
action_dict
.
update
({
a
:
action
})
self
.
renderer
.
renderEnv
(
show
=
True
,
action_dict
=
action_dict
)
# Environment step
next_obs
,
all_rewards
,
done
,
_
=
self
.
env
.
step
(
action_dict
)
for
a
in
range
(
self
.
env
.
get_num_agents
()):
...
...
This diff is collapsed.
Click to expand it.
flatland/utils/render_qt.py
+
1
−
1
View file @
c7d40119
...
...
@@ -121,7 +121,7 @@ class QTSVG(GraphicsLayer):
self
.
layout
=
QGridLayout
()
self
.
layout
.
setSpacing
(
0
)
self
.
wMain
.
setLayout
(
self
.
layout
)
self
.
wWinMain
.
resize
(
10
00
,
10
00
)
self
.
wWinMain
.
resize
(
6
00
,
6
00
)
self
.
wWinMain
.
show
()
self
.
wWinMain
.
setFocus
()
...
...
This diff is collapsed.
Click to expand it.
flatland/utils/rendertools.py
+
7
−
6
View file @
c7d40119
...
...
@@ -605,7 +605,7 @@ class RenderTool(object):
)
def
renderEnv
(
self
,
show
=
False
,
curves
=
True
,
spacing
=
False
,
arrows
=
False
,
agents
=
True
,
show_observations
=
True
,
sRailColor
=
"
gray
"
,
frames
=
False
,
arrows
=
False
,
agents
=
True
,
renderobs
=
True
,
show_observations
=
True
,
sRailColor
=
"
gray
"
,
frames
=
False
,
iEpisode
=
None
,
iStep
=
None
,
iSelectedAgent
=
None
,
action_dict
=
None
):
"""
...
...
@@ -618,9 +618,10 @@ class RenderTool(object):
if
not
self
.
gl
.
is_raster
():
self
.
renderEnv2
(
show
,
curves
,
spacing
,
arrows
,
agents
,
sRailColor
,
arrows
,
agents
,
renderobs
,
sRailColor
,
frames
,
iEpisode
,
iStep
,
iSelectedAgent
,
action_dict
)
return
if
type
(
self
.
gl
)
in
(
QTGL
,
PILGL
):
...
...
@@ -764,13 +765,13 @@ class RenderTool(object):
# ** TODO ***
# why should we only update if the action is valid ?
if
Fals
e
:
if
Tru
e
:
if
action_isValid
:
self
.
gl
.
setAgentAt
(
iAgent
,
*
agent
.
position
,
agent
.
direction
,
new_direction
,
color
=
oColor
)
else
:
pass
#
print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
#
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
#
pass
print
(
"
invalid action - agent
"
,
iAgent
,
"
bend
"
,
agent
.
direction
,
new_direction
)
self
.
gl
.
setAgentAt
(
iAgent
,
*
agent
.
position
,
agent
.
direction
,
new_direction
)
else
:
self
.
gl
.
setAgentAt
(
iAgent
,
*
agent
.
position
,
agent
.
direction
,
new_direction
,
color
=
oColor
)
...
...
This diff is collapsed.
Click to expand it.
flatland/utils/svg.py
+
1
−
0
View file @
c7d40119
...
...
@@ -80,6 +80,7 @@ class Zug(object):
self
.
svg_curve2
=
SVG
(
"
svg/Zug_2_Weiche_#0091ea.svg
"
)
def
getSvg
(
self
,
iAgent
,
iDirIn
,
iDirOut
,
color
=
None
):
delta_dir
=
(
iDirOut
-
iDirIn
)
%
4
# if delta_dir != 0:
# print("Bend:", iAgent, iDirIn, iDirOut)
...
...
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