Skip to content
Snippets Groups Projects
Commit b1600440 authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

node connection fixes

parent bc3b52ae
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,7 @@ def connect_from_nodes(rail_trans, rail_array, start, end):
if new_trans == 0:
# end-point
# need to flip direction because of how end points are defined
new_trans = rail_trans.set_transition(new_trans, current_dir, new_dir, 1)
new_trans = 0
else:
# into existing rail
new_trans = rail_trans.set_transition(new_trans, current_dir, new_dir, 1)
......@@ -187,7 +187,7 @@ def connect_to_nodes(rail_trans, rail_array, start, end):
new_trans_e = rail_array[end_pos]
if new_trans_e == 0:
# end-point
new_trans_e = rail_trans.set_transition(new_trans_e, new_dir, new_dir, 1)
new_trans_e = 0
else:
# into existing rail
new_trans_e = rail_trans.set_transition(new_trans_e, new_dir, new_dir, 1)
......
import time
import numpy as np
from flatland.envs.generators import sparse_rail_generator, realistic_rail_generator
......@@ -31,8 +33,9 @@ def test_sparse_rail_generator():
num_neighb=2, # Number of connections to other cities
seed=5, # Random seed
),
number_of_agents=10,
number_of_agents=1,
obs_builder_object=GlobalObsForRailEnv())
# reset to initialize agents_static
env_renderer = RenderTool(env, gl="PILSVG", )
env_renderer.render_env(show=True, show_observations=True, show_predictions=False)
time.sleep(2)
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