From 42cc040a7acbefb93b973796a927f90a7126e438 Mon Sep 17 00:00:00 2001
From: Admin <Dana_Lee1016@126.com>
Date: 星期一, 22 二月 2021 13:37:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
lib/src/main/cpp/native-lib.cpp | 2 +-
lib/src/main/cpp/test_items/area_exam.cpp | 40 ++++++++++++++++++++++++++++++++++++++--
lib/src/main/cpp/rtk_module/virtual_rtk.cpp | 8 ++++++--
3 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index 49d9e4e..6284991 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -28,7 +28,7 @@
const int RTK_PLATFORM_PORT = 12125;
const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x01};
-const char *VIRTUAL_RTK_IP = "192.168.16.100";
+const char *VIRTUAL_RTK_IP = "192.168.16.212";
const int VIRTUAL_RTK_PORT = 9002;
static pthread_mutex_t tts_mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/lib/src/main/cpp/rtk_module/virtual_rtk.cpp b/lib/src/main/cpp/rtk_module/virtual_rtk.cpp
index fcdfd30..c7af63d 100644
--- a/lib/src/main/cpp/rtk_module/virtual_rtk.cpp
+++ b/lib/src/main/cpp/rtk_module/virtual_rtk.cpp
@@ -113,13 +113,15 @@
PlayTTS("妯℃嫙鍣ㄨ繛鎺�", NULL);
} else {
DEBUG("铏氭嫙骞冲彴杩炴帴澶辫触");
+ if (virtRtkIsValid) {
+ PlayTTS("妯℃嫙鍣ㄦ柇寮�", NULL);
+ }
virtRtkIsValid = false;
connectCnt++;
if (connectCnt < 3) {
AppTimer_add(ConnectLater, D_SEC(3), 1);
}
- PlayTTS("妯℃嫙鍣ㄦ柇寮�", NULL);
}
}
@@ -155,13 +157,15 @@
PlayTTS("鐏厜妯℃嫙鍣ㄨ繛鎺�", NULL);
} else {
DEBUG("鐏厜铏氭嫙骞冲彴杩炴帴澶辫触");
+ if (virtRtkIsValid2) {
+ PlayTTS("鐏厜妯℃嫙鍣ㄦ柇寮�", NULL);
+ }
virtRtkIsValid2 = false;
connectCnt2++;
if (connectCnt2 < 3) {
AppTimer_add(ConnectLater2, D_SEC(3), 2);
}
- PlayTTS("鐏厜妯℃嫙鍣ㄦ柇寮�", NULL);
}
}
diff --git a/lib/src/main/cpp/test_items/area_exam.cpp b/lib/src/main/cpp/test_items/area_exam.cpp
index 9eaded6..f4dcce9 100644
--- a/lib/src/main/cpp/test_items/area_exam.cpp
+++ b/lib/src/main/cpp/test_items/area_exam.cpp
@@ -201,6 +201,8 @@
static int EnterMap(const car_model *car, LIST_CAR_MODEL &CarModelList, LIST_AREA_MAP &mapList)
{
+ vector<int> score(mapList.size(), 0); // 鍦哄湴閲嶅悎鏃讹紝杞﹀ご灏鹃兘鍦ㄥ唴鐨勪紭鍏�
+
for (int i = 0; i < mapList.size() && car != NULL; ++i) {
// 杞﹀墠杞垨鍚庤疆杞ㄨ抗瓒婅繃瑙﹀彂绾�
if (mapList[i].type == MAP_TYPE_STOP_START) {
@@ -233,7 +235,18 @@
if (DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine1) > 0.1 &&
DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine2) > 0.1)
- return i;
+ score[i]++;
+ }
+ // 杞﹀熬椤剁偣鍦ㄥ満鍦板唴
+ if (IntersectionOf(car->carXY[ car->axial[AXIAL_REAR] ], &mapList[i].map) == GM_Containment) {
+ Line enterLine1, enterLine2;
+
+ MakeLine(&enterLine1, &(mapList[i].map.point[0]), &(mapList[i].map.point[1]));
+ MakeLine(&enterLine2, &(mapList[i].map.point[6]), &(mapList[i].map.point[7]));
+
+ if (DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine1) > 0.1 &&
+ DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine2) > 0.1)
+ score[i]++;
}
}
if (mapList[i].type == MAP_TYPE_PART_EDGE) {
@@ -244,7 +257,16 @@
MakeLine(&enterLine, &(mapList[i].map.point[0]), &(mapList[i].map.point[1]));
if (DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine) > 0.1)
- return i;
+ score[i]++;
+ }
+ // 杞﹀熬椤剁偣鍦ㄥ満鍦板唴
+ if (IntersectionOf(car->carXY[ car->axial[AXIAL_REAR] ], &mapList[i].map) == GM_Containment) {
+ Line enterLine;
+
+ MakeLine(&enterLine, &(mapList[i].map.point[0]), &(mapList[i].map.point[1]));
+
+ if (DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine) > 0.1)
+ score[i]++;
}
}
if (mapList[i].type == MAP_TYPE_TURN_90) {
@@ -257,6 +279,7 @@
return i;
}
if (mapList[i].type == MAP_TYPE_CURVE) {
+ // 杞﹀墠杞垨鍚庤疆杞ㄨ抗瓒婅繃瑙﹀彂绾�
Line triggerLine;
MakeLine(&triggerLine, &mapList[i].map2.point[0], &mapList[i].map.point[0]);
@@ -264,6 +287,19 @@
return i;
}
}
+
+ for (int i = 0; i < score.size(); ++i) {
+ if (score[i] == 2) {
+ return i;
+ }
+ }
+
+ for (int i = 0; i < score.size(); ++i) {
+ if (score[i] == 1) {
+ return i;
+ }
+ }
+
return -1;
}
--
Gitblit v1.8.0