Skip to content
Snippets Groups Projects
Commit b78c643e authored by spiglerg's avatar spiglerg
Browse files

Merge branch 'FixTreeObsCurvedRails' into 'master'

fixed bug for treeobs in curved rails: now the tree branch will look as 'forward' even on a curve

See merge request flatland/flatland!59
parents d8cfdb9e 79289ca8
No related branches found
No related tags found
No related merge requests found
...@@ -234,8 +234,9 @@ class TreeObsForRailEnv(ObservationBuilder): ...@@ -234,8 +234,9 @@ class TreeObsForRailEnv(ObservationBuilder):
# If only one transition is possible, the tree is oriented with this transition as the forward branch. # If only one transition is possible, the tree is oriented with this transition as the forward branch.
# TODO: Test if this works as desired! # TODO: Test if this works as desired!
orientation = agent.direction orientation = agent.direction
if num_transitions == 1: if num_transitions == 1:
orientation == np.argmax(possible_transitions) orientation = np.argmax(possible_transitions)
for branch_direction in [(orientation + i) % 4 for i in range(-1, 3)]: for branch_direction in [(orientation + i) % 4 for i in range(-1, 3)]:
if possible_transitions[branch_direction]: if possible_transitions[branch_direction]:
......
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