| | |
| | | vector<PointF> roadOutLine; |
| | | Polygon area; |
| | | |
| | | // DEBUG("CalcRoadIndex %d 做点 %d 有点 %d", index, RoadMap.roads[index].leftEdge.size(), RoadMap.roads[index].rightEdge.size()); |
| | | |
| | | for (int i = 0; i < RoadMap.roads[index].leftEdge.size(); ++i) { |
| | | for (int j = 0; j < RoadMap.roads[index].leftEdge[i].points.size(); ++j) { |
| | | if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].leftEdge[i].points[j])) { |
| | | // DEBUG("重复点"); |
| | | continue; |
| | | } |
| | | changeSegment = false; |
| | | roadOutLine.push_back(RoadMap.roads[index].leftEdge[i].points[j]); |
| | | // DEBUG("做点加入 point (%f, %f)", RoadMap.roads[index].leftEdge[i].points[j].X, RoadMap.roads[index].leftEdge[i].points[j].Y); |
| | | } |
| | | changeSegment = true; |
| | | } |
| | | |
| | | for (int i = 0; i < RoadMap.roads[index].rightEdge.size(); ++i) { |
| | | for (int j = RoadMap.roads[index].rightEdge[i].points.size() - 1; j >= 0; --j) { |
| | | if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].leftEdge[i].points[j])) { |
| | | if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].rightEdge[i].points[j])) { |
| | | // DEBUG("重复点"); |
| | | continue; |
| | | } |
| | | changeSegment = false; |
| | | roadOutLine.push_back(RoadMap.roads[index].rightEdge[i].points[j]); |
| | | |
| | | // DEBUG("有点加入 point (%f, %f)", RoadMap.roads[index].rightEdge[i].points[j].X, RoadMap.roads[index].rightEdge[i].points[j].Y); |
| | | } |
| | | changeSegment = true; |
| | | } |
| | |
| | | for (int i = 0; i < area.num; ++i) { |
| | | area.point[i] = roadOutLine[i]; |
| | | } |
| | | |
| | | // { |
| | | // for (int x = 0; x < area.num; ++x) { |
| | | // DEBUG("road %d point %d (%f, %f)", index, x, area.point[x].X, area.point[x].Y); |
| | | // } |
| | | // } |
| | | |
| | | if (IntersectionOf(car->carXY[car->axial[AXIAL_FRONT]], &area) == GM_Containment) { |
| | | free(area.point); |
| | |
| | | |
| | | // 挡位不匹配超时 |
| | | if (currGearError && prevGearError) { |
| | | DEBUG("挡位错误增加 %ld毫秒 当前挡位 %d 时速 %f", TimeGetDiff(rtkTime, &gearErrorTimePoint), |
| | | ReadCarStatus(GEAR), ConvertMs2KMh(speed)); |
| | | // DEBUG("挡位错误增加 %ld毫秒 当前挡位 %d 时速 %f", TimeGetDiff(rtkTime, &gearErrorTimePoint), |
| | | // ReadCarStatus(GEAR), ConvertMs2KMh(speed)); |
| | | gearErrorTime += TimeGetDiff(rtkTime, &gearErrorTimePoint); |
| | | } |
| | | if (gearErrorTime > examParam.gear_speed_error_cumulative_time) { |
| | |
| | | DEBUG("导向类型切换 %d", Lane.guide); |
| | | } |
| | | } |
| | | DEBUG("currExamMapIndex = %d Lane.no = %d Lane.guide = %d (%f, %f)", currExamMapIndex, Lane.no, Lane.guide, car->carXY[car->axial[AXIAL_FRONT]].X, car->carXY[car->axial[AXIAL_FRONT]].Y); |
| | | |
| | | if (currExamMapIndex >= 0 && Lane.guide == 0) { |
| | | BigStraightRoadFree = AnalysisRoad(RoadMap, currExamMapIndex, Lane, car); |
| | |
| | | item = EntryItem(roadIndex, RoadMap, car, CarModelList, forward, moveDirect); |
| | | } |
| | | |
| | | if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 3) { |
| | | if (RoadExamStatus == RoadExamStatus && item == 6) { |
| | | PlayTTS("前方会车", NULL); |
| | | } |
| | | else if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 3) { |
| | | StartDriveStraightExam(); |
| | | RoadExamStatus = ROAD_EXAM_ITEM_STRAIGHT; |
| | | } else if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 4) { |