| | |
| | | #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) |
| | | |
| | |
| | | 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]]; |
| | |
| | | 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]]; |
| | |
| | | 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]]; |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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]]; |
| | | } |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | |
| | | } else if (exam_dummy_light == 1) { |
| | | exam_dummy_light = ExecuteDummyLightExam(rtkTime); |
| | | // 汇报灯光考试结束 |
| | | if (exam_dummy_light == 2) { |
| | | InitRoadExam(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | |