From 074401cd6513512c04ed1847569e9c3a9079aba0 Mon Sep 17 00:00:00 2001 From: Erik Nygren <erik.nygren@sbb.ch> Date: Tue, 30 Jul 2019 15:39:43 -0400 Subject: [PATCH] updated custom_observation_example.py to highlight how we use predictors and render custom obvsercations --- flatland/envs/observations.py | 1 + flatland/envs/predictions.py | 2 +- flatland/utils/rendertools.py | 4 ---- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/flatland/envs/observations.py b/flatland/envs/observations.py index e6646cb9..2c9a7473 100644 --- a/flatland/envs/observations.py +++ b/flatland/envs/observations.py @@ -308,6 +308,7 @@ class TreeObsForRailEnv(ObservationBuilder): We walk along the branch and collect the information documented in the get() function. If there is a branching point a new node is created and each possible branch is explored. """ + # [Recursive branch opened] if depth >= self.max_depth + 1: return [], [] diff --git a/flatland/envs/predictions.py b/flatland/envs/predictions.py index 24c57277..7483ebad 100644 --- a/flatland/envs/predictions.py +++ b/flatland/envs/predictions.py @@ -86,7 +86,7 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder): The prediction acts as if no other agent is in the environment and always takes the forward action. """ - def __init__(self, max_depth): + def __init__(self, max_depth=20): self.max_depth = max_depth def get(self, custom_args=None, handle=None): diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py index 65fffadf..8974126a 100644 --- a/flatland/utils/rendertools.py +++ b/flatland/utils/rendertools.py @@ -304,10 +304,6 @@ class RenderTool(object): warnings.warn( "Predictor did not provide any predicted cells to render. \ Predictors builder needs to populate: env.dev_pred_dict") - - - - else: for agent in agent_handles: color = self.gl.get_agent_color(agent) -- GitLab