From de40f4c5948dd7061bd979635aca1ba6221da93b Mon Sep 17 00:00:00 2001 From: renwj Date: Wed, 12 Oct 2022 14:15:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[V2X][Road]=E6=B7=BB=E5=8A=A040%=E7=9A=84?= =?UTF-8?q?=E9=80=8F=E6=98=8E=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt index e4e5429b21..e1fc046121 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt @@ -45,7 +45,7 @@ object AiRoadMarker { private val line by lazy { AtomicReference() } private val START_COLOR = Color.parseColor("#002ABAD9") - private val END_COLOR = Color.parseColor("#FFFF7A30") + private val END_COLOR = Color.parseColor("#66FF7A30") private val markers = ConcurrentSet() From a7ca4752b113cfa09e5df45e287378157d749d30 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Wed, 12 Oct 2022 16:47:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[Fix]docker2.3.0=E5=8F=B8=E6=9C=BA=E5=B1=8F?= =?UTF-8?q?=E6=AF=94=E4=B9=98=E5=AE=A2=E5=B1=8F=E5=85=88=E6=8B=BF=E5=88=B0?= =?UTF-8?q?=E8=BD=A6=E8=BE=86=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E8=BD=AC=E5=8F=91=E6=95=B0=E6=8D=AE=E7=BB=99=E4=B9=98?= =?UTF-8?q?=E5=AE=A2=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/MoGoAutopilotProvider.kt | 51 +++++++++++-------- .../autopilot/telematic/TeleMsgHandler.kt | 6 ++- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index a7268ec13e..dec5498cd8 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -153,27 +153,6 @@ class MoGoAutopilotProvider : } }, MoGoAiCloudClientConfig.getInstance().sn) } else { - msgHandler.setListener(object : EventListener { - override fun connectDevice(isSupportMulti: Boolean) { - if (!isInit) { - isInit = true - UiThreadHandler.post { - if (isSupportMulti) { - // 直连工控机 - directConnect() - } else { - val options = AdasOptions - .Builder() - .setClient(true) - .build() - AdasManager.getInstance() - .create(options, MoGoAdasMsgConnectStatusListenerImpl()) - listenDeviceData() - } - } - } - } - }) NSDNettyManager.getInstance() .searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode), @@ -196,6 +175,36 @@ class MoGoAutopilotProvider : } }) } + msgHandler.setListener(object : EventListener { + override fun connectDevice(isSupportMulti: Boolean) { + if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { + if (!isInit) { + isInit = true + // 转发工控机数据给乘客屏 + listenDeviceData() + } + } else { + if (!isInit) { + isInit = true + UiThreadHandler.post { + if (isSupportMulti) { + // 直连工控机 + directConnect() + } else { + val options = AdasOptions + .Builder() + .setClient(true) + .build() + AdasManager.getInstance() + .create(options, MoGoAdasMsgConnectStatusListenerImpl()) + // 接收司机屏发过来的感知、定位等数据 + listenDeviceData() + } + } + } + } + } + }) CallerAutopilotCarConfigListenerManager.addListener(TAG, this) CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……") // 同步数据给工控机的服务 diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/telematic/TeleMsgHandler.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/telematic/TeleMsgHandler.kt index 1e21903503..30ffb68fd9 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/telematic/TeleMsgHandler.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/telematic/TeleMsgHandler.kt @@ -118,7 +118,10 @@ class TeleMsgHandler : IMsgHandler { "1" -> true else -> false } - Logger.d("Route", "TeleMsgHandler -> handleMsgFromServer ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore:" + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData) + Logger.d( + "Route", + "TeleMsgHandler -> handleMsgFromServer ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore:" + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ) timestamp = currTime invokeNettyConnResult("乘客屏收到的美化模式isIgnore为:${FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData}") } else { @@ -139,6 +142,7 @@ class TeleMsgHandler : IMsgHandler { MogoProtocolMsg.REQ_MAC_ADDRESS -> { val carConfig = AdasManager.getInstance().carConfig if (carConfig != null) { + listener?.connectDevice(!carConfig.dockVersion.contains("2.3.0")) val configArray = carConfig.toByteArray() NSDNettyManager.getInstance().sendMsgToSpecifiedClient( From 0169a68d1e9e1448cb044dabebc8790f4906090f Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Wed, 12 Oct 2022 20:05:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[Fix]=E8=A7=A3=E5=86=B3=E5=8F=B8=E6=9C=BA?= =?UTF-8?q?=E5=B1=8F=E8=BF=9E=E6=8E=A5=E5=B7=A5=E6=8E=A7=E6=9C=BA=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/manager/OCHAdasAbilityManager.java | 196 +++--------------- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 5 +- .../IMoGoAutopilotActionsListener.kt | 12 ++ .../CallerAutopilotActionsListenerManager.kt | 60 ++++++ 4 files changed, 107 insertions(+), 166 deletions(-) create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java index 60901c1673..93ad0039a6 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java @@ -2,19 +2,14 @@ package com.mogo.och.common.module.manager; import android.content.Context; +import androidx.annotation.Nullable; + +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener; +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.zhidao.support.adas.high.AdasManager; -import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.bean.AutopilotAbility; -import com.zhidao.support.adas.high.common.ProtocolStatus; import chassis.Chassis; -import chassis.VehicleStateOuterClass; -import mogo.telematics.pad.MessagePad; -import mogo_msg.MogoReportMsg; -import perception.TrafficLightOuterClass; -import prediction.Prediction; -import record_cache.RecordPanelOuterClass; import system_master.SystemStatusInfo; /** @@ -22,11 +17,10 @@ import system_master.SystemStatusInfo; * 工控机状态信息回调(判断是否能否启动自动驾驶的回调) * 目前定的是3秒回调一次 */ -public class OCHAdasAbilityManager { +public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener { private static final String TAG = OCHAdasAbilityManager.class.getSimpleName(); - private boolean isAutopilotAbility = true; private String autopilotAbilityReason = ""; @@ -52,164 +46,40 @@ public class OCHAdasAbilityManager { private void initListeners() { //2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次 - AdasManager.getInstance().setOnAdasListener(adasListener); + CallerAutopilotActionsListenerManager.INSTANCE.addListener(TAG, this); } private void releaseListeners() { - AdasManager.getInstance().setOnAdasListener(null); + CallerAutopilotActionsListenerManager.INSTANCE.removeListener(this); + } + + @Override + public void onAutopilotAbility(@Nullable AutopilotAbility ability) { + isAutopilotAbility = true; + autopilotAbilityReason = null; + if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P || ability.gear == Chassis.GearPosition.GEAR_R) { + isAutopilotAbility = false; + autopilotAbilityReason = "挡位不正常"; + } + if (isAutopilotAbility) + if (ability.brake > 0) { + isAutopilotAbility = false; + autopilotAbilityReason = "制动踏板被踩下"; + } + if (isAutopilotAbility) + if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_STARTING) { + isAutopilotAbility = false; + autopilotAbilityReason = "系统正在启动"; + } + if (isAutopilotAbility) + if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_EXITING) { + isAutopilotAbility = false; + autopilotAbilityReason = "系统正在关闭"; + } + Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason); } public void release() { releaseListeners(); } - - private final OnAdasListener adasListener = new OnAdasListener() { - @Override - public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) { - - } - - @Override - public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) { - - } - - @Override - public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) { - - } - - @Override - public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) { - - } - - @Override - public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) { - - } - - @Override - public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) { - - } - - @Override - public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) { - - } - - @Override - public void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects) { - - } - - @Override - public void onPointCloud(byte[] pointCloud) { - - } - - @Override - public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) { - - } - - @Override - public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) { - - } - - @Override - public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) { - - } - - @Override - public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) { - - } - - @Override - public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) { - - } - - @Override - public void onWarn(MessagePad.Header header, MessagePad.Warn warn) { - - } - - @Override - public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) { - - } - - @Override - public void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo) { - - } - - @Override - public void onRecordDataConfigResp(MessagePad.Header header, MessagePad.RecordDataConfig config) { - - } - - @Override - public void onPlanningActionMsg(MessagePad.Header header, MessagePad.PlanningActionMsg planningActionMsg) { - - } - - @Override - public void onError(ProtocolStatus status, byte[] bytes) { - - } - - @Override - public void onAutopilotAbility(AutopilotAbility ability) { - isAutopilotAbility = true; - autopilotAbilityReason = null; - if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P || ability.gear == Chassis.GearPosition.GEAR_R) { - isAutopilotAbility = false; - autopilotAbilityReason = "挡位不正常"; - } - if (isAutopilotAbility) - if (ability.brake > 0) { - isAutopilotAbility = false; - autopilotAbilityReason = "制动踏板被踩下"; - } - - if (isAutopilotAbility) - if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_STARTING) { - isAutopilotAbility = false; - autopilotAbilityReason = "系统正在启动"; - } - if (isAutopilotAbility) - if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_EXITING) { - isAutopilotAbility = false; - autopilotAbilityReason = "系统正在关闭"; - } - // 暂时先拦截及提示以上4种异常情况 -// if (isAutopilotAbility) -// if (ability.statusInfo == null) { -// isAutopilotAbility = false; -// autopilotAbilityReason = "系统Topic不正常"; -// } -// if (isAutopilotAbility) -// if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_FAULT) { -// isAutopilotAbility = false; -// autopilotAbilityReason = "系统异常"; -// } -// -// if (isAutopilotAbility) -// for (SystemStatusInfo.HealthInfo healthInfo : ability.statusInfo.getHealthInfoList()) { -// if (healthInfo.getState() == SystemStatusInfo.HealthState.FAULT) { -// isAutopilotAbility = false; -// autopilotAbilityReason = healthInfo.getName() + " Topic异常"; -// break; -// } -// } - - Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason); - } - }; } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index a9a3e8310b..0402c87379 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -1,7 +1,5 @@ package com.mogo.eagle.core.function.autopilot.adapter -import android.location.Location -import android.util.Log import chassis.VehicleStateOuterClass import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig @@ -37,6 +35,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager @@ -51,7 +50,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.map.navi.MogoCarLocationChangedListenerRegister import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasListener import com.zhidao.support.adas.high.bean.AutopilotAbility @@ -444,5 +442,6 @@ class MoGoAdasListenerImpl : OnAdasListener { * 使用方法查看:app_ipc_monitoring/uiMainActivity/onAutopilotAbility */ override fun onAutopilotAbility(ability: AutopilotAbility?) { + invokeAutopilotAbility(ability) } } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt new file mode 100644 index 0000000000..ed661bbed4 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.api.autopilot + +import com.zhidao.support.adas.high.bean.AutopilotAbility + + +interface IMoGoAutopilotActionsListener { + + /** + * pnc actions 决策 驾驶的意图 + */ + fun onAutopilotAbility(ability: AutopilotAbility?) +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt new file mode 100644 index 0000000000..5310098bda --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt @@ -0,0 +1,60 @@ +package com.mogo.eagle.core.function.call.autopilot + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.zhidao.support.adas.high.bean.AutopilotAbility +import java.util.concurrent.ConcurrentHashMap + + +object CallerAutopilotActionsListenerManager : CallerBase() { + + private val M_AUTOPILOT_ACTIONS_LISTENER: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotActionsListener + ) { + if (M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) { + return + } + M_AUTOPILOT_ACTIONS_LISTENER[tag] = listener + } + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) { + return + } + M_AUTOPILOT_ACTIONS_LISTENER.remove(tag) + } + + /** + * 删除自动驾驶按钮选中监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMoGoAutopilotActionsListener) { + M_AUTOPILOT_ACTIONS_LISTENER.forEach { + if (it.value == listener) { + M_AUTOPILOT_ACTIONS_LISTENER.remove(it.key) + } + } + } + + @Synchronized + fun invokeAutopilotAbility(ability: AutopilotAbility?) { + M_AUTOPILOT_ACTIONS_LISTENER.forEach { + val listener = it.value + listener.onAutopilotAbility(ability) + } + } +} \ No newline at end of file