Skip to content
Snippets Groups Projects
Commit 074401cd authored by Erik Nygren's avatar Erik Nygren
Browse files

updated custom_observation_example.py to highlight how we use predictors

and render custom obvsercations
parent 84402e1c
No related branches found
No related tags found
No related merge requests found
...@@ -308,6 +308,7 @@ class TreeObsForRailEnv(ObservationBuilder): ...@@ -308,6 +308,7 @@ class TreeObsForRailEnv(ObservationBuilder):
We walk along the branch and collect the information documented in the get() function. 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. If there is a branching point a new node is created and each possible branch is explored.
""" """
# [Recursive branch opened] # [Recursive branch opened]
if depth >= self.max_depth + 1: if depth >= self.max_depth + 1:
return [], [] return [], []
......
...@@ -86,7 +86,7 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder): ...@@ -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. 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 self.max_depth = max_depth
def get(self, custom_args=None, handle=None): def get(self, custom_args=None, handle=None):
......
...@@ -304,10 +304,6 @@ class RenderTool(object): ...@@ -304,10 +304,6 @@ class RenderTool(object):
warnings.warn( warnings.warn(
"Predictor did not provide any predicted cells to render. \ "Predictor did not provide any predicted cells to render. \
Predictors builder needs to populate: env.dev_pred_dict") Predictors builder needs to populate: env.dev_pred_dict")
else: else:
for agent in agent_handles: for agent in agent_handles:
color = self.gl.get_agent_color(agent) color = self.gl.get_agent_color(agent)
......
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