diff --git a/examples/training_example.py b/examples/training_example.py index 521cca8c786ca28c40460da95a6379a5962705b2..cfed6c92cc74c45445c436a65d15c9eb8292fe32 100644 --- a/examples/training_example.py +++ b/examples/training_example.py @@ -84,7 +84,7 @@ for trials in range(1, n_trials + 1): # Environment step which returns the observations for all agents, their corresponding # reward and whether their are done next_obs, all_rewards, done, _ = env.step(action_dict) - env_renderer.render_env(show=True, show_observations=False, show_predictions=True) + env_renderer.render_env(show=True, show_observations=True, show_predictions=True) # Update replay buffer and train agent for a in range(env.get_num_agents()): diff --git a/flatland/envs/predictions.py b/flatland/envs/predictions.py index a16adfc7153c9d7ffcd019ea6546d05363d4396b..1d825ff16554ef859339f0a60f1dbbce28dc62ef 100644 --- a/flatland/envs/predictions.py +++ b/flatland/envs/predictions.py @@ -163,7 +163,7 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder): # prediction is ready prediction[index] = [index, *new_position, new_direction, 0] visited.add((new_position[0], new_position[1], new_direction)) - # self.env.dev_pred_dict[agent.handle] = visited + self.env.dev_pred_dict[agent.handle] = visited prediction_dict[agent.handle] = prediction # cleanup: reset initial position diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py index 8d5238ba1b4cd056b5b77d50648cecc795b831a2..65fffadf5309ebbcc02cd6a2b39427f2469fec04 100644 --- a/flatland/utils/rendertools.py +++ b/flatland/utils/rendertools.py @@ -280,7 +280,9 @@ class RenderTool(object): # Check if the observation builder provides an observation if len(observation_dict) < 1: - warnings.warn("Observation Builder did not provide an observation_dict of all observed cells.") + warnings.warn( + "Predictor did not provide any predicted cells to render. \ + Observaiton builder needs to populate: env.dev_obs_dict") else: for agent in agent_handles: color = self.gl.get_agent_color(agent) @@ -299,7 +301,13 @@ class RenderTool(object): """ rt = self.__class__ if len(prediction_dict) < 1: - warnings.warn("Predictor did not provide any predicted cells to render.") + 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)