Skip to content
Snippets Groups Projects
Commit e02f332b authored by Egli Adrian (IT-SCI-API-PFI)'s avatar Egli Adrian (IT-SCI-API-PFI)
Browse files

bug fix

parent f3b6bf5a
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Plot the Env and some trees
%% Cell type:code id: tags:
``` python
%load_ext autoreload
%autoreload 2
```
%% Cell type:code id: tags:
``` python
import jpy_canvas
import random
import time
import sys
```
%% Cell type:code id: tags:
``` python
# in case you need to tweak your PYTHONPATH...
sys.path.append("../flatland")
```
%% Cell type:code id: tags:
``` python
import flatland.core.env
import flatland.utils.rendertools as rt
from flatland.envs.rail_env import RailEnv, random_rail_generator
from flatland.envs.observations import TreeObsForRailEnv
```
%% Cell type:code id: tags:
``` python
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:90% !important; }</style>"))
```
%% Cell type:markdown id: tags:
# Generate
%% Cell type:code id: tags:
``` python
nAgents = 3
fnMethod = random_rail_generator(cell_type_relative_proportion=[1] * 11)
env = RailEnv(width=20,
height=10,
rail_generator=fnMethod,
number_of_agents=nAgents,
obs_builder_object=TreeObsForRailEnv(max_depth=2))
```
%% Cell type:markdown id: tags:
# Render
%% Cell type:code id: tags:
``` python
oRT = rt.RenderTool(env,gl="PILSVG")
oRT.render_env(show_observations=True,show_predictions=False)
env.dev_pred_dict = env.dev_obs_dict
oRT.render_env(show_observations=True,show_predictions=True)
img = oRT.get_image()
```
%% Cell type:code id: tags:
``` python
jpy_canvas.Canvas(img)
```
%% Cell type:code id: tags:
``` python
oRT = rt.RenderTool(env,gl="PIL")
oRT.render_env()
img = oRT.get_image()
```
%% Cell type:code id: tags:
``` python
jpy_canvas.Canvas(img)
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment