From 27fc91fbe8f88b6885356e68828cfe1ce1db7601 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期三, 28 二月 2024 09:53:13 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/driver_test.h | 205 +++++++++++++-------------------------------------- 1 files changed, 53 insertions(+), 152 deletions(-) diff --git a/lib/src/main/cpp/driver_test.h b/lib/src/main/cpp/driver_test.h index f773daa..a42c989 100644 --- a/lib/src/main/cpp/driver_test.h +++ b/lib/src/main/cpp/driver_test.h @@ -8,6 +8,10 @@ #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" @@ -28,7 +32,7 @@ MAP_TYPE_UPHILL, MAP_TYPE_PARK_EDGE, MAP_TYPE_CURVE, - MAP_TYPE_TURN_90 + MAP_TYPE_RIGHT_CORNER } map_type_t; typedef struct { @@ -80,146 +84,31 @@ 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; // 鐐圭伀淇濇寔锛屾绉� @@ -304,20 +193,38 @@ 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; // 鐢≧TK瀹氫綅璁$畻鐨勮椹堕噷绋� +} 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, @@ -325,19 +232,13 @@ 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 -- Gitblit v1.8.0