From bf8e1f4ef4961b32dfa73a0b898f82c20721bf09 Mon Sep 17 00:00:00 2001 From: fctom1215 <fctom1215@outlook.com> Date: 星期五, 28 八月 2020 08:56:23 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/test_items2/drive_straight.cpp | 2 +- lib/src/main/cpp/driver_test.cpp | 17 +++++++++++++++++ lib/src/main/cpp/test_items2/overtake.cpp | 2 +- lib/src/main/cpp/test_items2/car_start.cpp | 10 +++++----- lib/src/main/cpp/test_items2/through_something.cpp | 5 ++++- lib/src/main/cpp/test_items2/dummy_light.cpp | 2 +- lib/src/main/cpp/test_items2/stop_car.cpp | 3 +-- lib/src/main/cpp/test_items2/change_lane.cpp | 2 +- lib/src/main/cpp/test_items2/operate_gear.cpp | 2 +- lib/src/main/cpp/rtk_platform/platform.cpp | 2 +- 10 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp index 0b16c3e..08fbfbd 100644 --- a/lib/src/main/cpp/driver_test.cpp +++ b/lib/src/main/cpp/driver_test.cpp @@ -96,6 +96,7 @@ static void UpdateCarBodyCoord(struct RtkTime *rtkTime, double azimuth, double pitch, double roll, PointF main_ant, car_model *carModel); static bool UpdateCarCoord(double &spd, int &mov, int &idx); +static void PrintObdInfo(struct RtkTime *rtkTime, double speed); void DriverTestInit(void) { @@ -500,6 +501,22 @@ if (ExamStart) { ExecuteExam(speed, move, azimuth, &rtkTime); } + + PrintObdInfo(&rtkTime, speed); + } +} + + + +static void PrintObdInfo(struct RtkTime *rtkTime, double speed) { + static struct RtkTime cTime = *rtkTime; + + if (TimeGetDiff(rtkTime, &cTime) >= D_SEC(3)) { + cTime = *rtkTime; + DEBUG("ENGINE_RPM %d OBD_SPEED %f SPEED %f", + ReadCarStatus(ENGINE_RPM), + ((double)ReadCarStatus(OBD_SPEED)) / 10.0, + speed * 3.6); } } diff --git a/lib/src/main/cpp/rtk_platform/platform.cpp b/lib/src/main/cpp/rtk_platform/platform.cpp index e63c642..f0dd9a0 100644 --- a/lib/src/main/cpp/rtk_platform/platform.cpp +++ b/lib/src/main/cpp/rtk_platform/platform.cpp @@ -464,7 +464,7 @@ sensor.trip = BUILD_UINT32(data[7], data[6], data[5], data[4]); sensor.tripTime = BUILD_UINT32(data[11], data[10], data[9], data[8]); sensor.cellVolt = (double)(BUILD_UINT16(data[13], data[12])) / 10.0; - sensor.speed = (double)(BUILD_UINT16(data[15], data[14])) / 10.0; + sensor.speed = BUILD_UINT16(data[15], data[14]); sensor.engine = BUILD_UINT16(data[17], data[16]); sensor.sas = (short)BUILD_UINT16(data[19], data[18]); sensor.key = data[x++]; diff --git a/lib/src/main/cpp/test_items2/car_start.cpp b/lib/src/main/cpp/test_items2/car_start.cpp index 07a9916..9d0fb35 100644 --- a/lib/src/main/cpp/test_items2/car_start.cpp +++ b/lib/src/main/cpp/test_items2/car_start.cpp @@ -11,7 +11,7 @@ #include "../jni_log.h" #include "../common/apptimer.h" -#define DEBUG(fmt, args...) LOGD("<car_start> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam car_start> <%s>: " fmt, __func__, ##args) static const int MAX_ENGINE_RPM = 2500; static const double START_CAR_MOVE_DISTANCE = 10.0; @@ -32,9 +32,9 @@ checkStartCarSignal = false; checkDoor = false; handBreakActive = false; - int id = PlayTTS("璇疯捣姝�", cb); + PlayTTS("璇疯捣姝�", cb); - DEBUG("璇煶寮�濮� %d", id); + DEBUG("杞﹁締璧锋"); } bool TestCarStart(const car_model *car, double speed, int moveDirect, const struct RtkTime *rtkTime) @@ -42,7 +42,7 @@ car_sensor_value_t sensor; double moveDistance = ReadOdo() - startCarMoveDistance; - DEBUG("璧锋琛岄┒璺濈 %f", moveDistance); +// DEBUG("璧锋琛岄┒璺濈 %f", moveDistance); if (!checkStartCarSignal && moveDirect == 1) { checkStartCarSignal = true; @@ -53,7 +53,7 @@ DEBUG("鍙樿皟鏈墦鐏�!!"); // 娌℃墦鐏紝涓嶅悎鏍� AddExamFault(13, rtkTime); - } else if (TimeGetDiff(rtkTime, &sensor.time) >= D_SEC(3)) { + } else if (TimeGetDiff(rtkTime, &sensor.time) < D_SEC(3)) { DEBUG("杞悜鐏椂闂翠笉瓒�"); // 涓嶈冻3绉掞紝涓嶅悎鏍� AddExamFault(14, rtkTime); diff --git a/lib/src/main/cpp/test_items2/change_lane.cpp b/lib/src/main/cpp/test_items2/change_lane.cpp index fde4995..e4d927a 100644 --- a/lib/src/main/cpp/test_items2/change_lane.cpp +++ b/lib/src/main/cpp/test_items2/change_lane.cpp @@ -8,7 +8,7 @@ #include "../jni_log.h" #include "../driver_test.h" -#define DEBUG(fmt, args...) LOGD("<change_lane> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam change_lane> <%s>: " fmt, __func__, ##args) static double maxMoveDistance; static int originalLane; diff --git a/lib/src/main/cpp/test_items2/drive_straight.cpp b/lib/src/main/cpp/test_items2/drive_straight.cpp index 04ec8fa..d6a9db2 100644 --- a/lib/src/main/cpp/test_items2/drive_straight.cpp +++ b/lib/src/main/cpp/test_items2/drive_straight.cpp @@ -12,7 +12,7 @@ #include "../test_common/odo_graph.h" #include <cmath> -#define DEBUG(fmt, args...) LOGD("<drive_straight> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam drive_straight> <%s>: " fmt, __func__, ##args) static const double CHECK_STAGE_DISTANCE = 100.0; static const double MAX_OFFSET_DISTANCE = 0.3; diff --git a/lib/src/main/cpp/test_items2/dummy_light.cpp b/lib/src/main/cpp/test_items2/dummy_light.cpp index 36bc003..dcb3d09 100644 --- a/lib/src/main/cpp/test_items2/dummy_light.cpp +++ b/lib/src/main/cpp/test_items2/dummy_light.cpp @@ -9,7 +9,7 @@ #include "../jni_log.h" #include "../test_common/car_sensor.h" -#define DEBUG(fmt, args...) LOGD("<dummy_light> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam dummy_light> <%s>: " fmt, __func__, ##args) enum { TTS_NOT_START, diff --git a/lib/src/main/cpp/test_items2/operate_gear.cpp b/lib/src/main/cpp/test_items2/operate_gear.cpp index 73de9c3..157d2a7 100644 --- a/lib/src/main/cpp/test_items2/operate_gear.cpp +++ b/lib/src/main/cpp/test_items2/operate_gear.cpp @@ -11,7 +11,7 @@ #include "../test_common/odo_graph.h" #include "road_exam.h" -#define DEBUG(fmt, args...) LOGD("<operate_gear> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam operate_gear> <%s>: " fmt, __func__, ##args) static int expectGear; static int upDownShift; diff --git a/lib/src/main/cpp/test_items2/overtake.cpp b/lib/src/main/cpp/test_items2/overtake.cpp index ad97bce..c756867 100644 --- a/lib/src/main/cpp/test_items2/overtake.cpp +++ b/lib/src/main/cpp/test_items2/overtake.cpp @@ -8,7 +8,7 @@ #include "../test_common/odo_graph.h" #include "../driver_test.h" -#define DEBUG(fmt, args...) LOGD("<overtake> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam overtake> <%s>: " fmt, __func__, ##args) static double maxMoveDistance; static int setup; diff --git a/lib/src/main/cpp/test_items2/stop_car.cpp b/lib/src/main/cpp/test_items2/stop_car.cpp index 2ec36c9..e5fa467 100644 --- a/lib/src/main/cpp/test_items2/stop_car.cpp +++ b/lib/src/main/cpp/test_items2/stop_car.cpp @@ -13,7 +13,7 @@ #include "../defs.h" #include "../test_common/odo_graph.h" -#define DEBUG(fmt, args...) LOGD("<stop_car> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam stop_car> <%s>: " fmt, __func__, ##args) static bool BreakHandbreakReleaseSametime, OpenDoor; @@ -82,7 +82,6 @@ DEBUG("鍋滆溅瓒呭嚭璺竟0.3绫�"); // 鍋滆溅璺濈瓒呰繃30鍘樼背锛屾墸10鍒� AddExamFault(37, rtkTime); - return false; } setup = 4; diff --git a/lib/src/main/cpp/test_items2/through_something.cpp b/lib/src/main/cpp/test_items2/through_something.cpp index 2c18908..09f6318 100644 --- a/lib/src/main/cpp/test_items2/through_something.cpp +++ b/lib/src/main/cpp/test_items2/through_something.cpp @@ -14,7 +14,7 @@ #include "road_exam.h" #include "../utils/xconvert.h" -#define DEBUG(fmt, args...) LOGD("<through_something> <%s>: " fmt, __func__, ##args) +#define DEBUG(fmt, args...) LOGD("<road_exam through_something> <%s>: " fmt, __func__, ##args) using namespace std; @@ -91,11 +91,13 @@ } // 璁板綍鍒硅溅 if (dobreak && !(rec & REDUCE_SPEED)) { + DEBUG("妫�娴嬪埌璺彛鍒硅溅鍔ㄤ綔"); SetTargetReduceRec(TargetReduceRec, key, rec | REDUCE_SPEED); } } else if (distance > 1e-3 && distance < DISTANCE_STOP_CAR_TO_STOP_LINE) { // 璺彛鍋滆溅瑙傚療 if (moveDirect == 0 && !(rec & STOP_CAR)) { + DEBUG("妫�娴嬪埌璺彛鍋滆溅鍔ㄤ綔"); SetTargetReduceRec(TargetReduceRec, key, rec | STOP_CAR); } } else if (distance > LASTEST_BREAK_POINT + 5 && rec != NOT_ENTER) { @@ -126,6 +128,7 @@ } // 璁板綍鍒硅溅锛屽仠杞� if (dobreak && !(rec & REDUCE_SPEED)) { + DEBUG("妫�娴嬪埌浜鸿閬撶瓑鍒硅溅鍔ㄤ綔"); SetTargetReduceRec(TargetReduceRec2, key, rec | REDUCE_SPEED); } } else if (distance1 > LASTEST_BREAK_POINT + 5 && rec != NOT_ENTER) { -- Gitblit v1.8.0