flatland.envs.step_utils.state_machine module#

class flatland.envs.step_utils.state_machine.TrainStateMachine(initial_state=TrainState.WAITING)[source]#

Bases: object

calculate_next_state(current_state)[source]#
static can_get_moving_independent(state: TrainState, in_malfunction: bool, movement_action_given: bool, new_speed: float, stop_action_given: bool)[source]#

Incoming transitions to go into state MOVING (for motions to be checked - independently of other agents’ position): - keep MOVING unless (stop action given and reaches new speed is zero) or in malfunction - from MALFUNCTION: if not in malfunction (on or off map) any more and movement action given - from STOPPED: if movement action given and not in malfunction

Parameters#

state : TrainState in_malfunction : bool movement_action_given : bool new_speed : float stop_action_given : float

Returns#

Whether agents wants to move given its state (independently of other agents’ position)

clear_next_state()[source]#
static from_dict(load_dict) TrainStateMachine[source]#
reset()[source]#
set_state(state)[source]#
set_transition_signals(state_transition_signals)[source]#
property state#
state_position_sync_check(position, i_agent, remove_agents_at_target)[source]#

Check for whether on map and off map states are matching with position being None

property state_transition_signals#
step()[source]#

Steps the state machine to the next state

to_dict()[source]#
update_if_reached(position, target)[source]#