yy1717
2020-05-11 a073dc3c983b4c56c5da92642c9ad11995bdb844
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
//
// Created by YY on 2019/10/21.
//
 
#ifndef RTKDRIVERTEST_DRIVER_TEST_H
#define RTKDRIVERTEST_DRIVER_TEST_H
 
#include "test_common/Geometry.h"
#include "rtk_module/rtk.h"
#include "test_items2/dummy_light.h"
 
#include <vector>
#include <string>
#include <list>
 
#define EXAM_AREA_NONE          0
#define EXAM_AREA_START         1
#define EXAM_AREA_RUN           2
#define EXAM_AREA_END           3
 
#define TIRE_OUTSIDE    0
#define TIRE_INSIDE     1
#define AXIAL_FRONT     0
#define AXIAL_REAR      1
 
#define MAP_TYPE_PARK_BUTTOM        1
#define MAP_TYPE_STOP_START         2
#define MAP_TYPE_PART_EDGE          3
#define MAP_TYPE_CURVE              4
#define MAP_TYPE_TURN_90            5
 
using namespace std;
 
struct car_desc_ {
    double distance;            // 距离主天线的距离
    double angle;               // 从中轴线逆时针形成的角度
};
 
struct RtkTime {
    int YY;
    int MM;
    int DD;
    int hh;
    int mm;
    int ss;
    int mss;
};
 
typedef struct {
    struct RtkTime tm;
    PointF basePoint;               // 现场测量的主天线坐标
    int axial[2];
    int left_front_tire[2];
    int right_front_tire[2];
    int left_rear_tire[2];
    int right_rear_tire[2];
    int bodyNum;
    int *body;
    int pointNum;
    double antPitch;                // 前后天线因安装位置之固有pitch角
    double antHeight;               // 车顶天线高程
    double groundHeight;            // 大地高程
    double yaw;
    double pitch;
    struct car_desc_ *carDesc;      // 经现场测量点计算后的值
    PointF *carXY;                  // 计算后的车身各点坐标
} car_model;
 
// 总数
// 中轴线前点,id 0,中轴线后点id
// 左包围, 右包围
// 左前轮,外内
typedef struct {
    int body_num;
    int body[64];
    int front_left_tire[2];
    int front_right_tire[2];
    int rear_left_tire[2];
    int rear_right_tire[2];
} carModelDesc_t;
 
typedef struct {
    uint32_t uptime;
    int point_num;
    PointF *points;
    carModelDesc_t *desc;
} car_model_cache_t;
 
struct ExamFault {
    int sn;
    char utc[32];
    int wrong_id;
};
 
 
struct trigger_line_tx {
    int triggerMapId;
    Polygon line;
};
 
 
struct road_exam_mapx {
    int id;
    int type;
 
    string tts;
 
    int redLineNum;
    Polygon *redLine;
 
    int greenLineNum;
    Polygon *greenLine;
 
    int redAreaNum;
    Polygon *redArea;
 
    int triggerLineNum;
    trigger_line_tx *triggerLine;
 
    int roadEdgeLineNum;    // 道路边线,只有直线驾驶、靠边停车才有
    Polygon *roadEdgeLine;
 
    Polygon area;           // 子项目的区域
    Line stopLine;         // 诸如人行道、路口等考点的停止线
    int flagStop;           // 到达开始线前,是否需要停车
};
 
typedef vector<struct road_exam_mapx> LIST_ROAD_MAP;
 
#define LINE_DOTTED            0
#define LINE_SOLID             1
#define LINE_HALF_SOLID_LEFT        2
#define LINE_HALF_SOLID_RIGHT       3
 
//车道方向(按位组合),如果为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
 
typedef struct {
    int character;                  // 属性(实线、虚线,有些可以掉头的路段)
    std::vector<PointF> points;     //
} edge_t;
 
typedef struct {
    int character;          // 属性《实线、虚线、半实半虚线》
    int left_lane_direct;
    int right_lane_direct;
    std::vector<PointF> points;
} segment_t;
 
// 一组平行的分道线
typedef struct {
    std::vector<std::vector<segment_t>> lines;      // 每段域下的平行的一组线
} separate_t;
 
typedef struct {
    int id;
    Line startLine;
    Line stopLine;
    int active;         // 到达路口尾部的行进方向
    int targetRoad;
    int stopFlag;
    string tts;
    Polygon area;       // 整个道路区域
    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;
    std::vector<PointF> area;       // 人行道等右侧2点,网格线4点
    std::vector<PointF> leftPoints; // 对应到道路左侧的点
} special_area_t;
 
typedef struct {
    int id;
    int road;
    int active;
    string tts;
    Line line;
} trigger_line_t;
 
struct road_exam_map {
    std::vector<road_t> roads;
    std::vector<special_area_t> specialAreas;
    std::vector<trigger_line_t> triggerLines;
};
 
struct area_exam_map {
    int id;
    int type;
    Polygon map;
    Polygon map2;
};
 
typedef vector<struct area_exam_map> LIST_AREA_MAP;
 
typedef list<car_model *> LIST_CAR_MODEL;
 
//vector<ExamFault> ExamFaultList;
 
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 CleanRoadMap(void);
void SetRoadMap(road_exam_map &map);
 
void SetRoadMapPoints(vector<double> &mapPoints);
void AddRoadMapParent(int id, int type, string tts, int stopFlag, vector<vector<int>> &redLines,
                      vector<vector<int>> &redAreas, vector<vector<int>> &greenLines,
                      vector<vector<int>> &triggerLines, vector<vector<int>> &roadEdgeLines,
                      vector<int> area, vector<int> stopLine);
 
void SetCarMeasurePoint(double *basePoint, int *axial, int *left_front_tire,
                        int *right_front_tire, int *left_rear_tire, int *right_rear_tire,
                        int *body, int bodyNum, double (*point)[2], int pointNum, double antPitch, double antHeight, double groundHeight);
 
void StartDriverExam(int start, int type);
 
void UpdateRTKInfo(const rtk_info *s);
void AddExamFault(int wrong, const struct RtkTime *rtkTime);
 
void SystemShutdown(int event, int timeout);
 
void SetDummyLightExam(int n, struct dummy_light_exam *cfg);;
 
#endif //RTKDRIVERTEST_DRIVER_TEST_H