From 79289ca82b0c0b5be11dfbe26f3aa1fcf3cf01a2 Mon Sep 17 00:00:00 2001 From: Giacomo Spigler <spiglerg@gmail.com> Date: Tue, 11 Jun 2019 13:48:20 +0200 Subject: [PATCH] fixed bug for treeobs in curved rails: now the tree branch will look as 'forward' even on a curve --- flatland/envs/observations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flatland/envs/observations.py b/flatland/envs/observations.py index 2214544a..676051d8 100644 --- a/flatland/envs/observations.py +++ b/flatland/envs/observations.py @@ -234,8 +234,9 @@ class TreeObsForRailEnv(ObservationBuilder): # If only one transition is possible, the tree is oriented with this transition as the forward branch. # TODO: Test if this works as desired! orientation = agent.direction + 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)]: if possible_transitions[branch_direction]: -- GitLab