simulation.src.simulation_evaluation.src.referee package
Submodules
simulation.src.simulation_evaluation.src.referee.node module
Classes:
Evaluate the drive. |
- class RefereeNode[source]
Bases:
NodeBaseEvaluate the drive.
Keep track of the state machines and the broadcast speaker to calculate a score.
Methods:
start()Called when activating the node.
stop()Called when deactivating or shutting down the node.
_connect_state_machine(sm_topics)update(broadcast)Update referee output with new broadcast msg.
reset_cb(msg)Reset the referee.
- _connect_state_machine(sm_topics) Tuple[Subscriber, Publisher, StateMachineConnector][source]
simulation.src.simulation_evaluation.src.referee.referee module
Definition of the Referee class.
The referee is used to provide a score and other metrics to a simulated drive.
Classes:
|
Helper class to store states and manipulate corresponding state machine. |
|
Track what happens while driving and calculate a score. |
|
Class to evaluate a drive by keeping track of the state_machines. |
- class StateMachineConnector(state: int, set_state: Callable[[int], None])[source]
Bases:
objectHelper class to store states and manipulate corresponding state machine.
- Parameters:
state – State of the state machine.
set_state – Call to change the state of the state_machine.
Attributes:
State the state machine was in before the current state.
Change the state of the state_machine.
State of the state machine.
- previous_state: int
State the state machine was in before the current state.
- _state: int
- set_state: Callable[[int], None]
Change the state of the state_machine.
- property state
State of the state machine.
- class Observation(start_time: float = 0, current_time: float = 0, start_distance: float = 0, current_distance: float = 0, multiplicator: float = 1, mistakes: float = 0, parking_successes: int = 0)[source]
Bases:
objectTrack what happens while driving and calculate a score.
Attributes:
Time [s] when the car left the start zone.
Current time [s].
Distance [m] already driven in start zone.
Distance [m] already driven.
Multiplicator used to calculate the score.
Mistakes [point] made by the car.
Number of successful parking attempts.
Score calculated from other attributes.
Difference between start and current distance.
Difference between start and current time.
- start_time: float = 0
Time [s] when the car left the start zone.
- current_time: float = 0
Current time [s].
- start_distance: float = 0
Distance [m] already driven in start zone.
- current_distance: float = 0
Distance [m] already driven.
- multiplicator: float = 1
Multiplicator used to calculate the score.
- mistakes: float = 0
Mistakes [point] made by the car.
- parking_successes: int = 0
Number of successful parking attempts.
- property score: float
Score calculated from other attributes.
- property distance: float
Difference between start and current distance.
- property duration: float
Difference between start and current time.
- class Referee(lane: StateMachineConnector, progress: StateMachineConnector, overtaking: StateMachineConnector, parking: StateMachineConnector, priority: StateMachineConnector, speed: StateMachineConnector, initial_observation: Observation | None = None)[source]
Bases:
objectClass to evaluate a drive by keeping track of the state_machines.
- Parameters:
lane – Connector to lane state machine.
progress – Connector to progress state machine.
overtaking – Connector to overtaking state machine.
parking – Connector to parking state machine.
priority – Connector to priority state machine.
initial_observation – Referee’s observation initialization value.
reset_callback – Function to reset the referee.
Methods:
update(time, distance)Update the referee's observation.
reset([initial_observation])Reset referee observations, state and state machines.
- update(time: float, distance: float)[source]
Update the referee’s observation.
- Parameters:
time – Current time in seconds.
distance – Distance driven in meters.
- reset(initial_observation: Observation | None = None)[source]
Reset referee observations, state and state machines.
Module contents
Referee class and node definition.