From 148254bb1dc170db320bcb208ca79b0e252751d8 Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期三, 28 四月 2021 19:26:00 +0800
Subject: [PATCH] 修改科目三道路识别问题

---
 lib/src/main/cpp/test_items/park_bottom.cpp |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/lib/src/main/cpp/test_items/park_bottom.cpp b/lib/src/main/cpp/test_items/park_bottom.cpp
index 7c2124c..d1bb652 100644
--- a/lib/src/main/cpp/test_items/park_bottom.cpp
+++ b/lib/src/main/cpp/test_items/park_bottom.cpp
@@ -12,6 +12,7 @@
 #include "../master/comm_if.h"
 #include "area_exam.h"
 #include "../test_common/car_sensor.h"
+#include "../test_common/odo_graph.h"
 #include <vector>
 #include <cstdlib>
 
@@ -55,7 +56,8 @@
 static int gearAtStop;
 static int currGear;
 static char prevCrossedCtrlLine;
-
+static double odo;
+static int exitAreaCfm;
 static char CrossCtrlLine(const Polygon *map, const car_model *car, const car_model *prev_car);
 static bool EnterParking(const Polygon *map, const car_model *car);
 static bool CrashRedLine(const Polygon *map, const car_model *car, int &who);
@@ -84,6 +86,9 @@
 
     currGear = ReadCarStatus(GEAR);
     prevCrossedCtrlLine = 0;
+    stopTimepoint = 0;
+    exitAreaCfm = 0;
+    odo = ReadOdo();
 
     PlayTTS("鎮ㄥ凡杩涘叆鍊掕溅鍏ュ簱鍖哄煙", NULL);
 }
@@ -108,6 +113,19 @@
     } else if (currGear == GEAR_R) {
         gear_change = true;
         currGear = gear;
+    }
+
+    if (gear_change) {
+        // 妫�鏌ヤ笂涓�娆℃尅浣嶇殑琛岄┒璺濈锛岃繃灏忓氨鏀惧純锛岄伩寮�瀛﹀憳鍘熷湴鎸傛尅閲嶈瘯
+        double run_distance = ReadOdo() - odo;
+
+        DEBUG("2娆℃尅浣嶈繍琛岃窛绂� %f", run_distance);
+
+        if (run_distance < 1) {
+            gear_change = false;
+            DEBUG("2娆℃尅浣嶈繍琛岃窛绂昏繃灏忥紝蹇界暐");
+        }
+        odo = ReadOdo();
     }
 
     if (testStatus == TESTING && gear_change) {
@@ -159,9 +177,13 @@
     }
     
     if (testStatus == TESTING && parkCount < 2 && AllTireExitParkArea(map, car)) {
-        testStatus = TEST_FAIL;
-        AddExamFault(10103, rtkTime);
-        DEBUG("鐩存帴椹剁娴嬭瘯鍖�,涓嶆寜鑰冭瘯鍛樻寚浠ら┚椹�");
+        if (++exitAreaCfm >= 4) {       // 閬垮厤淇″彿婕傜Щ閫犳垚鐨勮鍒�
+            testStatus = TEST_FAIL;
+            AddExamFault(10103, rtkTime);
+            DEBUG("鐩存帴椹剁娴嬭瘯鍖�,涓嶆寜鑰冭瘯鍛樻寚浠ら┚椹�");
+        }
+    } else {
+        exitAreaCfm = 0;
     }
     
     if (ExitParkArea(map, car)) {
@@ -215,7 +237,7 @@
             gearAtStop = (currGear == GEAR_R ? 1 : 0);
             DEBUG("鍋滆溅浜� %d %d %d %d %d %d %d", rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss);
             DEBUG("鍋滆溅鏃舵尅浣� = %d", gearAtStop);
-        } else if (prevMoveDirect == 0) {
+        } else if (prevMoveDirect == 0 && stopTimepoint > 0) {
             DEBUG("缁х画琛岄┒ %d %d %d %d %d %d %d", rtkTime->YY, rtkTime->MM, rtkTime->DD, rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss);
 
             DEBUG("鍋滆溅鏃堕棿 %ld", tp - stopTimepoint);
@@ -456,7 +478,7 @@
     return ret;
 }
 
-// 鍙屽墠杞拰浠讳竴鍚庤疆涓嶅湪鍖哄煙
+// 鍙屽墠杞拰鍙屽悗杞笉鍦ㄥ尯鍩�
 static bool AllTireExitParkArea(const Polygon *map, const car_model *car)
 {
     int tireExitNum = 0;
@@ -477,7 +499,7 @@
         tireExitNum++;
     }
 
-    if (tireExitNum >= 3) {
+    if (tireExitNum >= 4) {
         return true;
     }
     return false;

--
Gitblit v1.8.0