From 0a68be5c7b4f0cba6e6985a7ce7b2ed74a937a3b Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期五, 20 三月 2020 23:06:00 +0800
Subject: [PATCH] 路图修正。
---
lib/src/main/cpp/driver_test.cpp | 44 +++++++++++++++++++++++++++++++++++++++-----
lib/src/main/cpp/native-lib.cpp | 2 +-
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index a144e68..8601f17 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -34,6 +34,7 @@
#include "test_common/car_sensor.h"
#include "mcu/mcu_if.h"
#include "test_common/car_sensor.h"
+#include "test_items2/road_exam.h"
#define DEBUG(fmt, args...) LOGD("<driver_test> <%s>: " fmt, __func__, ##args)
@@ -295,9 +296,13 @@
if ((newMap.redLineNum = redLines.size()) > 0) {
newMap.redLine = (Polygon *) malloc(sizeof(Polygon) * newMap.redLineNum);
+ DEBUG("绾㈢嚎 %d 鏍�", newMap.redLineNum);
+
for (int i = 0; i < newMap.redLineNum; ++i) {
newMap.redLine[i].num = redLines[i].size();
newMap.redLine[i].point = (PointF *) malloc(sizeof(PointF) * newMap.redLine[i].num);
+
+ DEBUG(" 缁撶偣 %d 涓�", newMap.redLine[i].num);
for (int j = 0; j < newMap.redLine[i].num; ++j) {
newMap.redLine[i].point[j] = RoadMapPoints.point[redLines[i][j]];
@@ -310,9 +315,13 @@
if ((newMap.redAreaNum = redAreas.size()) > 0) {
newMap.redArea = (Polygon *) malloc(sizeof(Polygon) * newMap.redAreaNum);
+ DEBUG("绾㈠尯 %d 涓�", newMap.redAreaNum);
+
for (int i = 0; i < newMap.redAreaNum; ++i) {
newMap.redArea[i].num = redAreas[i].size();
newMap.redArea[i].point = (PointF *) malloc(sizeof(PointF) * newMap.redLine[i].num);
+
+ DEBUG(" 缁撶偣 %d 涓�", newMap.redArea[i].num);
for (int j = 0; j < newMap.redArea[i].num; ++j) {
newMap.redArea[i].point[j] = RoadMapPoints.point[redAreas[i][j]];
@@ -325,10 +334,12 @@
if ((newMap.greenLineNum = greenLines.size()) > 0) {
newMap.greenLine = (Polygon *) malloc(sizeof(Polygon) * newMap.greenLineNum);
+ DEBUG("缁跨嚎 %d 鏍�", newMap.greenLineNum);
for (int i = 0; i < newMap.greenLineNum; ++i) {
newMap.greenLine[i].num = greenLines[i].size();
newMap.greenLine[i].point = (PointF *) malloc(sizeof(PointF) * newMap.greenLine[i].num);
+ DEBUG(" 缁撶偣 %d 涓�", newMap.greenLine[i].num);
for (int j = 0; j < newMap.greenLine[i].num; ++j) {
newMap.greenLine[i].point[j] = RoadMapPoints.point[greenLines[i][j]];
}
@@ -340,9 +351,13 @@
if ((newMap.triggerLineNum = triggerLines.size()) > 0) {
newMap.triggerLine = (struct trigger_line_t *) malloc(sizeof(struct trigger_line_t) * newMap.triggerLineNum);
+ DEBUG("瑙﹀彂绾� %d 鏍�", newMap.triggerLineNum);
+
for (int i = 0; i < newMap.triggerLineNum; ++i) {
newMap.triggerLine[i].line.num = triggerLines[i].size() - 1;
newMap.triggerLine[i].line.point = (PointF *) malloc(sizeof(PointF) * newMap.triggerLine[i].line.num);
+
+ DEBUG(" 缁撶偣 %d 涓�", newMap.triggerLine[i].line.num);
newMap.triggerLine[i].triggerMapId = triggerLines[i][0];
for (int j = 0; j < newMap.triggerLine[i].line.num; ++j) {
@@ -357,6 +372,7 @@
newMap.area.num = area.size();
newMap.area.point = (PointF *) malloc(sizeof(PointF) * newMap.area.num);
+ DEBUG("瀛愰」鐩尯鍩熺偣 %d 涓�", newMap.area.num);
for (int i = 0; i < newMap.area.num; ++i) {
newMap.area.point[i] = RoadMapPoints.point[area[i]];
}
@@ -365,11 +381,15 @@
newMap.area.num = 0;
}
- if (stopLine.size() == 4) {
- newMap.stopLine.X1 = stopLine[0];
- newMap.stopLine.Y1 = stopLine[1];
- newMap.stopLine.X2 = stopLine[2];
- newMap.stopLine.Y2 = stopLine[3];
+ if (stopLine.size() == 2) {
+ newMap.stopLine.X1 = RoadMapPoints.point[stopLine[0]].X;
+ newMap.stopLine.Y1 = RoadMapPoints.point[stopLine[0]].Y;
+ newMap.stopLine.X2 = RoadMapPoints.point[stopLine[1]].X;
+ newMap.stopLine.Y2 = RoadMapPoints.point[stopLine[1]].Y;
+ DEBUG("寰楀埌鍋滄绾� (%f,% f) --- (%f, %f)", newMap.stopLine.X1,
+ newMap.stopLine.Y1,
+ newMap.stopLine.X2,
+ newMap.stopLine.Y2);
}
RoadMapList.push_back(newMap);
@@ -507,18 +527,22 @@
}
if (MapNum == 0 && type == TEST_TYPE_AREA) {
+ DEBUG("娌℃湁鍦鸿�冨湴鍥�");
err = true;
MA_SendExamStatus(0, -1);
}
if (CarModel == NULL) {
+ DEBUG("娌℃湁杞︽ā");
err = true;
MA_SendExamStatus(0, -2);
}
if (DummyLightContent == NULL && type == TEST_TYPE_ROAD_DUMMY_LIGHT) {
+ DEBUG("娌℃湁妯℃嫙鐏厜");
err = true;
MA_SendExamStatus(0, -3);
}
if (type != TEST_TYPE_AREA && (RoadMapPoints.num == 0 || RoadMapPoints.point == NULL || RoadMapList.size() == 0)) {
+ DEBUG("娌℃湁璺�冨湴鍥�");
err = true;
MA_SendExamStatus(0, -1);
}
@@ -718,6 +742,9 @@
} else if (exam_dummy_light == 1) {
exam_dummy_light = ExecuteDummyLightExam(rtkTime);
// 姹囨姤鐏厜鑰冭瘯缁撴潫
+ if (exam_dummy_light == 2) {
+ InitRoadExam();
+ }
}
}
}
@@ -732,6 +759,13 @@
}
}
+ if (ExamType != TEST_TYPE_AREA) {
+ if (exam_dummy_light == 2) {
+ TestRoadGeneral(RoadMapList, CarModel, CarModelList, speed, move, rtkTime);
+ }
+ return;
+ }
+
if (CurrExamMapIndex >= 0) {
int mtype = GetMapType(CurrExamMapIndex, MapList, MapNum);
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index e19a097..9cc7f3c 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -26,7 +26,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.3.52";
const int VIRTUAL_RTK_PORT = 9001;
static void SendBootIndicate(union sigval sig);
--
Gitblit v1.8.0