diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 8c8bf24f350d29cf25ead4bd81175f90bdeb122f..1a064c992803a6e0a3fad509b0632187624d8f83 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -540,8 +540,8 @@ class RailEnv(Environment): new_position, new_direction = agent.position, agent.direction # Add agent to the map if not on it yet elif agent.position is None and agent.action_saver.is_action_saved: - new_position = agent.initial_position - new_direction = agent.initial_direction + new_position = agent.initial_position + new_direction = agent.initial_direction # If movement is allowed apply saved action independent of other agents elif agent.action_saver.is_action_saved and position_update_allowed: saved_action = agent.action_saver.saved_action @@ -553,7 +553,7 @@ class RailEnv(Environment): preprocessed_action = saved_action else: new_position, new_direction = agent.position, agent.direction - + temp_transition_data[i_agent] = env_utils.AgentTransitionData(position=new_position, direction=new_direction, preprocessed_action=preprocessed_action) diff --git a/flatland/envs/step_utils/action_preprocessing.py b/flatland/envs/step_utils/action_preprocessing.py index 47f06e2ce6de7794ef3a58fd3e91a8a4d742187f..45a81a1ac5c84c681d52f7842e2b2817ff3b723b 100644 --- a/flatland/envs/step_utils/action_preprocessing.py +++ b/flatland/envs/step_utils/action_preprocessing.py @@ -17,7 +17,7 @@ def process_do_nothing(state: TrainState, saved_action: RailEnvActions): elif saved_action: action = saved_action else: - action = RailEnvActions.STOP_MOVING + action = RailEnvActions.DO_NOTHING return action @@ -40,7 +40,6 @@ def preprocess_raw_action(action, state, saved_action): """ Preprocesses actions to handle different situations of usage of action based on context - DO_NOTHING is converted to FORWARD if train is moving - - DO_NOTHING is converted to STOP_MOVING if train is moving """ action = process_illegal_action(action)