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:
|
Keep track of which part of the road the car is on. |
- class LaneStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineKeep track of which part of the road the car is on.
Attributes:
End state when driving into an obstacle.
End state when driving into a blocked area.
End state when driving of the road.
The car is in the right lane.
The car is in the left lane.
The car is parking on the right side.
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.
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:
|
Keep track of overtaking obstacles. |
- class OvertakingStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineKeep track of overtaking obstacles.
Attributes:
Default state.
The car is inside the the overtaking zone and on the right line.
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.
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:
|
Keep track of parking. |
- class ParkingStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineKeep track of parking.
Attributes:
Default state.
The car is inside a parking zone.
The car starts an attempt to park in.
The car drives into a parking space.
The car successfully parkes inside a parking space.
The car drives out of the parkin space.
End state when the car drives in the right lane when it's not allowed to.
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.
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:
|
Keep track of stoping and halting in front of stop or halt lines. |
- class PriorityStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineKeep track of stoping and halting in front of stop or halt lines.
Attributes:
Default state.
The car is inside a stop zone.
The car is inside a halt zone.
The car successfully stopes in the 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.
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:
|
Keep track if the car has started, is driving or has finished the drive. |
- class ProgressStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineKeep track if the car has started, is driving or has finished the drive.
Attributes:
The car stands in front of the start line.
The car has started to drive.
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.
simulation.src.simulation_evaluation.src.state_machine.state_machines.speed module
Classes:
|
- class SpeedStateMachine(callback: Callable[[], None])[source]
Bases:
StateMachineAttributes:
- 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:
|
Base class for all state machines. |
- class StateMachine(state_machine: StateMachine, initial_state: State, callback: Callable[[], None])[source]
Bases:
objectBase 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:
- callback
Function which gets executed when the state changes
- Type:
method
Methods:
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:
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
- info() str[source]
Get human-readable description of current state.
- Returns:
String of current description
- property all_states: Dict[int, State]
Property which gives all available states inherting from State in current StateMachine.
- generate_graph(messages: Type[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.