| | |
| | | test_items2/drive_straight.cpp |
| | | test_items2/stop_car.cpp |
| | | test_items2/operate_gear.cpp |
| | | test_items2/smart_item.cpp |
| | | |
| | | rtk_module/rtk.cpp |
| | | rtk_module/virtual_rtk.cpp |
| | |
| | | { |
| | | static const char *NAME[] = {"OBD_SPEED", |
| | | "ENGINE_RPM", |
| | | "GEAR", |
| | | "TURN_SIGNAL_LAMP", |
| | | "DIPPED_BEAM_LAMP", |
| | | "FOG_LAMP", |
| | | "CLEARANCE_LAMP", |
| | | "FLASH_BEAM_LAMP", |
| | | "MAIN_BEAM_LAMP", |
| | | "SEATBELT", |
| | | "ENGINE_START", |
| | | "BREAK", |
| | | "HAND_BREAK", |
| | | "SECOND_BREAK", |
| | | "DOOR", |
| | | "SURROUND_CAR_1", |
| | | "SURROUND_CAR_2", |
| | | "SURROUND_CAR_3", |
| | | "SURROUND_CAR_4", |
| | | "挡位", |
| | | "转向灯", |
| | | "近光灯", |
| | | "雾灯", |
| | | "示廓灯", |
| | | "远近光", |
| | | "远光灯", |
| | | "安全带", |
| | | "启动引擎", |
| | | "刹车", |
| | | "手刹", |
| | | "副刹车", |
| | | "车门", |
| | | "绕车一", |
| | | "绕车二", |
| | | "绕车三", |
| | | "绕车四", |
| | | "CAR_STATUS_END"}; |
| | | |
| | | static const char *VALUE[] = { |
| | | "INACTIVE", |
| | | "HAZARD_LIGHTS", |
| | | "LEFT_TURN_LIGHT", |
| | | "RIGHT_TURN_LIGHT", |
| | | "CLEARANCE_LIGHT", |
| | | "DIPPED_BEAM_LIGHT", |
| | | "MAIN_BEAM_LIGHT", |
| | | "FLASH_BEAM_LIGHT", |
| | | "FOG_LIGHT", |
| | | "INSERT_SEATBELT", |
| | | "ENGINE_START_ACTIVE", |
| | | "GEAR_N", |
| | | "GEAR_1", |
| | | "GEAR_2", |
| | | "GEAR_3", |
| | | "GEAR_4", |
| | | "GEAR_5", |
| | | "GEAR_R", |
| | | "BREAK_ACTIVE", |
| | | "DOOR_CLOSE", |
| | | "SURROUND_CAR_ACTIVE" |
| | | "关闭", |
| | | "告警灯", |
| | | "左转信号", |
| | | "右转信号", |
| | | "示廓灯亮", |
| | | "近光灯亮", |
| | | "远光灯亮", |
| | | "远近切换", |
| | | "雾灯亮", |
| | | "插入", |
| | | "在启动位", |
| | | "空档", |
| | | "一档", |
| | | "二档", |
| | | "三档", |
| | | "四档", |
| | | "五档", |
| | | "倒挡", |
| | | "踩下", |
| | | "门关闭", |
| | | "绕车发生" |
| | | }; |
| | | |
| | | |
| | |
| | | DEBUG("车辆状态 %s = %s", NAME[i], VALUE[ cs_temp[i] ]); |
| | | |
| | | cs[i] = cs_temp[i]; |
| | | |
| | | char buff[128]; |
| | | |
| | | sprintf(buff, "%s,%s", NAME[i], VALUE[ cs_temp[i] ]); |
| | | PlayTTS(buff); |
| | | } |
| | | } |
| | | |
| | |
| | | writer.Int(brief->tripTime); |
| | | writer.Key("cell_volt"); |
| | | writer.Double(brief->cellVolt); |
| | | writer.Key("speed"); |
| | | writer.Double(brief->speed); |
| | | writer.Key("engine"); |
| | | writer.Double(brief->engine); |
| | | writer.Int(brief->engine); |
| | | writer.Key("sas"); |
| | | writer.Int(brief->sas); |
| | | writer.Key("key"); |
| | |
| | | brief.odo = BUILD_UINT32(data[3], data[2], data[1], data[0]); |
| | | brief.trip = BUILD_UINT32(data[7], data[6], data[5], data[4]); |
| | | brief.tripTime = BUILD_UINT32(data[11], data[10], data[9], data[8]); |
| | | brief.cellVolt = (double)(BUILD_UINT16(data[13], data[12])) / 10.0; |
| | | brief.speed = (double)(BUILD_UINT16(data[15], data[14])) / 10.0; |
| | | brief.cellVolt = ((double) BUILD_UINT16(data[13], data[12])) / 10.0; |
| | | brief.speed = ((double) BUILD_UINT16(data[15], data[14])) / 10.0; |
| | | brief.engine = BUILD_UINT16(data[17], data[16]); |
| | | brief.sas = (short)BUILD_UINT16(data[19], data[18]); |
| | | brief.key = data[x++]; |
| | |
| | | int road; |
| | | int sep; |
| | | int no; |
| | | int total; |
| | | int guide; |
| | | } lane_t; |
| | | |
| | |
| | | static bool AllCmp(road_exam_map &map); |
| | | |
| | | static int CalcRoadIndex(int currRoadIndex, road_exam_map &RoadMap, const car_model *car); |
| | | |
| | | void AnalysisRoad(road_exam_map &RoadMap, int roadIndex, lane_t lane, const car_model *car); |
| | | |
| | | void InitRoadExam(road_exam_map &RoadMap) |
| | | { |
| | |
| | | lane.road = roadIndex; |
| | | lane.sep = i; |
| | | lane.no = CLP.size(); |
| | | lane.total = CLP.size() + 1; |
| | | |
| | | for (int x = 0; x < CLP.size(); ++x) { |
| | | if (CLP[x].pos == 'L') { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | lane.road = roadIndex; |
| | | lane.sep = 0; |
| | | lane.no = 0; |
| | | lane.total = 0; |
| | | lane.guide = 0; |
| | | |
| | | return false; |
| | | } |
| | |
| | | |
| | | oldid = Lane.guide; |
| | | DetectLane(RoadMap, car, currExamMapIndex, rtkTime); |
| | | |
| | | // DEBUG("Lane信息 road %d sep %d total %d no %d guide %d", Lane.road, Lane.sep, Lane.total, Lane.no, Lane.guide); |
| | | if (Lane.guide > 0 && currExamMapIndex >= 0) { |
| | | int stop_line; |
| | | |
| | |
| | | |
| | | if (Lane.guide != oldid) { |
| | | DEBUG("导向类型切换 %d", Lane.guide); |
| | | } |
| | | |
| | | if (currExamMapIndex >= 0) { |
| | | AnalysisRoad(RoadMap, currExamMapIndex, Lane, car); |
| | | } |
| | | |
| | | // 检测压线状态 |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | void AnalysisRoad(road_exam_map &RoadMap, int roadIndex, lane_t lane, const car_model *car) |
| | | { |
| | | double distance = 0; |
| | | |
| | | if (roadIndex < 0 || roadIndex >= RoadMap.roads.size()) |
| | | return; |
| | | |
| | | for (int i = 0; i < RoadMap.roads[roadIndex].rightEdge.size(); ++i) { |
| | | for (int j = 1; j < RoadMap.roads[roadIndex].rightEdge[i].points.size(); ++j) { |
| | | PointF point = RoadMap.roads[roadIndex].rightEdge[i].points[j]; |
| | | distance = CalcDistanceReference(car->carXY[car->axial[AXIAL_FRONT]], point, RoadMap.roads[roadIndex].rightEdge); |
| | | if (distance > 1e-3) { |
| | | DEBUG("直道剩余距离 %f", distance); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/8/18. |
| | | // |
| | | |
| | | #include "smart_item.h" |
| | | #include "../driver_test.h" |
| | | |
| | | |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/8/18. |
| | | // |
| | | |
| | | #ifndef MYAPPLICATION2_SMART_ITEM_H |
| | | #define MYAPPLICATION2_SMART_ITEM_H |
| | | |
| | | #endif //MYAPPLICATION2_SMART_ITEM_H |