fctom1215
2020-03-02 96ff5ab3c5c7d83d0444c422023f0d21521d4adc
角度修正。
3个文件已修改
104 ■■■■■ 已修改文件
lib/src/main/cpp/rtk_module/rtk.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/test_items/driving_curve.cpp 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/test_items/driving_curve.h 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_module/rtk.cpp
@@ -202,7 +202,7 @@
        }*/
        if (RxBufLen > 0) {
#if 0
#if 1
            const uint8_t *ptr = parseGPS(RxBuf, RxBuf + RxBufLen);
            if(ptr != RxBuf) {
                memcpy(RxBuf, ptr, RxBufLen - (ptr - RxBuf));
lib/src/main/cpp/test_items/driving_curve.cpp
@@ -3,12 +3,16 @@
//
#include "driving_curve.h"
#include "../jni_log.h"
#include "../driver_test.h"
#include "../common/apptimer.h"
#include "../utils/xconvert.h"
#include <vector>
using namespace std;
#define DEBUG(fmt, args...)     LOGD("<driving_curve> <%s>: " fmt, __func__, ##args)
enum {
    DRIVING_ON_CURVE
@@ -16,62 +20,70 @@
const uint32_t STOP_CAR_TIME = D_SEC(2);
static bool carStopEvent = false;
static bool DCTesting = false;
static int currTarget;
static bool testing = false;
static uint32_t stopTimepoint = 0;
static bool reportStopCarTimeout;
static int prevMoveDirect;
static bool crashRedLine;
static struct {
    int leftStart;
    int leftEnd;
    int rightStart;
    int rightEnd;
} calcZone;
static bool CrashRedLine(const Polygon *left, const Polygon *right, const car_model_cache_t *car);
static bool ExitTestArea(const Polygon *left, const Polygon *right, const car_model_cache_t *car);
void StartDrivingCurve(void)
void StartDrivingCurve(int moveDirect, const struct RtkTime *rtkTime)
{
    DCTesting = true;
    carStopEvent = false;
    currTarget = DRIVING_ON_CURVE;
    DEBUG("进入曲线行驶场地");
    testing = true;
    prevMoveDirect = moveDirect;
    if (moveDirect == 0) {
        stopTimepoint = TimeMakeComposite(rtkTime->hh, rtkTime->mm, rtkTime->ss, rtkTime->mss*10);
    }
    reportStopCarTimeout = false;
    crashRedLine = false;
    calcZone.leftStart = calcZone.leftEnd = calcZone.rightStart = calcZone.rightEnd = -1;
}
void StopDrivingCurve(void)
int TestDrivingCurve(const Polygon *map, const Polygon *map2, const car_model *car, const car_model *carPrev, double speed, int moveDirect, const struct RtkTime *rtkTime)
{
    DCTesting = false;
}
    Line start, end;
    Polygon zone;
int TestDrivingCurve(vector<int>&err, const Polygon *map, const Polygon *map2, const car_model_cache_t *car, double speed, int run_status)
{
    int status = 0;
    if (!DCTesting)
        return -2;
    if (currTarget == DRIVING_ON_CURVE) {
        if (CrashRedLine(map, map2, car)) {
            // 车轮压线
            err.push_back(27);
            status = -1;
        }
        if (ExitTestArea(map, map2, car)) {
            // 测试完成
            status = 1;
        }
        if (run_status != 0) {
            if (carStopEvent && AppTimer_GetTickCount() - stopTimepoint > D_SEC(2)) {
                // 中途停车
                err.push_back(28);
            }
            carStopEvent = false;
        } else {
            carStopEvent = true;
            stopTimepoint = AppTimer_GetTickCount();
        }
    if (calcZone.leftStart == -1) {
        calcZone.leftStart = 0;
    }
    if (calcZone.rightStart == -1) {
        calcZone.rightStart = 0;
    }
    if (status != 0) {
        StopDrivingCurve();
    start.X1 = map->point[calcZone.leftStart].X;
    start.Y1 = map->point[calcZone.leftStart].Y;
    start.X2 = map->point[calcZone.rightStart].X;
    start.Y2 = map->point[calcZone.rightStart].Y;
    zone.num = 4;
    zone.point = (PointF *) malloc(zone.num * sizeof(PointF));
    zone.point[0] = car->carXY[car->left_front_tire[TIRE_OUTSIDE]];
    zone.point[1] = car->carXY[car->right_front_tire[TIRE_OUTSIDE]];
    zone.point[2] = car->carXY[car->right_rear_tire[TIRE_OUTSIDE]];
    zone.point[3] = car->carXY[car->left_rear_tire[TIRE_OUTSIDE]];
    if (IntersectionOf(start, &zone) == GM_None) {
    }
    return status;
    free(zone.point);
    return testing ? 1 : 0;
}
// 车轮是否压边线
lib/src/main/cpp/test_items/driving_curve.h
@@ -10,8 +10,8 @@
using namespace std;
void StartDrivingCurve(void);
void StopDrivingCurve(void);
int TestDrivingCurve(vector<int>&err, const Polygon *map, const Polygon *map2, const car_model_cache_t *car, double speed, int run_status);
void StartDrivingCurve(int moveDirect, const struct RtkTime *rtkTime);
int TestDrivingCurve(const Polygon *map, const Polygon *map2, const car_model *car, const car_model *carPrev, double speed, int moveDirect, const struct RtkTime *rtkTime);
#endif //RTKDRIVERTEST_DRIVING_CURVE_H