| | |
| | | TEST_TYPE_ROAD_CALIBRATE |
| | | }; |
| | | |
| | | static const int DEFAULT_START_KEY_HOLD_TIME = D_SEC(2); |
| | | static const int DEFAULT_CURVE_PAUSE_TIME = D_SEC(2); |
| | | static const int DEFAULT_PARK_BOTTOM_PAUSE_TIME = D_SEC(2); |
| | | static const int DEFAULT_PARK_BOTTOM_FINISH_TIME = D_SEC(210); |
| | | static const int DEFAULT_PART_EDGE_PAUSE_TIME = D_SEC(2); |
| | | static const int DEFAULT_PARK_EDGE_FINISH_TIME = D_SEC(90); |
| | | static const int DEFAULT_TURN_A90_PAUSE_TIME = D_SEC(2); |
| | | static const int DEFAULT_RAMP_FINISH_TIME = D_SEC(30); |
| | | static const double DEFAULT_RAMP_STOPPOINT_RED_DISTANCE = 0.5; |
| | | static const double DEFAULT_RAMP_EDGE_YELLOW_DISTANCE = 0.3; |
| | | static const double DEFAULT_RAMP_EDGE_RED_DISTANCE = 0.5; |
| | | static const double DEFAULT_RAMP_SLIDE_YELLOW_DISTANCE = 0.1; |
| | | static const double DEFAULT_RAMP_SLIDE_RED_DISTANCE = 0.3; |
| | | |
| | | static const double DEFAULT_ROAD_SLIDE_YELLOW_DISTANCE = 0.1; |
| | | static const double DEFAULT_ROAD_SLIDE_RED_DISTANCE = 0.3; |
| | | static const int DEFAULT_ROAD_MAX_DISTANCE = 3000; |
| | | static const int DEFAULT_ROAD_MAX_SPEED = 60; |
| | | static const int DEFAULT_GEAR_N_TIME = D_SEC(5); |
| | | static const int DEFAULT_SAME_GEAR_HOLD_TIME = D_SEC(5); |
| | | static const int DEFAULT_GEAR_SPEED_ERROR_MAX_TIME = D_SEC(15); |
| | | static const int DEFAULT_ROAD_PAUSE_TIME = D_SEC(2); |
| | | static const int DEFAULT_CHANGE_LANE_MIN_TIME = D_SEC(10); |
| | | static const int DEFAULT_CRASH_DOTTED_LINE_MAX_TIME = D_SEC(10); |
| | | static const int DEFAULT_TURN_SIGNAL_MIN_ADVANCE = D_SEC(3); |
| | | static const int DEFAULT_START_CAR_MAX_RMP = 2500; |
| | | static const int DEFAULT_START_CAR_DISTANCE = 10; |
| | | static const double DEFAULT_START_CAR_OPEN_DOOR_DISTANCE = 1.0; |
| | | static const char DEFAULT_START_CAR_BEGIN_TTS[] = "请起步,继续完成考试"; |
| | | static const char DEFAULT_START_CAR_END_TTS[] = "起步完成"; |
| | | static const int CHANGE_LANE_MAX_DISTANCE = 100; |
| | | static const char DEFAULT_CHANGE_LANE_BEGIN_TTS[] = "前方请变更车道"; |
| | | static const char DEFAULT_CHANGE_LANE_END_TTS[] = "变道完成"; |
| | | static const int DEFAULT_SHIFT_MAX_DISTANCE = 120; |
| | | static const int DEFAULT_SHIFT_HOLD_TIME = D_SEC(3); |
| | | static const char DEFAULT_SHIFT_BEGIN_TTS[] = "请进行加减挡位操作"; |
| | | static const char DEFAULT_SHIFT_END_TTS[] = "加减挡位完成"; |
| | | static const char DEFAULT_STRAIGHT_BEGIN_TTS[] = "请保持直线行驶"; |
| | | static const char DEFAULT_STRAIGHT_END_TTS[] = "直线行驶完成"; |
| | | static const int DEFAULT_STRAIGHT_MAX_DISTANCE = 100; |
| | | static const double DEFAULT_STRAIGHT_MAX_OFFSET = 0.3; |
| | | static const int DEFAULT_OVERTAKE_MAX_DISTANCE = 150; |
| | | static const char DEFAULT_OVERTAKE_BEGIN_TTS[] = "请超越前方车辆"; |
| | | static const char DEFAULT_OVERTAKE_END_TTS[] = "超车完成"; |
| | | static const int DEFAULT_STOP_CAR_MAX_DISTANCE = 150; |
| | | static const int DEFAULT_STOP_CAR_OPEN_DOOR_MAX_TIME = D_SEC(15); |
| | | static const double DEFAULT_STOP_CAR_EDGE_RED_DISTANCE = 0.5; |
| | | static const double DEFAULT_STOP_CAR_EDGE_YELLOW_DISTANCE = 0.5; |
| | | static const char DEFAULT_STOP_CAR_BEGIN_TTS[] = "请靠边停车"; |
| | | static const char DEFAULT_STOP_CAR_END_TTS[] = "靠边停车完成"; |
| | | static const double DEFAULT_CROSSING_STOP_VALID_DISTANCE = 3.0; |
| | | static const int DEFAULT_CROSS_SCHOOL_MAX_SPEED = 30; |
| | | static const int DEFAULT_CROSS_BREAK_VALID_DISTANCE = 30; |
| | | |
| | | static const char DEFAULT_CROSSING_GO_STRAIGHT_TTS[] = "前方路口直行"; |
| | | static const char DEFAULT_CROSSING_TURN_LEFT_TTS[] = "前方路口左转"; |
| | | static const char DEFAULT_CROSSING_TURN_RIGHT_TTS[] = "前方路口右转"; |
| | | static const char DEFAULT_CROSSING_TURN_BACK_TTS[] = "前方选择合适地点掉头"; |
| | | static const char DEFAULT_CROSSING_TURN_UNKNOWN_TTS[] = "前方路口听从教练指示"; |
| | | |
| | | static bool ExamStart = false; |
| | | static int ExamType; |
| | | static bool reportSeatbeltEject; |
| | |
| | | static bool engineStart = false; |
| | | static bool engineStartTimeout = false; |
| | | |
| | | exam_param_t examParam; |
| | | |
| | | #define MOV_AVG_SIZE 1 |
| | | #define RTK_BUFFER_SIZE 100 |
| | | #define CAR_MODEL_CACHE_SIZE 10 |
| | |
| | | static rtk_info *RtkBuffer = NULL; |
| | | static int RtkBufferNum = 0, RtkBufferIn = 0; |
| | | |
| | | static void SetExamParamDefault(void); |
| | | static void EngineStartHold(union sigval sig); |
| | | static void ExecuteExam(const struct RtkTime* rtkTime); |
| | | static void ExecuteExam(double speed, int move, double azimuth, const struct RtkTime* rtkTime); |
| | |
| | | void DriverTestInit(void) |
| | | { |
| | | ExamStart = false; |
| | | SetExamParamDefault(); |
| | | |
| | | CarModel = NULL; |
| | | CarModelList.clear(); |
| | |
| | | |
| | | RtkBuffer = (rtk_info *) malloc(RTK_BUFFER_SIZE * sizeof(rtk_info)); |
| | | RtkBufferNum = RtkBufferIn = 0; |
| | | } |
| | | |
| | | static void SetExamParamDefault(void) |
| | | { |
| | | examParam.hold_start_key_limit_time = DEFAULT_START_KEY_HOLD_TIME; |
| | | examParam.curve_pause_criteria = DEFAULT_CURVE_PAUSE_TIME; |
| | | examParam.park_bottom_pause_criteria = DEFAULT_PARK_BOTTOM_PAUSE_TIME; |
| | | examParam.park_bottom_limit_time = DEFAULT_PARK_BOTTOM_FINISH_TIME; |
| | | examParam.park_edge_pause_criteria = DEFAULT_PART_EDGE_PAUSE_TIME; |
| | | examParam.park_edge_limit_time = DEFAULT_PARK_EDGE_FINISH_TIME; |
| | | examParam.turn_a90_pause_criteria = DEFAULT_TURN_A90_PAUSE_TIME; |
| | | |
| | | examParam.ramp_stoppoint_red_distance = DEFAULT_RAMP_STOPPOINT_RED_DISTANCE; |
| | | examParam.ramp_edge_yellow_distance = DEFAULT_RAMP_EDGE_YELLOW_DISTANCE; |
| | | examParam.ramp_edge_red_distance = DEFAULT_RAMP_EDGE_RED_DISTANCE; |
| | | examParam.ramp_slide_yellow_distance = DEFAULT_RAMP_SLIDE_YELLOW_DISTANCE; |
| | | examParam.ramp_slide_red_distance = DEFAULT_RAMP_SLIDE_RED_DISTANCE; |
| | | examParam.ramp_start_car_limit_time = DEFAULT_RAMP_FINISH_TIME; |
| | | |
| | | examParam.road_slide_yellow_distance = DEFAULT_ROAD_SLIDE_YELLOW_DISTANCE; |
| | | examParam.road_slide_red_distance = DEFAULT_ROAD_SLIDE_RED_DISTANCE; |
| | | examParam.road_total_distance = DEFAULT_ROAD_MAX_DISTANCE; |
| | | examParam.road_max_speed = DEFAULT_ROAD_MAX_SPEED; |
| | | |
| | | examParam.gear_speed_table.resize(6); |
| | | for (int i = 0; i < examParam.gear_speed_table.size(); ++i) { |
| | | examParam.gear_speed_table[i].resize(2); |
| | | } |
| | | examParam.gear_speed_table[0][0] = 0; |
| | | examParam.gear_speed_table[0][1] = 20; |
| | | examParam.gear_speed_table[1][0] = 5; |
| | | examParam.gear_speed_table[1][1] = 30; |
| | | examParam.gear_speed_table[2][0] = 15; |
| | | examParam.gear_speed_table[2][1] = 40; |
| | | examParam.gear_speed_table[3][0] = 25; |
| | | examParam.gear_speed_table[3][1] = 10000; |
| | | examParam.gear_speed_table[4][0] = 35; |
| | | examParam.gear_speed_table[4][1] = 10000; |
| | | examParam.gear_speed_table[5][0] = 45; |
| | | examParam.gear_speed_table[5][1] = 10000; |
| | | |
| | | examParam.gear_n_allow_time = DEFAULT_GEAR_N_TIME; |
| | | examParam.same_gear_min_time = DEFAULT_SAME_GEAR_HOLD_TIME; // x秒内,不允许N->X->N->X置同一挡位 |
| | | examParam.gear_speed_error_cumulative_time = DEFAULT_GEAR_SPEED_ERROR_MAX_TIME; |
| | | examParam.road_pause_criteria = DEFAULT_ROAD_PAUSE_TIME; |
| | | examParam.continuous_change_lane_min_time = DEFAULT_CHANGE_LANE_MIN_TIME; |
| | | examParam.crash_dotted_line_cumulative_time = DEFAULT_CRASH_DOTTED_LINE_MAX_TIME; |
| | | examParam.turn_signal_min_advance = DEFAULT_TURN_SIGNAL_MIN_ADVANCE; |
| | | examParam.start_car_max_rpm = DEFAULT_START_CAR_MAX_RMP; |
| | | examParam.start_car_limit_distance = DEFAULT_START_CAR_DISTANCE; |
| | | examParam.open_door_drive_allow_distance = DEFAULT_START_CAR_OPEN_DOOR_DISTANCE; |
| | | examParam.start_car_begin_tts = DEFAULT_START_CAR_BEGIN_TTS; |
| | | examParam.start_car_end_tts = DEFAULT_START_CAR_END_TTS; |
| | | examParam.change_lane_limit_distance = CHANGE_LANE_MAX_DISTANCE; |
| | | examParam.change_lane_begin_tts = DEFAULT_CHANGE_LANE_BEGIN_TTS; |
| | | examParam.change_lane_end_tts = DEFAULT_CHANGE_LANE_END_TTS; |
| | | examParam.shift_limit_distance = DEFAULT_SHIFT_MAX_DISTANCE; |
| | | examParam.shift_hold_time = DEFAULT_SHIFT_HOLD_TIME; |
| | | examParam.shift_begin_tts = DEFAULT_SHIFT_BEGIN_TTS; |
| | | examParam.shift_end_tts = DEFAULT_SHIFT_END_TTS; |
| | | examParam.shift_up_tts = ""; |
| | | examParam.shift_down_tts = ""; |
| | | |
| | | examParam.straight_begin_tts = DEFAULT_STRAIGHT_BEGIN_TTS; |
| | | examParam.straight_end_tts = DEFAULT_STRAIGHT_END_TTS; |
| | | examParam.straight_limit_distance = DEFAULT_STRAIGHT_MAX_DISTANCE; |
| | | examParam.straight_max_offset = DEFAULT_STRAIGHT_MAX_OFFSET; |
| | | |
| | | examParam.overtake_limit_distance = DEFAULT_OVERTAKE_MAX_DISTANCE; |
| | | examParam.overtake_begin_tts = DEFAULT_OVERTAKE_BEGIN_TTS; |
| | | examParam.overtake_end_tts = DEFAULT_OVERTAKE_END_TTS; |
| | | |
| | | examParam.stop_car_limit_distance = DEFAULT_STOP_CAR_MAX_DISTANCE; |
| | | examParam.stop_car_open_door_allow_time = DEFAULT_STOP_CAR_OPEN_DOOR_MAX_TIME; |
| | | examParam.stop_car_edge_red_distance = DEFAULT_STOP_CAR_EDGE_RED_DISTANCE; |
| | | examParam.stop_car_edge_yellow_distance = DEFAULT_STOP_CAR_EDGE_YELLOW_DISTANCE; |
| | | examParam.stop_car_begin_tts = DEFAULT_STOP_CAR_BEGIN_TTS; |
| | | examParam.stop_car_end_tts = DEFAULT_STOP_CAR_END_TTS; |
| | | examParam.crossing_stop_valid_distance = DEFAULT_CROSSING_STOP_VALID_DISTANCE; |
| | | examParam.cross_school_max_speed = DEFAULT_CROSS_SCHOOL_MAX_SPEED; |
| | | examParam.crossing_break_valid_distance = DEFAULT_CROSS_BREAK_VALID_DISTANCE; |
| | | |
| | | examParam.crossing_go_straight_tts = DEFAULT_CROSSING_GO_STRAIGHT_TTS; |
| | | examParam.crossing_turn_left_tts = DEFAULT_CROSSING_TURN_LEFT_TTS; |
| | | examParam.crossing_turn_right_tts = DEFAULT_CROSSING_TURN_RIGHT_TTS; |
| | | examParam.crossing_turn_back_tts = DEFAULT_CROSSING_TURN_BACK_TTS; |
| | | examParam.crossing_turn_unknown_tts = DEFAULT_CROSSING_TURN_UNKNOWN_TTS; |
| | | } |
| | | |
| | | static void ReadDriverExamPrimerTimeout(union sigval sig) |
| | |
| | | AddExamFault(4, rtkTime); |
| | | } |
| | | AppTimer_delete(EngineStartHold); |
| | | AppTimer_add(EngineStartHold, D_SEC(2)); |
| | | AppTimer_add(EngineStartHold, examParam.hold_start_key_limit_time); |
| | | } |
| | | } else if (engineStart) { |
| | | engineStart = false; |