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
pranjal_dhole
Flatland
Commits
59832571
Commit
59832571
authored
4 years ago
by
hagrid67
Browse files
Options
Downloads
Patches
Plain Diff
adding jupyter_utils; adding ipycanvas to reqs_dev
parent
add024df
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/jupyter_utils.py
+48
-0
48 additions, 0 deletions
flatland/utils/jupyter_utils.py
requirements_dev.txt
+1
-0
1 addition, 0 deletions
requirements_dev.txt
with
49 additions
and
0 deletions
flatland/utils/jupyter_utils.py
0 → 100644
+
48
−
0
View file @
59832571
import
PIL
from
IPython
import
display
from
ipycanvas
import
canvas
import
time
from
flatland.envs
import
malfunction_generators
as
malgen
from
flatland.envs.agent_utils
import
EnvAgent
#from flatland.envs import sparse_rail_gen as spgen
from
flatland.envs
import
rail_generators
as
rail_gen
from
flatland.envs
import
agent_chains
as
ac
from
flatland.envs.rail_env
import
RailEnv
,
RailEnvActions
from
flatland.envs.persistence
import
RailEnvPersister
from
flatland.utils.rendertools
import
RenderTool
from
flatland.utils
import
env_edit_utils
as
eeu
class
Behaviour
():
def
__init__
(
self
,
env
):
self
.
env
=
env
def
getActions
(
self
):
return
{}
class
AlwaysForward
():
pass
class
EnvCanvas
():
def
__init__
(
self
,
env
):
self
.
env
=
env
self
.
oRT
=
RenderTool
(
env
,
show_debug
=
True
)
self
.
render
()
self
.
oCan
=
canvas
.
Canvas
(
size
=
(
600
,
300
))
self
.
oCan
.
put_image_data
(
self
.
oRT
.
get_image
())
def
render
(
self
):
self
.
oRT
.
render_env
(
show_rowcols
=
True
,
show_inactive_agents
=
True
,
show_observations
=
False
)
def
show
(
self
):
self
.
render
()
self
.
oCan
.
put_image_data
(
self
.
oRT
.
get_image
())
display
.
display
(
self
.
oCan
)
This diff is collapsed.
Click to expand it.
requirements_dev.txt
+
1
−
0
View file @
59832571
...
@@ -20,3 +20,4 @@ timeout-decorator>=0.4.1
...
@@ -20,3 +20,4 @@ timeout-decorator>=0.4.1
attrs
attrs
gym==0.14.0
gym==0.14.0
networkx
networkx
ipycanvas
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