| | |
| | | #include "../master/comm_if.h" |
| | | #include "drive_straight.h" |
| | | #include "stop_car.h" |
| | | #include "operate_gear.h" |
| | | |
| | | #include <vector> |
| | | #include <list> |
| | |
| | | static bool occurCrashRedLine; |
| | | static bool occurCrashGreenLine; |
| | | static bool occurOverSpeed; |
| | | static bool occurSecondBreak; |
| | | static int checkCrashGreenTimeout; |
| | | static char carIntersectionOfGreenLine; |
| | | static int currTurnSignalStatus; |
| | |
| | | static int startCar; |
| | | static int currExamMapIndex; |
| | | |
| | | static bool checkDoor = false; |
| | | static bool handBreakActive = false; |
| | | static bool reportRPMOver = false; |
| | | |
| | | static const int MAX_ENGINE_RPM = 2500; |
| | | static const double START_CAR_MOVE_DISTANCE = 0.5;//10.0; |
| | | static const double START_CAR_CHECK_DOOR_DISTANCE = 0.1;//1.0; |
| | | static const double START_CAR_MOVE_DISTANCE = 10.0; |
| | | static const double START_CAR_CHECK_DOOR_DISTANCE = 1.0; |
| | | static const uint32_t GEAR_N_SLIDE_TIMEOUT = D_SEC(5); |
| | | static const uint32_t GEAR_ERROR_TIMEOUT = D_SEC(15); |
| | | static const uint32_t STOP_CAR_TIME = D_SEC(2); |
| | |
| | | occurCrashRedLine = false; |
| | | occurCrashGreenLine = false; |
| | | occurOverSpeed = false; |
| | | occurSecondBreak = false; |
| | | checkCrashGreenTimeout = 0; |
| | | carIntersectionOfGreenLine = 0; |
| | | |
| | |
| | | currExamMapIndex = -1; |
| | | |
| | | startCar = START_CAR_NOT_DO; |
| | | |
| | | checkDoor = false; |
| | | handBreakActive = false; |
| | | reportRPMOver = false; |
| | | } |
| | | |
| | | void TerminateRoadExam(void) |
| | | { |
| | | TerminateDummyLightExam(); |
| | | TerminateStopCarExam(); |
| | | TerminateOperateGearExam(); |
| | | } |
| | | |
| | | static void TestRoadStartCar(const car_model *car, double speed, int moveDirect, const struct RtkTime *rtkTime) |
| | | { |
| | | double moveDistance; |
| | | static bool checkDoor = false; |
| | | static bool handBreakActive = false; |
| | | static bool reportRPMOver = false; |
| | | |
| | | if (startCar == START_CAR_NOT_DO) { |
| | | startPoint = car->basePoint; |
| | |
| | | } |
| | | } else { |
| | | occurOverSpeed = false; |
| | | } |
| | | |
| | | // 副刹车检测 |
| | | if (ReadCarStatus(SECOND_BREAK) == BREAK_ACTIVE) { |
| | | // 副刹车踩下,不合格 |
| | | if (!occurSecondBreak) { |
| | | DEBUG("副刹车动作了"); |
| | | occurSecondBreak = true; |
| | | AddExamFault(17, rtkTime); |
| | | } |
| | | } else { |
| | | occurSecondBreak = false; |
| | | } |
| | | |
| | | // 挡位匹配检测 |
| | |
| | | currTurnSignalStatus = ReadCarStatus(TURN_SIGNAL_LAMP); |
| | | break; |
| | | } |
| | | |
| | | |
| | | // 检查是否持续转向 |
| | | char turnDirect = CheckCarTurn(CarModelList); |
| | |
| | | StartDriveStraightExam(currExamMapIndex, RoadMapList); |
| | | } else if (RoadMapList[currExamMapIndex].type == STOP_CAR_MAP) { |
| | | StartStopCarExam(currExamMapIndex, RoadMapList); |
| | | } else if (RoadMapList[currExamMapIndex].type == OP_GEAER_MAP) { |
| | | StartOperateGearExam(currExamMapIndex, RoadMapList); |
| | | } |
| | | } |
| | | } else if (startCar == START_CAR_DONE) { |
| | |
| | | } else if (RoadMapList[currExamMapIndex].type == STOP_CAR_MAP) { |
| | | currExamMapIndex = ExecuteStopCarExam(currExamMapIndex, RoadMapList, car, |
| | | CarModelList, speed, moveDirect, rtkTime); |
| | | } else if (RoadMapList[currExamMapIndex].type == OP_GEAER_MAP) { |
| | | currExamMapIndex = ExecuteOperateGearExam(currExamMapIndex, RoadMapList, car, |
| | | CarModelList, speed, moveDirect, rtkTime); |
| | | } |
| | | |
| | | if (currExamMapIndex == -1) { |