| | |
| | | |
| | | interface IListenerInterface { |
| | | /** |
| | | * 远程服务给SDK的回调消息,不对外提供给APP客户端 |
| | | * |
| | | * Demonstrates some basic types that you can use as parameters |
| | | * and return values in AIDL. |
| | | */ |
| | |
| | | test_items/stop_and_start.cpp |
| | | test_items/driving_curve.cpp |
| | | test_items/turn_a90.cpp |
| | | test_items/area_exam.cpp |
| | | |
| | | test_items2/common_check.cpp |
| | | test_items2/dummy_light.cpp |
| | |
| | | #include <jni.h> |
| | | #include <malloc.h> |
| | | #include <initializer_list> |
| | | #include <cctype> |
| | | |
| | | #include "jni_log.h" |
| | | |
| | |
| | | |
| | | return p4; |
| | | } |
| | | |
| | | /**************************************************************** |
| | | * p3 |
| | | * | 'L' |
| | | * | |
| | | * p1------------------>p2 |
| | | * | |
| | | * | 'R' |
| | | * p3 |
| | | * @param p1 |
| | | * @param p2 |
| | | * @param L |
| | | * @param dir |
| | | * @return |
| | | */ |
| | | PointF Calc3Point(PointF p1, PointF p2, double L, char dir) |
| | | { |
| | | PointF p3; |
| | | |
| | | dir = toupper(dir); |
| | | |
| | | if (dir != 'L' && dir != 'R') |
| | | dir = 'L'; |
| | | |
| | | if (isEqual(p1.X, p2.X)) { |
| | | p3.Y = p2.Y; |
| | | if (p2.Y > p1.Y) { |
| | | p3.X = p2.X + ((dir == 'L')? -L:L); |
| | | } else { |
| | | p3.X = p2.X + ((dir=='L')?L:-L); |
| | | } |
| | | return p3; |
| | | } |
| | | if (isEqual(p1.Y, p2.Y)) { |
| | | p3.X = p2.X; |
| | | if (p2.X > p1.X) { |
| | | p3.Y = p2.Y + ((dir == 'L')? L:-L); |
| | | } else { |
| | | p3.Y = p2.Y + ((dir == 'L')? -L:L); |
| | | } |
| | | return p3; |
| | | } |
| | | |
| | | double k = (p2.Y - p1.Y) / (p2.X - p1.X); |
| | | double b = p1.Y - k*p1.X; |
| | | |
| | | double A = 1 + pow(k, 2); |
| | | double B = 2*k*(b - p2.Y) - 2*p2.X; |
| | | double C = pow(b - p2.Y, 2) + pow(p2.X, 2) - pow(L,2); |
| | | |
| | | double x3, y3; |
| | | |
| | | |
| | | if (p1.X < p2.X) { |
| | | x3 = (- B - sqrt(pow(B, 2) - 4*A*C))/(2*A); |
| | | } else { |
| | | x3 = (- B + sqrt(pow(B, 2) - 4*A*C))/(2*A); |
| | | } |
| | | y3 = k * x3 + b; |
| | | |
| | | p3.X = x3; |
| | | p3.Y = y3; |
| | | |
| | | p3 = rotatePoint(p3, p2, (dir == 'L') ? 270 : 90); |
| | | |
| | | return p3; |
| | | } |
| | |
| | | bool OutsidePolygon(const Polygon *t1, const Polygon *t2); |
| | | int IntersectionOfLine(PointF p1, PointF p2, PointF p3); |
| | | PointF GetVerticalPoint(PointF p1, PointF p2, PointF p3); |
| | | PointF Calc3Point(PointF p1, PointF p2, double L, char dir); |
| | | |
| | | #endif //GUI_GEOMETRY_H |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/4/3. |
| | | // |
| | | |
| | | #include "area_exam.h" |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/4/3. |
| | | // |
| | | |
| | | #ifndef MYAPPLICATION2_AREA_EXAM_H |
| | | #define MYAPPLICATION2_AREA_EXAM_H |
| | | |
| | | #endif //MYAPPLICATION2_AREA_EXAM_H |
| | |
| | | |
| | | |
| | | if (CrashRedLine(map, car, who)) { |
| | | if (!occurCrashRedLine) { |
| | | if (!occurCrashRedLine && reverseCar) { |
| | | occurCrashRedLine = true; |
| | | // 车身出线,不合格 |
| | | AddExamFault(7, rtkTime); |
| | |
| | | |
| | | if (moveDirect == storeMoveDirectBeforeStop) { |
| | | // 同方向再启动,继续判断是否停车超时 |
| | | if (tp - stopTimepoint >= STOP_CAR_TIME) { |
| | | if (tp - stopTimepoint >= STOP_CAR_TIME && reverseCar) { |
| | | // 停车超2秒,每次扣5分 |
| | | AddExamFault(11, rtkTime); |
| | | DEBUG("中途停车"); |
| | |
| | | parkSuccess = false; |
| | | parkStatus = 0; |
| | | occurMoveBack = false; |
| | | |
| | | // 仅当发生倒车,才意味着项目开始 |
| | | if (moveStatus == -1) { |
| | | occurMoveBack = true; |
| | | moveBackTimePoint = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10); |
| | |
| | | int TestParkEdge(const Polygon *map, const car_model *car, const car_model *carPrev, double speed, int moveStatus, const struct RtkTime *rtkTime) |
| | | { |
| | | if (CrashRedLine1(map, car)) { |
| | | if (!occurCrashRedLine1) { |
| | | if (!occurCrashRedLine1 && occurMoveBack) { |
| | | // 车轮压边线,每次扣10分 |
| | | AddExamFault(23, rtkTime); |
| | | DEBUG("车轮压边线"); |
| | | occurCrashRedLine1 = true; |
| | | } |
| | | occurCrashRedLine1 = true; |
| | | } else { |
| | | occurCrashRedLine1 = false; |
| | | } |
| | | |
| | | if (CrashRedLine2(map, car)) { |
| | | if (!occurCrashRedLine2) { |
| | | if (!occurCrashRedLine2 && occurMoveBack) { |
| | | // 车身压库位线,每次扣10分 |
| | | AddExamFault(24, rtkTime); |
| | | DEBUG("车身压库位线"); |
| | | occurCrashRedLine2 = true; |
| | | } |
| | | occurCrashRedLine2 = true; |
| | | } else { |
| | | occurCrashRedLine2 = false; |
| | | } |
| | |
| | | |
| | | if (moveStatus == storeMoveStatusBeforeStop) { |
| | | // 同方向再启动,继续判断是否停车超时 |
| | | if (tp - stopTimepoint >= STOP_CAR_TIME) { |
| | | if (tp - stopTimepoint >= STOP_CAR_TIME && occurMoveBack) { |
| | | // 停车超2秒,每次扣5分 |
| | | AddExamFault(26, rtkTime); |
| | | DEBUG("停车超时"); |
| | |
| | | { |
| | | double dis2 = DistanceOfTire2Edge(map, car); |
| | | |
| | | MA_SendDistance(-1, dis2); |
| | | MA_SendDistance(DistanceOf(map->point[8], map->point[7]) - dis2, dis2); |
| | | } |
| | | |
| | | if (prevMoveDirect != moveDirect) { |
| | |
| | | // 全车都需不在地图中 |
| | | bool ret = false; |
| | | |
| | | Polygon carBody; |
| | | Polygon carBody, map2; |
| | | PointF vPoint = Calc3Point(map->point[8], map->point[0], DistanceOf(map->point[8], map->point[7]), 'R'); |
| | | |
| | | map2.num = 4; |
| | | map2.point = (PointF *)malloc(map2.num * sizeof(PointF)); |
| | | |
| | | MakePolygon(&map2, {vPoint, map->point[0], map->point[7], map->point[8]}); |
| | | |
| | | carBody.num = car->bodyNum; |
| | | carBody.point = (PointF *)malloc(carBody.num * sizeof(PointF)); |
| | |
| | | carBody.point[i] = car->carXY[car->body[i]]; |
| | | } |
| | | |
| | | if (IntersectionOf(&carBody, map) == GM_None) { |
| | | if (IntersectionOf(&carBody, &map2) == GM_None) { |
| | | ret = true; |
| | | } |
| | | |
| | | free(carBody.point); |
| | | |
| | | free(map2.point); |
| | | return ret; |
| | | } |
| | |
| | | |
| | | double l2 = DistanceOf(car->carXY[car->right_rear_tire[TIRE_OUTSIDE]], road_edge); |
| | | |
| | | MA_SendDistance(-1, (l1+l2)/2.0); |
| | | MA_SendDistance(6 - (l1+l2)/2.0, (l1+l2)/2.0); |
| | | } |
| | | |
| | | if (!crossStartLine) { |