build_simulations 함수는 시뮬레이션 객체들을 생성하고 구성simulations)를 생성DistributedScenarioFilter 인스턴스를 생성하여 run_metric이 활성화되어 있으면, build_metrics_engines 함수를 호출하여 metric_engines_map에 저장각 추출된 시나리오에 대해 다음 작업을 수행합니다:
플래너 생성:
pre_built_planners)가 제공되지 않았다면, build_planners 함수를 통해, 해당 시나리오에 맞는 플래너들을 생성
각 플래너에 대해 아래 단계를 수행:
Ego Controller 구성:
ego_controller를 기반으로, 현재 시나리오를 인자로 전달하여 Ego 차량의 제어 로직(예: TwoStageController)을 생성합니다.시뮬레이션 시간 관리:
simulation_time_controller를 설정(cfg)의 simulation_time_controller 항목을 통해 인스턴스화하여, 시뮬레이션 진행 시간과 반복(iteration)을 관리합니다.관측(Observation) 빌드:
build_observations 함수를 호출하여, 시나리오에 대한 관측 데이터를 구성메트릭 콜백 구성 (옵션):
metric_engines_map에서 해당 메트릭 엔진을 가져옴MetricCallback을 생성해 상태 기반 콜백(stateful callback) 목록에 추가"simulation_log_callback"이 정의되어 있으면, 이를 인스턴스화하여 상태 기반 콜백 목록에 추가시뮬레이션 환경 구성:
simulation_time_controller, observations, ego_controller 그리고 현재 시나리오를 모아 SimulationSetup 객체를 만듦Simulation 객체 생성:
Simulation 객체를 생성하는데, SimulationSetup, MultiCallback으로 묶어 전달 SimulationRunner 생성:
Simulation 객체와 현재 플래너를 묶어 SimulationRunner 객체를 만들고, 이를 simulations 리스트에 추가SimulationRunner 객체들의 리스트를 반환build_simulations 함수는 다음과 같은 역할을 수행시나리오 추출:
플래너, Ego Controller, 시간 제어, 관측 데이터 등 각 구성 요소를 생성:
메트릭 엔진 및 관련 콜백 추가 (옵션):
SimulationRunner 객체 생성 및 반환: