| | |
| | | static LIST_AREA_MAP AreaMapList; |
| | | |
| | | static Polygon RoadMapPoints; |
| | | static road_exam_map RoadMap; |
| | | |
| | | static LIST_ROAD_MAP RoadMapList; |
| | | |
| | |
| | | RoadMapPoints.num = 0; |
| | | RoadMapPoints.point = NULL; |
| | | |
| | | RoadMapList.clear(); |
| | | // RoadMapList.clear(); |
| | | RoadMap.roads.clear(); |
| | | RoadMap.specialAreas.clear(); |
| | | RoadMap.triggerLines.clear(); |
| | | |
| | | CarSensorInit(); |
| | | |
| | |
| | | { |
| | | if (ExamStart) return; |
| | | |
| | | DEBUG("清除旧的路考地图"); |
| | | |
| | | if (RoadMapPoints.point != NULL) { |
| | | free(RoadMapPoints.point); |
| | | } |
| | | RoadMapPoints.num = 0; |
| | | |
| | | for (int i = 0; i < RoadMap.roads.size(); ++i) { |
| | | for (int j = 0; j < RoadMap.roads[i].leftEdge.size(); ++j) { |
| | | RoadMap.roads[i].leftEdge[j].points.clear(); |
| | | vector<PointF>().swap(RoadMap.roads[i].leftEdge[j].points); |
| | | } |
| | | RoadMap.roads[i].leftEdge.clear(); |
| | | vector<edge_t>().swap(RoadMap.roads[i].leftEdge); |
| | | |
| | | for (int j = 0; j < RoadMap.roads[i].rightEdge.size(); ++j) { |
| | | RoadMap.roads[i].rightEdge[j].points.clear(); |
| | | vector<PointF>().swap(RoadMap.roads[i].rightEdge[j].points); |
| | | } |
| | | RoadMap.roads[i].rightEdge.clear(); |
| | | vector<edge_t>().swap(RoadMap.roads[i].rightEdge); |
| | | |
| | | for (int j = 0; j < RoadMap.roads[i].separate.size(); ++j) { |
| | | for (int k = 0; k < RoadMap.roads[i].separate[j].lines.size(); ++k) { |
| | | for (int m = 0; m < RoadMap.roads[i].separate[j].lines[k].size(); ++m) { |
| | | RoadMap.roads[i].separate[j].lines[k][m].points.clear(); |
| | | vector<PointF>().swap(RoadMap.roads[i].separate[j].lines[k][m].points); |
| | | } |
| | | |
| | | RoadMap.roads[i].separate[j].lines[k].clear(); |
| | | vector<segment_t>().swap(RoadMap.roads[i].separate[j].lines[k]); |
| | | } |
| | | RoadMap.roads[i].separate[j].lines.clear(); |
| | | vector<vector<segment_t>>().swap(RoadMap.roads[i].separate[j].lines); |
| | | } |
| | | RoadMap.roads[i].separate.clear(); |
| | | vector<separate_t>().swap(RoadMap.roads[i].separate); |
| | | } |
| | | |
| | | RoadMap.roads.clear(); |
| | | vector<road_t>().swap(RoadMap.roads); |
| | | |
| | | for (int i = 0; i < RoadMap.specialAreas.size(); ++i) { |
| | | RoadMap.specialAreas[i].area.clear(); |
| | | vector<PointF>().swap(RoadMap.specialAreas[i].area); |
| | | } |
| | | RoadMap.specialAreas.clear(); |
| | | vector<special_area_t>().swap(RoadMap.specialAreas); |
| | | |
| | | RoadMap.triggerLines.clear(); |
| | | vector<trigger_line_t>().swap(RoadMap.triggerLines); |
| | | /* |
| | | for (int i = 0; i < RoadMapList.size(); ++i) { |
| | | struct road_exam_map map = RoadMapList[i]; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | RoadMapList.clear(); |
| | | RoadMapList.clear();*/ |
| | | } |
| | | |
| | | void SetRoadMap(road_exam_map &map) |
| | | { |
| | | if (ExamStart) return; |
| | | |
| | | RoadMap.roads.assign(map.roads.begin(), map.roads.end()); |
| | | RoadMap.specialAreas.assign(map.specialAreas.begin(), map.specialAreas.end()); |
| | | RoadMap.triggerLines.assign(map.triggerLines.begin(), map.triggerLines.end()); |
| | | |
| | | DEBUG("得到新的路考地图 路数量 %d 特殊区域数量 %d 触发线数量 %d", RoadMap.roads.size(), RoadMap.specialAreas.size(), RoadMap.triggerLines.size()); |
| | | } |
| | | |
| | | void SetRoadMapPoints(vector<double> &mapPoints) |
| | |
| | | vector<int> area, |
| | | vector<int> stopLine) |
| | | { |
| | | struct road_exam_map newMap; |
| | | /* struct road_exam_map newMap; |
| | | |
| | | newMap.id = id; |
| | | newMap.type = type; |
| | |
| | | newMap.stopLine.Y2); |
| | | } |
| | | |
| | | RoadMapList.push_back(newMap); |
| | | RoadMapList.push_back(newMap);*/ |
| | | } |
| | | |
| | | void SetCarMeasurePoint(double *basePoint, int *axial, int *left_front_tire, |
| | |
| | | // err = true; |
| | | // MA_SendExamStatus(0, -3); |
| | | } |
| | | if (type != TEST_TYPE_AREA && (RoadMapPoints.num == 0 || RoadMapPoints.point == NULL || RoadMapList.size() == 0)) { |
| | | if (type != TEST_TYPE_AREA && RoadMap.roads.size() == 0) { |
| | | DEBUG("没有路考地图"); |
| | | err = true; |
| | | MA_SendExamStatus(0, -1); |
| | |
| | | brief.pointNum = CarModel->pointNum; |
| | | brief.point = (double *) malloc(CarModel->pointNum * 2 * sizeof(double)); |
| | | for (int i = 0, j = 0; i < CarModel->pointNum; ++i) { |
| | | brief.point[j++] = CarModel->carXY[i].X; |
| | | brief.point[j++] = CarModel->carXY[i].Y; |
| | | brief.point[j++] = round(CarModel->carXY[i].X, 4); |
| | | brief.point[j++] = round(CarModel->carXY[i].Y, 4); |
| | | } |
| | | |
| | | MA_SendCarPosition(&brief); |
| | |
| | | // 汇报灯光考试结束 |
| | | if (exam_dummy_light == 2) { |
| | | DEBUG("灯光考试结束"); |
| | | InitRoadExam(); |
| | | InitRoadExam(RoadMap); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (ExamType != TEST_TYPE_AREA) { |
| | | if (exam_dummy_light == 2) { |
| | | TestRoadGeneral(RoadMapList, CarModel, CarModelList, speed, move, rtkTime); |
| | | // TestRoadGeneral(RoadMapList, CarModel, CarModelList, speed, move, rtkTime); |
| | | TestRoadGeneral(RoadMap, CarModel, CarModelList, speed, move, rtkTime); |
| | | } |
| | | } else { |
| | | TestAreaGeneral(AreaMapList, CarModel, CarModelList, speed, move, azimuth, rtkTime); |