From b4158cef3a57da35d279055ce119572a2278dcd2 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Fri, 17 Feb 2023 10:12:18 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20[Change]=20[=201?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8=E5=8D=95=E6=AC=A1?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E7=9A=84=E8=B0=83=E7=94=A8=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20=20CallerChassisLocationWGS84ListenerManager.INSTAN?= =?UTF-8?q?CE.getChassisLocationWGS84().getLatitude()=20CallerChassisLocat?= =?UTF-8?q?ionWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getL?= =?UTF-8?q?ongitude()=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../och/sweeper/model/SweeperOrderModel.java | 6 +-- .../ui/notice/traffic/NoticeTrafficDialog.kt | 7 ++-- .../hmi/ui/widget/AutoPilotStatusView.kt | 8 ++-- .../routeoverlay/RouteOverlayDrawer.java | 14 ++++--- .../scene/warning/V2XWarningMarker.java | 6 +-- .../function/v2x/events/utils/MapUtils.kt | 6 +-- ...llerChassisLocationWGS84ListenerManager.kt | 39 +++++++++---------- 7 files changed, 45 insertions(+), 41 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java index 38a5dd65e2..fc5b4c548e 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java @@ -23,8 +23,8 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; @@ -307,8 +307,8 @@ public class SweeperOrderModel { if (distance > SweeperConst.ARRIVE_AT_END_STATION_DISTANCE) { distance = CoordinateUtils.calculateLineDistance(startLon, startLat, - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(), - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat()); + CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLongitude(), + CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLatitude()); } if (distance <= SweeperConst.ARRIVE_AT_END_STATION_DISTANCE) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/NoticeTrafficDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/NoticeTrafficDialog.kt index 8f2add30d3..0b1490ef68 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/NoticeTrafficDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/NoticeTrafficDialog.kt @@ -20,8 +20,7 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo.NoticeTrafficAccou import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.notice.NoticeValue import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lat -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager.bizProvider import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog @@ -201,8 +200,8 @@ class NoticeTrafficDialog : BaseFloatDialog, LifecycleObserver { mTrafficStyleInfo!!.lat, mTrafficStyleInfo!!.lon ) parameters.startLatLon = AutoPilotLonLat( - getCurWgs84Lat(), - getCurWgs84Lon() + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude ) parameters.endLatLon = AutoPilotLonLat(gcj02[0], gcj02[1]) startAutoPilot(parameters) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt index dd22839a09..8ec86f7842 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -10,8 +10,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lat -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -80,7 +79,10 @@ class AutoPilotStatusView constructor( currentAutopilot.endName = "HYJC" currentAutopilot.isSpeakVoice = false currentAutopilot.startLatLon = - AutopilotControlParameters.AutoPilotLonLat(getCurWgs84Lat(), getCurWgs84Lon()) + AutopilotControlParameters.AutoPilotLonLat( + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude + ) currentAutopilot.endLatLon = AutopilotControlParameters.AutoPilotLonLat(26.819716071924688, 112.57715442110867) currentAutopilot.vehicleType = 10 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java index 9cf9145540..a218d36f2e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java @@ -5,16 +5,20 @@ import android.graphics.Color; import android.os.Handler; import android.os.HandlerThread; import android.util.Log; + import androidx.core.util.Pools; + import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager; import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils; import com.mogo.map.MogoOverlayManager; import com.mogo.map.overlay.IMogoOverlayManager; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.map.overlay.MogoPolylineOptions; + import java.util.LinkedList; import java.util.List; + import mogo.telematics.pad.MessagePad; public class RouteOverlayDrawer { @@ -128,8 +132,8 @@ public class RouteOverlayDrawer { pps.add(acquire); RouteStrategy.INSTANCE.check(route.getVelocity(), route.getAcceleration(), routeList.size()); } - double lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(); - double lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(); + double lon = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLongitude(); + double lat = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLatitude(); if (points.size() > 0) { MogoLatLng top = null; while (points.size() != 0) { @@ -140,8 +144,8 @@ public class RouteOverlayDrawer { if (first == top) { break; } - lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(); - lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(); + lon = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLongitude(); + lat = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLatitude(); long angle = isPointOnCarFront(lon, lat, bearing, first.lon, first.lat); if (angle >= 90) { RouteStrategy.INSTANCE.remove(first.acc); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java index 51af0affe0..b81750d42c 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java @@ -11,7 +11,7 @@ import com.mogo.commons.utils.Trigonometric; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.v2x.DrawLineInfo; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager; @@ -44,8 +44,8 @@ public class V2XWarningMarker implements IV2XMarker { private final List fillPoints = new ArrayList();//停止线经纬度合集 private boolean isFirstLocation = false; private MogoLatLng carLocation = new MogoLatLng( - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(), - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon() + CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLatitude(), + CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLongitude() ); /* diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt index 09ec0fb754..c49b645366 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt @@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.utils import android.content.Context import android.graphics.Rect import com.mogo.eagle.core.data.map.MogoLatLng -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.utilcode.util.WindowUtils @@ -24,8 +24,8 @@ class MapUtils { mBoundRect.right = WindowUtils.dip2px(context, 100f) // 当前车辆位置 val carLocation = MogoLatLng( - CallerAutoPilotStatusListenerManager.getCurWgs84Lat(), - CallerAutoPilotStatusListenerManager.getCurWgs84Lon() + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude ) // 调整自适应的地图镜头 CallerMapUIServiceManager.getMapUIController() diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt index 38a45f7fd9..a0212d23ee 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt @@ -14,9 +14,9 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils object CallerChassisLocationWGS84ListenerManager : CallerBase() { @Volatile - private var mGnssInfo: MogoLocation? = null + private var mGnssInfo: MogoLocation = MogoLocation() - fun getChassisLocationWGS84(): MogoLocation? { + fun getChassisLocationWGS84(): MogoLocation { return mGnssInfo } @@ -40,27 +40,26 @@ object CallerChassisLocationWGS84ListenerManager : CallerBase 0) { - val hzTime = (1.0 / hz.toDouble()) * 1000 - // 获取最后一次回调的时间 - val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag] - if (hzLastSendTime != null && hzLastSendTime > 0) { - // 计算是否进入下一次回调周期 - val nowTime = TimeUtils.getNowMills() - if (nowTime - hzLastSendTime > hzTime) { - syncLocationCallback(tag, it, mGnssInfo!!, sourceType) - } - } else { - syncLocationCallback(tag, it, mGnssInfo!!, sourceType) + + M_LISTENERS.forEach { + val tag = it.key + // 获取数据监听需要的HZ + val hz = M_LISTENERS_HZ[tag] + if (hz != null && hz > 0) { + val hzTime = (1.0 / hz.toDouble()) * 1000 + // 获取最后一次回调的时间 + val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag] + if (hzLastSendTime != null && hzLastSendTime > 0) { + // 计算是否进入下一次回调周期 + val nowTime = TimeUtils.getNowMills() + if (nowTime - hzLastSendTime > hzTime) { + syncLocationCallback(tag, it, mGnssInfo, sourceType) } } else { - syncLocationCallback(tag, it, mGnssInfo!!, sourceType) + syncLocationCallback(tag, it, mGnssInfo, sourceType) } + } else { + syncLocationCallback(tag, it, mGnssInfo, sourceType) } } }