simulation.src.simulation_evaluation.src.state_machine.state_machines package

Submodules

simulation.src.simulation_evaluation.src.state_machine.state_machines.lane module

LaneStateMachine keeps track of where the car drives.

See simulation.src.simulation_evaluation.src.state_machine.states.lane for implementation details of the states used in this StateMachine.

Classes:

LaneStateMachine(callback, None])

Keep track of which part of the road the car is on.

class LaneStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Keep track of which part of the road the car is on.

Attributes:

collision

End state when driving into an obstacle

blocked_area

End state when driving into a blocked area

off_road

End state when driving of the road

right

The car is in the right lane.

left

The car is in the left lane.

parking_right

The car is parking on the right side.

parking_left

The car is parking on the left side.

collision = <simulation.src.simulation_evaluation.src.state_machine.states.lane.FailureCollision object>

End state when driving into an obstacle

blocked_area = <simulation.src.simulation_evaluation.src.state_machine.states.lane.FailureBlockedArea object>

End state when driving into a blocked area

off_road = <simulation.src.simulation_evaluation.src.state_machine.states.lane.FailureOffRoad object>

End state when driving of the road

right = <simulation.src.simulation_evaluation.src.state_machine.states.lane.Right object>

The car is in the right lane.

left: State = <simulation.src.simulation_evaluation.src.state_machine.states.lane.Left object>

The car is in the left lane.

parking_right: State = <simulation.src.simulation_evaluation.src.state_machine.states.lane.ParkingRight object>

The car is parking on the right side.

parking_left: State = <simulation.src.simulation_evaluation.src.state_machine.states.lane.ParkingLeft object>

The car is parking on the left side.

simulation.src.simulation_evaluation.src.state_machine.state_machines.overtaking module

OvertakingStateMachine keeps track of overtaking obstacles.

See simulation.src.simulation_evaluation.src.state_machine.states.overtaking for implementation details of the states used in this StateMachine.

Classes:

OvertakingStateMachine(callback, None])

Keep track of overtaking obstacles.

class OvertakingStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Keep track of overtaking obstacles.

Attributes:

off

Default state

right

The car is inside the the overtaking zone and on the right line

left

The car is inside the the overtaking zone and on the left line

off: State = <simulation.src.simulation_evaluation.src.state_machine.states.overtaking.Off object>

Default state

right: State = <simulation.src.simulation_evaluation.src.state_machine.states.overtaking.Right object>

The car is inside the the overtaking zone and on the right line

left: State = <simulation.src.simulation_evaluation.src.state_machine.states.overtaking.Left object>

The car is inside the the overtaking zone and on the left line

simulation.src.simulation_evaluation.src.state_machine.state_machines.parking module

ParkingStateMachine keeps track of parking.

See simulation.src.simulation_evaluation.src.state_machine.states.parking for implementation details of the states used in this StateMachine.

Classes:

ParkingStateMachine(callback, None])

Keep track of parking.

class ParkingStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Keep track of parking.

Attributes:

off

Default state

in_parking_zone

The car is inside a parking zone

parking_attempt

The car starts an attempt to park in

parking

The car drives into a parking space

successfully_parked

The car successfully parkes inside a parking space

parking_out

The car drives out of the parkin space

failure_in_right

End state when the car drives in the right lane when it’s not allowed to

failure_in_left

End state when the car drives in the left lane when it’s not allowed to

off: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.Off object>

Default state

in_parking_zone: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.InParkingZone object>

The car is inside a parking zone

parking_attempt: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.ParkingAttempt object>

The car starts an attempt to park in

parking: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.Parking object>

The car drives into a parking space

successfully_parked: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.SuccessfullyParked object>

The car successfully parkes inside a parking space

parking_out: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.ParkingOut object>

The car drives out of the parkin space

failure_in_right: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.FailureInRightLane object>

End state when the car drives in the right lane when it’s not allowed to

failure_in_left: State = <simulation.src.simulation_evaluation.src.state_machine.states.parking.FailureInLeftLane object>

End state when the car drives in the left lane when it’s not allowed to

simulation.src.simulation_evaluation.src.state_machine.state_machines.priority module

PriorityStateMachine keeps track of stoping or halting in front of stop or halt lines.

See simulation.src.simulation_evaluation.src.state_machine.states.priority for implementation details of the states used in this StateMachine.

Classes:

PriorityStateMachine(callback, None])

Keep track of stoping and halting in front of stop or halt lines.

class PriorityStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Keep track of stoping and halting in front of stop or halt lines.

Attributes:

off

Default state

in_stop_zone

The car is inside a stop zone

in_halt_zone

The car is inside a halt zone

successfully_stopped

The car successfully stopes in the stop zone

failure_in_stop_zone

End state when the car does not stop inside the stop zone

off: State = <simulation.src.simulation_evaluation.src.state_machine.states.priority.Off object>

