framework.baseline

framework.baseline.BaseScenarioRunner

class framework.baseline.BaseScenarioRunner.BaseScenarioRunner(container: apollo.ApolloContainer.ApolloContainer)

Scenario runner for the baseline technique, i.e., 1 ADS instance with simulated constant speed obstacle

Parameters

container (ApolloContainer) – the Apollo container

init_scenario()

Initialize the scenario

run_scenario(generation_name: str, scenario_name: str, save_record=False) List[Tuple[int, framework.scenario.ad_agents.ADAgent]]

Main function to execute the scenario

Parameters
  • generation_name (str) – generation name

  • scenario_name (str) – scenario name

  • save_record (bool) – if the record files should be saved

Returns

obstacles participated in the scenario, in the form (ID, ADAgent)

Return type

List[Tuple[int, ADAgent]]

set_scenario(s: framework.scenario.Scenario)

Set the scenario for the runner

Parameters

s (Scenario) – scenario to be executed

framework.baseline.DynamicObstacleManager

class framework.baseline.DynamicObstacleManager.DynamicObstacleManager(obs: List[framework.scenario.ad_agents.ADAgent], nids: List[int])

A simplified modeling of constant speed obstacles

Parameters

obs (List[ADAgent]) – list of obstacles to be managed

Nids List[int]

list of ids

calculate_position(ad: framework.scenario.ad_agents.ADAgent, speed: float, time_spent_driving: float) Tuple[modules.common.proto.geometry_pb2.PointENU, float]

Calculate the position of the obstacle based on its speed and time spent driving

Parameters
  • ad (ADAgent) – the obstacle representation

  • speed (float) – the speed of the obstacle

  • time_spent_driving (float) – the amount of time the obstacle has been traveling

Returns

the position and heading of the obstacle

Return type

Tuple[PointENU, float]

get_obstacles(curr_time: float) List[modules.perception.proto.perception_obstacle_pb2.PerceptionObstacle]

Get a list of PerceptionObstacle messages ready to be published

Parameters

curr_time (float) – scenario time

Returns

list of PerceptionObstacle messages

Return type

List[PerceptionObstacle]

framework.baseline.liability_checker.CollisionLiabilityChecker

class framework.baseline.liability_checker.CollisionLiabilityChecker.CollisionLiabilityChecker(record_path: str)

Checker to see if a scenario includes rear-end collision

Parameters

record_path (str) – filename of the record file

get_results() dict

Get the result of this analysis

Returns

the analysis result

Return type

dict

is_adc_completely_stopped() bool

Check if the ADC is completely stopped

Returns

True if stopped, False otherwise

Return type

bool

on_new_message_callback(topic: str, message, t: float)

Process a new record trace

Parameters
  • topic (str) – channel of the trace

  • message (any) – the actual message from the trace

  • t (float) – the timestamp of the trace

start()

Start to analyze the record file

class framework.baseline.liability_checker.CollisionLiabilityChecker.CollisionType(value)

Type of collision

DEFAULT = 0

Non-rear-end collision

REAR_END = 1

Rear-end collision