From 0701276b4fec856d5427e4776eec3cc7c56ec065 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期二, 25 八月 2020 17:51:10 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/test_items2/road_exam.cpp | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/src/main/cpp/test_items2/road_exam.cpp b/lib/src/main/cpp/test_items2/road_exam.cpp index 5913dc5..3e4d0c5 100644 --- a/lib/src/main/cpp/test_items2/road_exam.cpp +++ b/lib/src/main/cpp/test_items2/road_exam.cpp @@ -411,7 +411,7 @@ index = 0; } - while (n++ < RoadMap.roads.size()) { + while (n < RoadMap.roads.size()) { bool changeSegment = false; vector<PointF> roadOutLine; Polygon area; @@ -453,6 +453,7 @@ free(area.point); index = (index + 1) % RoadMap.roads.size(); + n++; } if (n >= RoadMap.roads.size()) { @@ -924,12 +925,13 @@ if (newLane.road == Lane.road && newLane.sep == Lane.sep) { gain = newLane.no - Lane.no; } else { + DEBUG("杞﹂亾鍒嗘鍒囨崲"); ChangeLane.gain = 0; } // 妫�鏌ヨ浆鍚戠伅 if (gain != 0) { - DEBUG("鍙橀亾 gain %d", gain); + DEBUG("鍙橀亾 new lane %d, gain %d", newLane.no, gain); car_sensor_value_t lamp = ReadCarSensorValue(TURN_SIGNAL_LAMP); if (lamp.name == TURN_SIGNAL_LAMP) { if (gain < 0) { @@ -1209,6 +1211,19 @@ return guide; } +static void RingBreak(void) +{ + static int oldValue = BREAK_INACTIVE; + car_sensor_value_t brk = ReadCarSensorValue(BREAK); + + if (brk.name == BREAK) { + if (brk.value == BREAK_ACTIVE && oldValue != BREAK_ACTIVE) { + PlayRing(); + } + oldValue = brk.value; + } +} + void TestRoadGeneral(road_exam_map &RoadMap, const car_model *car, LIST_CAR_MODEL &CarModelList, double speed, int moveDirect, const struct RtkTime *rtkTime) { double BigStraightRoadFree = 0, RoadCrossingFree = 0, TargetFree = 0; @@ -1216,6 +1231,9 @@ UpdateCarSensor(rtkTime); UpdataOdo(speed, moveDirect, rtkTime); + + // 鍒硅溅鎻愮ず闊� + RingBreak(); // 瓒呴�熸娴� if (speed > MAX_SPEED) { @@ -1536,7 +1554,7 @@ if (RoadExamStatus == ROAD_EXAM_ITEM_CAR_START) { freeRunExceptDistance = 60.0; } else { - freeRunExceptDistance = 200.0; + freeRunExceptDistance = 250.0; } RoadExamStatus = ROAD_EXAM_FREE_RUN; -- Gitblit v1.8.0