yy1717
2020-08-18 efc508204e781a1ce1d3f55c2b986198c9e32509
坐标
5个文件已修改
2个文件已添加
141 ■■■■ 已修改文件
lib/src/main/cpp/CMakeLists.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/driver_test.cpp 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/master/comm_if.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_platform/platform.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/test_items2/road_exam.cpp 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/test_items2/smart_item.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/test_items2/smart_item.h 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/CMakeLists.txt
@@ -45,6 +45,7 @@
        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
lib/src/main/cpp/driver_test.cpp
@@ -505,47 +505,47 @@
    {
        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"
                "关闭",
                "告警灯",
                "左转信号",
                "右转信号",
                "示廓灯亮",
                "近光灯亮",
                "远光灯亮",
                "远近切换",
                "雾灯亮",
                "插入",
                "在启动位",
                "空档",
                "一档",
                "二档",
                "三档",
                "四档",
                "五档",
                "倒挡",
                "踩下",
                "门关闭",
                "绕车发生"
        };
@@ -574,6 +574,11 @@
                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);
            }
        }
lib/src/main/cpp/master/comm_if.cpp
@@ -291,8 +291,10 @@
    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");
lib/src/main/cpp/rtk_platform/platform.cpp
@@ -425,8 +425,8 @@
        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++];
lib/src/main/cpp/test_items2/road_exam.cpp
@@ -51,6 +51,7 @@
    int road;
    int sep;
    int no;
    int total;
    int guide;
} lane_t;
@@ -173,6 +174,8 @@
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)
{
@@ -768,6 +771,7 @@
            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') {
@@ -779,6 +783,12 @@
            return true;
        }
    }
    lane.road = roadIndex;
    lane.sep = 0;
    lane.no = 0;
    lane.total = 0;
    lane.guide = 0;
    return false;
}
@@ -1380,6 +1390,8 @@
    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;
@@ -1394,6 +1406,10 @@
    if (Lane.guide != oldid) {
        DEBUG("导向类型切换 %d", Lane.guide);
    }
    if (currExamMapIndex >= 0) {
        AnalysisRoad(RoadMap, currExamMapIndex, Lane, car);
    }
    // 检测压线状态
@@ -1792,3 +1808,22 @@
    }
    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;
            }
        }
    }
}
lib/src/main/cpp/test_items2/smart_item.cpp
New file
@@ -0,0 +1,8 @@
//
// Created by YY on 2020/8/18.
//
#include "smart_item.h"
#include "../driver_test.h"
lib/src/main/cpp/test_items2/smart_item.h
New file
@@ -0,0 +1,8 @@
//
// Created by YY on 2020/8/18.
//
#ifndef MYAPPLICATION2_SMART_ITEM_H
#define MYAPPLICATION2_SMART_ITEM_H
#endif //MYAPPLICATION2_SMART_ITEM_H