Default state

in_stop_zone: State = <simulation.src.simulation_evaluation.src.state_machine.states.priority.InStopZone object>

The car is inside a stop zone

in_halt_zone: State = <simulation.src.simulation_evaluation.src.state_machine.states.priority.InHaltZone object>

The car is inside a halt zone

successfully_stopped: State = <simulation.src.simulation_evaluation.src.state_machine.states.priority.SuccessfullyStopped object>

The car successfully stopes in the stop zone

failure_in_stop_zone: State = <simulation.src.simulation_evaluation.src.state_machine.states.priority.FailureInStopZone object>

End state when the car does not stop inside the stop zone

simulation.src.simulation_evaluation.src.state_machine.state_machines.progress module

ProgressStateMachine keeps track if the car has started, is driving or has finished the drive.

See simulation.src.simulation_evaluation.src.state_machine.states.progress for implementation details of the states used in this StateMachine.

Classes:

ProgressStateMachine(callback, None])

Keep track if the car has started, is driving or has finished the drive.

class ProgressStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Keep track if the car has started, is driving or has finished the drive.

Attributes:

before_start

The car stands in front of the start line

running

The car has started to drive

finished

The car finished the drive

before_start: State = <simulation.src.simulation_evaluation.src.state_machine.states.progress.BeforeStart object>

The car stands in front of the start line

running: State = <simulation.src.simulation_evaluation.src.state_machine.states.progress.Running object>

The car has started to drive

finished: State = <simulation.src.simulation_evaluation.src.state_machine.states.progress.Finished object>

The car finished the drive

simulation.src.simulation_evaluation.src.state_machine.state_machines.speed module

Classes:

SpeedStateMachine(callback, None])

class SpeedStateMachine(callback: Callable[], None])[source]

Bases: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine

Attributes:

speed_no_limit

failure_ignored_speed_limit

speed_10_limit

speed_20_limit

speed_30_limit

speed_40_limit

speed_50_limit

speed_60_limit

speed_70_limit

speed_80_limit

speed_90_limit

speed_no_limit: State = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedNoLimit object>
failure_ignored_speed_limit: State = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimitIgnored object>
speed_10_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_20_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_30_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_40_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_50_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_60_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_70_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_80_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>
speed_90_limit = <simulation.src.simulation_evaluation.src.state_machine.states.speed.SpeedLimit object>

simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine module

Base class StateMachine.

Classes:

StateMachine(state_machine, initial_state, …)

Base class for all state machines.

class StateMachine(state_machine: simulation.src.simulation_evaluation.src.state_machine.state_machines.state_machine.StateMachine, initial_state: simulation.src.simulation_evaluation.src.state_machine.states.state.State, callback: Callable[], None])[source]

Bases: object

Base class for all state machines.

This class handels state changes for a StateMachine. It also adds the methods’s info, value and msg which return properties of the current state. Additionally, it defines a property which returns all states and a method which creates a graph with all states.

state_machine

State machine used for all operations

Type

StateMachine

state

Current state

Type

State

callback

Function which gets executed when the state changes

Type

method

Methods:

callback_on_state_change()

Decorator which executes self.callback when the state of state machine has changed.

run(*args, **kwargs)

info()

Get human-readable description of current state.

value()

Get value of current state.

msg()

Get message of current state.

set(*args, **kwargs)

generate_graph(messages[, directory, …])

Generate Graph for current StateMachine.

Attributes:

all_states

Property which gives all available states inherting from State in current StateMachine.

callback_on_state_change()[source]

Decorator which executes self.callback when the state of state machine has changed.

Parameters

func – Function to wrap

Returns

Result of func

run(*args, **kwargs)[source]
info()str[source]

Get human-readable description of current state.

Returns

String of current description

value()int[source]

Get value of current state.

Returns

Integer of current value

msg()simulation_evaluation.msg._State.State[source]

Get message of current state.

Returns

StateMsg of current state

property all_states: Dict[int, simulation.src.simulation_evaluation.src.state_machine.states.state.State]

Property which gives all available states inherting from State in current StateMachine.

set(*args, **kwargs)[source]
generate_graph(messages: Type[simulation_evaluation.msg._State.State], directory: str = '', filename: str = 'graph', accent_color: str = 'grey', shape: str = 'oval', shape_failure: str = 'rect', view: bool = False, save_to_file: bool = True)str[source]

Generate Graph for current StateMachine.

Parameters
  • messages – Object of all messages

  • directory – Directory where the output file should be saved

  • filename – Name of output file

  • accent_color – Accent color of graph

  • shape – Default node shape

  • shape_failure – Failure node shape

  • view – If the graph should be shown to the user

  • save_to_file – If the graph should be saved to a svg file

Returns

A string of the generated source code of the graph

Note

You can find documentation on graphviz on their homepage and on readthedocs.

Module contents