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(); + } } }