diff --git a/flatland/envs/rail_env_utils.py b/flatland/envs/rail_env_utils.py index b23347da08d5ddb12ad700ce8b38ce75e2a1eefa..13781f121bbb2cf47c0f32767598814f109b5ffb 100644 --- a/flatland/envs/rail_env_utils.py +++ b/flatland/envs/rail_env_utils.py @@ -110,9 +110,9 @@ def get_shortest_paths(distance_map: DistanceMap) -> Dict[int, List[ShortestPath position = best_next_action.next_position direction = best_next_action.next_direction - if position == a.target: - shortest_paths[a.handle].append( - ShortestPathElement(position, direction, - RailEnvNextAction(RailEnvActions.DO_NOTHING, position, direction))) - return shortest_paths + shortest_paths[a.handle].append( + ShortestPathElement(position, direction, + RailEnvNextAction(RailEnvActions.STOP_MOVING, position, direction))) + + return shortest_paths diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index 92a0f84f35fa942b03236c6add6e722475a2d842..4dad2ca872725517ffd47308f088f098b6abe1aa 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -174,7 +174,6 @@ class PILGL(GraphicsLayer): self.draws[layer].text(xyPixLeftTop, strText, font=self.font, fill=(0, 0, 0, 255)) def text_rowcol(self, rcTopLeft, strText, layer=AGENT_LAYER): - print("Text:", "rc:", rcTopLeft, "text:", strText, "layer:", layer) xyPixLeftTop = tuple((array(rcTopLeft) * self.nPixCell)[[1, 0]]) self.text(*xyPixLeftTop, strText, layer) @@ -606,7 +605,6 @@ class PILSVG(PILGL): self.draw_image_row_col(bg_svg, (row, col), layer=PILGL.SELECTED_AGENT_LAYER) if show_debug: - print("Call text:") self.text_rowcol((row + 0.2, col + 0.2,), str(agent_idx)) def set_cell_occupied(self, agent_idx, row, col): diff --git a/tests/test_flatland_envs_predictions.py b/tests/test_flatland_envs_predictions.py index d891ccaac76b6810ab55732c836ab8a4bdc7ba03..6139b0e22a1b7f89d5f169ab3ae2ac13eda69d05 100644 --- a/tests/test_flatland_envs_predictions.py +++ b/tests/test_flatland_envs_predictions.py @@ -155,7 +155,7 @@ def test_shortest_path_predictor(rendering=False): next_direction=1)), ShortestPathElement((3, 8), 1, RailEnvNextAction(action=RailEnvActions.MOVE_FORWARD, next_position=(3, 9), next_direction=1)), - ShortestPathElement((3, 9), 1, RailEnvNextAction(action=RailEnvActions.DO_NOTHING, next_position=(3, 9), + ShortestPathElement((3, 9), 1, RailEnvNextAction(action=RailEnvActions.STOP_MOVING, next_position=(3, 9), next_direction=1))] # extract the data