| | |
| | | #include "../native-lib.h" |
| | | #include "../utils/xconvert.h" |
| | | #include "../test_common/car_sensor.h" |
| | | #include "../master/comm_if.h" |
| | | |
| | | #include <vector> |
| | | #include <cstdlib> |
| | |
| | | const int PARK_TIMEOUT = D_SEC(90); |
| | | const uint32_t STOP_CAR_TIME = D_SEC(2); |
| | | |
| | | static int mapIndex = 0; |
| | | static bool reportExamTimeout; |
| | | static bool reportParkFail; |
| | | |
| | | static uint32_t stopTimepoint = 0; |
| | | static bool occurCrashRedLine1, occurCrashRedLine2; |
| | | static int prevMoveStatus, storeMoveStatusBeforeStop; |
| | |
| | | static bool ExitParkArea(const Polygon *map, const car_model *car); |
| | | static bool ExitParkArea2(const Polygon *map, const car_model *car); |
| | | |
| | | void StartParkEdge(int moveStatus, const struct RtkTime *rtkTime) |
| | | void StartParkEdge(int index, int moveStatus, const struct RtkTime *rtkTime) |
| | | { |
| | | DEBUG("进入侧方停车场地"); |
| | | |
| | | testing = true; |
| | | mapIndex = index; |
| | | |
| | | occurCrashRedLine1 = occurCrashRedLine2 = false; // 这个科目规定特殊点,发生一次扣10分,而不直接淘汰 |
| | | reportExamTimeout = false; |
| | | |
| | | reportParkFail = false; |
| | | prevMoveStatus = moveStatus; |
| | | parkSuccess = false; |
| | | parkStatus = 0; |
| | |
| | | } |
| | | |
| | | if (ExitParkArea(map, car) || ExitParkArea2(map, car)) { |
| | | if (!parkSuccess || !occurMoveBack) { |
| | | if (!parkSuccess && occurMoveBack && !reportParkFail) { |
| | | // 直接驶离测试区,认为移库不入 |
| | | AddExamFault(21, rtkTime); |
| | | reportParkFail = true; |
| | | DEBUG("直接驶离测试区,移库不入"); |
| | | } |
| | | testing = false; |
| | |
| | | } |
| | | } |
| | | |
| | | if (!parkSuccess) { |
| | | if (!parkSuccess && !reportParkFail) { |
| | | // 停止后,车身出线,不合格 |
| | | AddExamFault(21, rtkTime); |
| | | reportParkFail = true; |
| | | DEBUG("移库不入"); |
| | | } |
| | | |
| | |
| | | DEBUG("开始倒车"); |
| | | occurMoveBack = true; |
| | | moveBackTimePoint = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10); |
| | | MA_EnterMap(mapIndex, MAP_TYPE_PART_EDGE, 1); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | TEST_END: |
| | | if (!testing && occurMoveBack) { |
| | | MA_EnterMap(mapIndex, MAP_TYPE_PART_EDGE, 0); |
| | | } |
| | | return testing ? 1 : 0; |
| | | } |
| | | |