diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 9dc05894ee0d5410af80cbb4a74b4d9017188dae..91fab9cacd46a8cf00085b4a0f8e30aa0fa4e4fd 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -568,7 +568,6 @@ class RailEnv(Environment): for agent in self.agents: i_agent = agent.handle - ## Update positions if agent.malfunction_handler.in_malfunction: movement_allowed = False diff --git a/flatland/envs/step_utils/state_machine.py b/flatland/envs/step_utils/state_machine.py index e899e4b333e3551508d03367dfead79d3a8b52e9..e1ebf17b138accb37bb2b70aeb41350e6b099559 100644 --- a/flatland/envs/step_utils/state_machine.py +++ b/flatland/envs/step_utils/state_machine.py @@ -67,12 +67,11 @@ class TrainStateMachine: self.next_state = TrainState.STOPPED def _handle_malfunction(self): - if self.st_signals.malfunction_counter_complete and \ - self.st_signals.valid_movement_action_given: - self.next_state = TrainState.MOVING - elif self.st_signals.malfunction_counter_complete and \ - (self.st_signals.stop_action_given or self.st_signals.movement_conflict): - self.next_state = TrainState.STOPPED + if self.st_signals.malfunction_counter_complete: + if self.st_signals.valid_movement_action_given: + self.next_state = TrainState.MOVING + else: + self.next_state = TrainState.STOPPED else: self.next_state = TrainState.MALFUNCTION