From 6f63de0b700a0a64e612983b9b80bddce6bc1f2c Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Tue, 20 Jun 2023 20:04:58 +0800 Subject: [PATCH] =?UTF-8?q?[3.3.0]=20Text/bus=E5=8F=B8=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E5=88=B0=E7=AB=99=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=EF=BC=9A=E8=BF=87=E7=AB=99=E4=B8=94=E5=9C=A815m=E5=86=85?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=88=B0=E7=AB=99=EF=BC=8C=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=98=AF=E5=8D=95=E7=BA=AF=E5=9B=B4=E6=A0=8F15m=E5=88=B0?= =?UTF-8?q?=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/bus/model/OrderModel.java | 21 +++++++++-- .../com/mogo/och/bus/constant/BusConst.kt | 2 +- .../com/mogo/och/taxi/model/TaxiModel.java | 36 +++++++++++++++---- 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java b/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java index d15d629105..c71775a9c8 100644 --- a/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java +++ b/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java @@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.CoordinateUtils; +import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -406,10 +407,26 @@ public class OrderModel { startLon, startLat, location.getLongitude(), location.getLatitude()); - if (distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE) { + if (distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE) {//1、当前位置和站点围栏15m内 CallerLogger.INSTANCE.d(M_BUS + TAG, "行程日志-judgeArrivedStation() distance = " + distance + " to " + upcomingStation.getName()); - onArriveAt(null); //无自动驾驶到站信息传null + + //2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过 + double stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( + location.getLongitude(), + location.getLatitude(), + startLon, + startLat, + (int) location.getHeading()); + + CallerLogger.INSTANCE.d(M_BUS + TAG, "judgeEndStation() stationAngle = " + stationAngle); + + //3、刚过站且过站距离在15m内, 提交到站 + if (stationAngle > 90 && distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE){ + CallerLogger.INSTANCE.d(M_BUS + TAG, "judgeEndStation() = 刚过站且在15m内"); + onArriveAt(null); //无自动驾驶到站信息传null + } + return; } } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt index 7eadb3d41f..711fe90a39 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt @@ -64,7 +64,7 @@ class BusConst { const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L //围栏到站 暂定10米 - const val ARRIVE_AT_END_STATION_DISTANCE = 10 + const val ARRIVE_AT_END_STATION_DISTANCE = 15 // 轮询 const val LOOP_PASSENGER_5S = 5 * 1000L diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index c754678d1e..47670950c4 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -37,6 +37,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListener import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.CoordinateUtils; +import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -1082,26 +1083,47 @@ public class TaxiModel { } }; - private void judgeEndStation(MogoLocation location) { + private void judgeEndStation(MogoLocation currentLocation) { if (mCurrentOCHOrder == null || mCurrentOCHOrder.endSiteGcjPoint == null || mCurrentOCHOrder.endSiteGcjPoint.size() < 2) { return; } - double startLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); - double startLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); + double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); + double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); double distance = CoordinateUtils.calculateLineDistance( - startLon, startLat, - location.getLongitude(), location.getLatitude()); + endLon, endLat, + currentLocation.getLongitude(), currentLocation.getLatitude()); CallerLogger.INSTANCE.i(M_TAXI + TAG, "judgeEndStation() distance = " + distance); - if (distance <= TaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { + if (distance <= TaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内 + if (!checkCurrentOCHOrder() || (getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)) { CallerLogger.INSTANCE.i(M_TAXI + TAG, "order exception or order ArriveAtEnd"); return; } - arriveTerminal(); + + //2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过 + double stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( + currentLocation.getLongitude(), + currentLocation.getLatitude(), + endLon, + endLat, + (int) currentLocation.getHeading()); + + CallerLogger.INSTANCE.i(M_TAXI + TAG, "judgeEndStation() stationAngle = " + stationAngle); + + //3、刚过站且过站距离在15m内, 提交到站 + if (stationAngle > 90 && distance <= TaxiConst.ARRIVE_AT_START_STATION_DISTANCE){ + if (!checkCurrentOCHOrder() + || (getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)) { + CallerLogger.INSTANCE.i(M_TAXI + TAG, "order exception or order ArriveAtEnd"); + return; + } + CallerLogger.INSTANCE.i(M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内"); + arriveTerminal(); + } } }