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
5037c70a
Commit
5037c70a
authored
5 years ago
by
hagrid67
Committed by
spmohanty
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
updated instructions in editor notebook.
removed logging of filename for each keypress (silly)
parent
6bf1a626
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/utils/editor.py
+1
-1
1 addition, 1 deletion
flatland/utils/editor.py
notebooks/Editor2.ipynb
+38
-19
38 additions, 19 deletions
notebooks/Editor2.ipynb
with
39 additions
and
20 deletions
flatland/utils/editor.py
+
1
−
1
View file @
5037c70a
...
@@ -599,7 +599,7 @@ class EditorModel(object):
...
@@ -599,7 +599,7 @@ class EditorModel(object):
self
.
redraw
()
self
.
redraw
()
def
setFilename
(
self
,
filename
):
def
setFilename
(
self
,
filename
):
self
.
log
(
"
filename =
"
,
filename
,
type
(
filename
))
#
self.log("filename = ", filename, type(filename))
self
.
env_filename
=
filename
self
.
env_filename
=
filename
def
load
(
self
):
def
load
(
self
):
...
...
This diff is collapsed.
Click to expand it.
notebooks/Editor2.ipynb
+
38
−
19
View file @
5037c70a
...
@@ -56,15 +56,7 @@
...
@@ -56,15 +56,7 @@
"cell_type": "code",
"cell_type": "code",
"execution_count": 4,
"execution_count": 4,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"cpu\n"
]
}
],
"source": [
"source": [
"from flatland.utils.editor import EditorMVC, EditorModel, View, Controller"
"from flatland.utils.editor import EditorMVC, EditorModel, View, Controller"
]
]
...
@@ -93,14 +85,14 @@
...
@@ -93,14 +85,14 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"## Instructions\n",
"## Instructions\n",
"- Drag to draw\n",
"- Drag to draw (improved dead-ends)\n",
" - improved dead-ends\n",
"- Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)\n",
"- Shift-Drag to erase rails\n",
" - erasing dead ends not yet automated - drag right across them\n",
"- ctrl-click to add agent\n",
"- ctrl-click to add agent\n",
" - direction chosen randomly to fit rail\n",
" - direction chosen randomly to fit rail\n",
"- ctrl-shift-click to add target for last agent\n",
"- ctrl-shift-click to add target for last agent\n",
" - target can be moved by repeating "
" - target can be moved by repeating\n",
"- to Resize the env (cannot preserve work):\n",
" - select \"Regen\" tab, set regen size slider, click regenerate."
]
]
},
},
{
{
...
@@ -113,7 +105,7 @@
...
@@ -113,7 +105,7 @@
{
{
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
6b1f996bbb834fcc962c80041465ac2d
",
"model_id": "
4bff3defb8dc40fb8c2ba74bdbd3c231
",
"version_major": 2,
"version_major": 2,
"version_minor": 0
"version_minor": 0
},
},
...
@@ -123,6 +115,13 @@
...
@@ -123,6 +115,13 @@
},
},
"metadata": {},
"metadata": {},
"output_type": "display_data"
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"len: 190 <class 'bytes'> temp.pkl /home/jeremy/projects/aicrowd/rl-trains/notebooks\n"
]
}
}
],
],
"source": [
"source": [
...
@@ -139,7 +138,7 @@
...
@@ -139,7 +138,7 @@
{
{
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
bf8e0dd6aa564b42a5ec3aa19c31a679
",
"model_id": "
961d8340f5d444c3b7a31f6684249233
",
"version_major": 2,
"version_major": 2,
"version_minor": 0
"version_minor": 0
},
},
...
@@ -155,14 +154,34 @@
...
@@ -155,14 +154,34 @@
"mvc.view.wOutput.clear_output()\n",
"mvc.view.wOutput.clear_output()\n",
"mvc.view.wOutput"
"mvc.view.wOutput"
]
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 0)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(mvc.editor.env.agents), len(mvc.editor.env.agents_static)"
]
}
}
],
],
"metadata": {
"metadata": {
"hide_input": false,
"hide_input": false,
"kernelspec": {
"kernelspec": {
"display_name": "
Python 3
",
"display_name": "
ve367
",
"language": "python",
"language": "python",
"name": "
python3
"
"name": "
ve367
"
},
},
"language_info": {
"language_info": {
"codemirror_mode": {
"codemirror_mode": {
...
@@ -174,7 +193,7 @@
...
@@ -174,7 +193,7 @@
"name": "python",
"name": "python",
"nbconvert_exporter": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"pygments_lexer": "ipython3",
"version": "3.6.
5
"
"version": "3.6.
7
"
},
},
"latex_envs": {
"latex_envs": {
"LaTeX_envs_menu_present": true,
"LaTeX_envs_menu_present": true,
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Rail Editor v0.2
# Rail Editor v0.2
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
%
load_ext
autoreload
%
load_ext
autoreload
%
autoreload
2
%
autoreload
2
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
import
numpy
as
np
import
numpy
as
np
from
numpy
import
array
from
numpy
import
array
import
ipywidgets
import
ipywidgets
import
IPython
import
IPython
from
IPython.core.display
import
display
,
HTML
from
IPython.core.display
import
display
,
HTML
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
```
```
%% Output
%% Output
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
from
flatland.utils.editor
import
EditorMVC
,
EditorModel
,
View
,
Controller
from
flatland.utils.editor
import
EditorMVC
,
EditorModel
,
View
,
Controller
```
```
%% Output
cpu
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
=
EditorMVC
(
sGL
=
"
PIL
"
)
# sGL="PIL")
mvc
=
EditorMVC
(
sGL
=
"
PIL
"
)
# sGL="PIL")
```
```
%% Output
%% Output
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Instructions
## Instructions
-
Drag to draw
-
Drag to draw (improved dead-ends)
-
improved dead-ends
-
Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
-
Shift-Drag to erase rails
-
erasing dead ends not yet automated - drag right across them
-
ctrl-click to add agent
-
ctrl-click to add agent
-
direction chosen randomly to fit rail
-
direction chosen randomly to fit rail
-
ctrl-shift-click to add target for last agent
-
ctrl-shift-click to add target for last agent
-
target can be moved by repeating
-
target can be moved by repeating
-
to Resize the env (cannot preserve work):
-
select "Regen" tab, set regen size slider, click regenerate.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
.
view
.
display
()
mvc
.
view
.
display
()
```
```
%% Output
%% Output
len: 190 <class 'bytes'> temp.pkl /home/jeremy/projects/aicrowd/rl-trains/notebooks
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
.
view
.
wOutput
.
clear_output
()
mvc
.
view
.
wOutput
.
clear_output
()
mvc
.
view
.
wOutput
mvc
.
view
.
wOutput
```
```
%% Output
%% Output
%% Cell type:code id: tags:
```
python
len
(
mvc
.
editor
.
env
.
agents
),
len
(
mvc
.
editor
.
env
.
agents_static
)
```
%% Output
(0, 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