浏览代码

仿真和实车补充未发出预警指标

XGJ_zhaoyuan 1 天之前
父节点
当前提交
bc6887979c
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      modules/metric/function.py

+ 25 - 0
modules/metric/function.py

@@ -469,6 +469,19 @@ def rightWarningSignal_LST(data, plot_path):
     else:
         return {"rightWarningSignal_LST": 1}
 
+def noWarning_LST(data):
+    scenario_name = find_nested_name(data.function_config["function"])
+    correctwarning = scenario_sign_dict[scenario_name]
+    ego_df = data.ego_data
+    if ego_df['ifwarning'].empty:
+        print("无法获取正确预警信号标志位!")
+        return
+    warning_rows = (ego_df['ifwarning'].dropna() == -1).all()
+    if warning_rows:
+        return {"noWarning_LST": 1}
+    else:
+        return {"noWarning_LST": -1}
+
 
 def ifCrossingRedLight_LST(data, plot_path):
     scenario_name = find_nested_name(data.function_config["function"])
@@ -905,6 +918,18 @@ def warningDelayTime_PGVIL(data_processed, plot_path) -> dict:
         print(f"计算预警时延时发生错误: {e}")
         return {"warningDelayTime_PGVIL": -1}
 
+def noWarning_PGVIL(data_processed):
+    scenario_name = find_nested_name(data_processed.function_config["function"])
+    correctwarning = scenario_sign_dict[scenario_name]
+    ego_df = data_processed.ego_data
+    if ego_df['ifwarning'].empty:
+        print("无法获取正确预警信号标志位!")
+        return
+    warning_rows = (ego_df['ifwarning'].dropna() == -1).all()
+    if warning_rows:
+        return {"noWarning_PGVIL": 1}
+    else:
+        return {"noWarning_PGVIL": -1}
 
 def get_car_to_stop_line_distance(ego, car_point, stop_line_points):
     """