| | |
| | | #include <vector> |
| | | #include <string> |
| | | #include <list> |
| | | #include <map> |
| | | #include <tuple> |
| | | #include <atomic> |
| | | |
| | | #include "test_common/Geometry.h" |
| | | #include "rtk_module/rtk.h" |
| | | #include "map.h" |
| | |
| | | MAP_TYPE_UPHILL, |
| | | MAP_TYPE_PARK_EDGE, |
| | | MAP_TYPE_CURVE, |
| | | MAP_TYPE_TURN_90 |
| | | MAP_TYPE_RIGHT_CORNER |
| | | } map_type_t; |
| | | |
| | | typedef struct { |
| | |
| | | |
| | | typedef struct { |
| | | map_type_t type; |
| | | int map_idx; // 对应科目地图集合中的序号 |
| | | int idx; // 对应科目地图集合中的序号 |
| | | int stage; // 对于倒车入库等项目会有多个操作阶段 |
| | | } map_t; |
| | | |
| | | typedef struct { |
| | | bool examing = false; |
| | | int curr_modeling_index = -1; |
| | | int prev_modeling_index = -1; |
| | | area_map_t *pMap; |
| | | car_model_t *pModel; |
| | | modeling_t *pModeling; |
| | | motion_t *pMotion; |
| | | map_t curr_exam_map; |
| | | map_t arriving_map; |
| | | } prime_t; |
| | | |
| | | struct ExamFault { |
| | | int sn; |
| | | char utc[32]; |
| | | int wrong_id; |
| | | }; |
| | | |
| | | #define LINE_DOTTED 0 |
| | | #define LINE_SOLID 1 |
| | | #define LINE_HALF_SOLID_LEFT 2 |
| | | #define LINE_HALF_SOLID_RIGHT 3 |
| | | #define LINE_BOUNDARY 4 |
| | | |
| | | //车道方向(按位组合),如果为0,则表无车道方向说明; |
| | | #define LANE_FORWARD 0x01 |
| | | #define LANE_LEFT 0x02 |
| | | #define LANE_RIGHT 0x04 |
| | | #define LANE_BACKWARD 0x08 |
| | | |
| | | #define ZEBRA_CROSSING 0 |
| | | #define SCHOOL_AREA 1 |
| | | #define BUS_STATION_AREA 2 |
| | | #define GRID_AREA 3 |
| | | |
| | | #define ROAD_ACTIVE_FORWARD LANE_FORWARD |
| | | #define ROAD_ACTIVE_TURN_LEFT LANE_LEFT |
| | | #define ROAD_ACTIVE_TURN_RIGHT LANE_RIGHT |
| | | #define ROAD_ACTIVE_TURN_BACKWARD LANE_BACKWARD |
| | | |
| | | typedef struct { |
| | | int character; // 属性(实线、虚线,有些可以掉头的路段) |
| | | std::vector<PointF> points; // |
| | | } edge_t; |
| | | |
| | | typedef struct { |
| | | int character; // 属性《实线、虚线、半实半虚线》 |
| | | std::vector<PointF> points; |
| | | } segment_t; |
| | | |
| | | typedef struct { |
| | | PointF start; |
| | | PointF end; |
| | | std::vector<int> direct; |
| | | } lane_direct_t; |
| | | |
| | | // 一组平行的分道线 |
| | | typedef struct { |
| | | std::vector<lane_direct_t> lane_direct; // 一组导向线的配置 |
| | | std::vector<std::vector<segment_t>> lines; // 每段域下的平行的一组线 |
| | | } separate_t; |
| | | |
| | | typedef struct { |
| | | bool stopFlag; |
| | | Line line; |
| | | bool centrePointValid; |
| | | PointF centrePoint; |
| | | } stop_line_t; |
| | | |
| | | typedef struct { |
| | | int id; |
| | | // Line stopLine; |
| | | // int active; // 到达路口尾部的行进方向 |
| | | bool activeBreak; // 路口刹车减速 |
| | | bool activeStop; // 路口停车瞭望 |
| | | bool errorLane; // 错误车道 |
| | | int targetRoad; |
| | | // int stopFlag; |
| | | // string tts; |
| | | // bool arrivedTail; |
| | | Polygon area; // 整个道路区域 |
| | | |
| | | std::vector<stop_line_t> stopLine; |
| | | std::vector<edge_t> leftEdge; |
| | | std::vector<edge_t> rightEdge; |
| | | std::vector<separate_t> separate; |
| | | } road_t; |
| | | |
| | | typedef struct { |
| | | int id; |
| | | int road; |
| | | int type; |
| | | bool activeBreak; |
| | | bool overSpeed; |
| | | std::vector<PointF> area; // 人行道等右侧2点,网格线4点 |
| | | std::vector<PointF> leftPoints; // 对应到道路左侧的点 |
| | | } special_area_t; |
| | | |
| | | typedef struct { |
| | | int road; |
| | | int active; |
| | | std::vector<PointF> points; |
| | | } trigger_line_t; |
| | | |
| | | typedef struct { |
| | | int id; |
| | | int type; |
| | | std::vector<PointF> points; |
| | | } forbid_line_t; |
| | | |
| | | typedef struct { |
| | | int road_id; |
| | | int index; |
| | | int active; |
| | | } crossing_active_t; |
| | | |
| | | typedef struct { |
| | | std::string name; |
| | | std::vector<crossing_active_t> crossingActive; |
| | | std::vector<trigger_line_t> triggerLines; |
| | | } scheme_t; |
| | | |
| | | struct road_exam_map { |
| | | int calibrate; |
| | | std::vector<road_t> roads; |
| | | std::vector<special_area_t> specialAreas; |
| | | // std::vector<trigger_line_t> triggerLines; |
| | | std::vector<forbid_line_t> forbidLines; |
| | | std::vector<scheme_t> examScheme; |
| | | }; |
| | | |
| | | struct area_exam_map { |
| | | int id; |
| | | int type; |
| | | Polygon map; |
| | | Polygon map2; |
| | | }; |
| | | std::atomic_int speed; |
| | | std::atomic_int rpm; |
| | | std::atomic_int gear; |
| | | std::atomic_int turn_signal_lamp; |
| | | std::atomic_int dipped_beam_lamp; |
| | | std::atomic_int fog_lamp; |
| | | std::atomic_int clearance_lamp; |
| | | std::atomic_int flash_beam_lamp; |
| | | std::atomic_int main_beam_lamp; |
| | | std::atomic_int seatbelt; |
| | | std::atomic_int engine_start; |
| | | std::atomic_int brake; |
| | | std::atomic_int hand_brake; |
| | | std::atomic_int second_brake; |
| | | std::atomic_int door; |
| | | std::atomic_int surround_car_1; |
| | | std::atomic_int surround_car_2; |
| | | std::atomic_int surround_car_3; |
| | | std::atomic_int surround_car_4; |
| | | } sensor_t; |
| | | |
| | | typedef struct { |
| | | int hold_start_key_limit_time; // 点火保持,毫秒 |
| | |
| | | std::string crossing_turn_unknown_tts; |
| | | } exam_param_t; |
| | | |
| | | extern exam_param_t examParam; |
| | | typedef struct { |
| | | bool examing = false; |
| | | int curr_modeling_index = -1; |
| | | int prev_modeling_index = -1; |
| | | int arriving_map = -1; |
| | | std::tuple<int, std::vector<park_button_map_t>, std::vector<uphill_map_t>, std::vector<park_edge_map_t>, std::vector<curve_map_t>, std::vector<turn_a90_map_t>> maps; |
| | | car_model_t *pModel; |
| | | modeling_t *pModeling; |
| | | motion_t *pMotion; |
| | | map_t examing_area; |
| | | sensor_t sensor; |
| | | exam_param_t examParam; |
| | | double odo; // 用RTK定位计算的行驶里程 |
| | | } prime_t; |
| | | |
| | | struct ExamFault { |
| | | int sn; |
| | | char utc[32]; |
| | | int wrong_id; |
| | | }; |
| | | |
| | | prime_t& GetPrime(void); |
| | | void DriverTestInit(void); |
| | | void ReadDriverExamPrimer(void); |
| | | |
| | | void ClearAreaMap(void); |
| | | void AddAreaMap(int id, int type, const double (*map)[2], int pointNum, const double (*map2)[2], int pointNum2); |
| | | |
| | | void AddCurveMap(curve_map_t &map); |
| | | void AddParkButtonMap(park_button_map_t &map); |
| | | void AddParkEdgeMap(park_edge_map_t &map); |
| | | |
| | | void CleanRoadMap(void); |
| | | void SetRoadMap(road_exam_map &map, std::vector<scheme_t> &scheme); |
| | | void SetRoadExamScheme(std::vector<scheme_t> &scheme); |
| | | void AddUphillMap(uphill_map_t &map); |
| | | void AddTurnA90Map(turn_a90_map_t &map); |
| | | |
| | | void SetCarMeasurePoint(double *basePoint, int *axial, int *left_front_tire, |
| | | int *right_front_tire, int *left_rear_tire, int *right_rear_tire, |
| | |
| | | |
| | | void StartDriverExam(int start, int type); |
| | | |
| | | void UpdateSensor(int id, int value); |
| | | void UpdateRTKInfo(const rtk_info_t *s); |
| | | void AddExamFault(int wrong); |
| | | void RoadChange(int road, int status); |
| | | void CrossingChange(int road, int crossing, int status); |
| | | |
| | | |
| | | void SystemShutdown(int event, int timeout); |
| | | |
| | | void SetDummyLightExam(int n, struct dummy_light_exam *cfg); |
| | | |
| | | void MasterInqRoadStatus(void); |
| | | |
| | | int CorrectPauseCriteria(int src); |
| | | |
| | | void SensorXChanged(uint16_t id, int value); |
| | | |
| | | #endif //RTKDRIVERTEST_DRIVER_TEST_H |