|
@@ -13,6 +13,7 @@ import scipy.integrate as spi
|
|
from collections import defaultdict
|
|
from collections import defaultdict
|
|
from typing import Dict, Any, List, Optional
|
|
from typing import Dict, Any, List, Optional
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
|
|
+import ast
|
|
|
|
|
|
from modules.lib.score import Score
|
|
from modules.lib.score import Score
|
|
from modules.lib.log_manager import LogManager
|
|
from modules.lib.log_manager import LogManager
|
|
@@ -391,7 +392,7 @@ class SafetyCalculator:
|
|
ego_decel_lat_max = self.data_processed.vehicle_config["EGO_DECEL_LAT_MAX"]
|
|
ego_decel_lat_max = self.data_processed.vehicle_config["EGO_DECEL_LAT_MAX"]
|
|
ego_decel_max = np.sqrt(ego_decel_lon_max ** 2 + ego_decel_lat_max ** 2)
|
|
ego_decel_max = np.sqrt(ego_decel_lon_max ** 2 + ego_decel_lat_max ** 2)
|
|
#TEMP_COMMENT: x_relative_start_dist 注释开始
|
|
#TEMP_COMMENT: x_relative_start_dist 注释开始
|
|
- #x_relative_start_dist = self.ego_df["x_relative_start_dist"]
|
|
|
|
|
|
+ x_relative_start_dist = self.ego_df["x_relative_dist"]
|
|
|
|
|
|
# 设置安全指标阈值
|
|
# 设置安全指标阈值
|
|
self.safety_thresholds = {
|
|
self.safety_thresholds = {
|
|
@@ -413,6 +414,8 @@ class SafetyCalculator:
|
|
df_list = []
|
|
df_list = []
|
|
EGO_PLAYER_ID = 1
|
|
EGO_PLAYER_ID = 1
|
|
|
|
|
|
|
|
+ ramp_poss = self.ego_df[self.ego_df["link_type"] == 19]["link_coords"].drop_duplicates().tolist() # 寻找匝道的位置坐标
|
|
|
|
+ lane_poss = self.ego_df[self.ego_df["lane_type"] == 2]["lane_coords"].drop_duplicates().tolist() # 寻找匝道的位置坐标
|
|
for frame_num in self.frame_list:
|
|
for frame_num in self.frame_list:
|
|
ego_data = obj_dict[frame_num][EGO_PLAYER_ID]
|
|
ego_data = obj_dict[frame_num][EGO_PLAYER_ID]
|
|
v1 = ego_data['v']
|
|
v1 = ego_data['v']
|
|
@@ -491,7 +494,7 @@ class SafetyCalculator:
|
|
TLC = self._cal_TLC(v1, h1, laneOffset)
|
|
TLC = self._cal_TLC(v1, h1, laneOffset)
|
|
TTB = self._cal_TTB(x_relative_start_dist, relative_v, ego_decel_max)
|
|
TTB = self._cal_TTB(x_relative_start_dist, relative_v, ego_decel_max)
|
|
TM = self._cal_TM(x_relative_start_dist, v2, a2, v1, a1)
|
|
TM = self._cal_TM(x_relative_start_dist, v2, a2, v1, a1)
|
|
- DTC = self._cal_DTC(vrel_projection_in_dist, arel_projection_in_dist, driver_reaction_time)
|
|
|
|
|
|
+ DTC = self._cal_DTC(vrel_projection_in_dist, arel_projection_in_dist, rho)
|
|
# MPrTTC = self._cal_MPrTTC(x_relative_start_dist)
|
|
# MPrTTC = self._cal_MPrTTC(x_relative_start_dist)
|
|
# PET = self._cal_PET(lane_posx1, lane_posy1, lane_posx2, lane_posy2, ramp_posx1, ramp_posy1, ramp_posx2, ramp_posy2, ego_posx, ego_posy, obj_posx, obj_posy, lane_width, delta_t, v1, v2, a1, a2)
|
|
# PET = self._cal_PET(lane_posx1, lane_posy1, lane_posx2, lane_posy2, ramp_posx1, ramp_posy1, ramp_posx2, ramp_posy2, ego_posx, ego_posy, obj_posx, obj_posy, lane_width, delta_t, v1, v2, a1, a2)
|
|
PET = None
|
|
PET = None
|