From 9a2feb631a9e64a3207245ca1fd16230fdd52fa4 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Wed, 27 Sep 2023 19:19:02 +0800 Subject: [PATCH] =?UTF-8?q?[6.1.0]=E4=BF=AE=E5=A4=8D=E7=BA=A2=E7=BB=BF?= =?UTF-8?q?=E7=81=AFAI=E4=BA=91=E8=8E=B7=E5=8F=96=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E8=87=AA=E8=BD=A6=E6=84=9F=E7=9F=A5?= =?UTF-8?q?=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacenter/v2x/TrafficLightDispatcher.kt | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt index 902302fec5..9f5cc29ffa 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt @@ -66,6 +66,11 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight //obu数据 @Volatile private var hasObuLightStatus: Boolean = false + + //是否有自车感知红绿灯数据 + @Volatile + private var hasAutopilotPerception: Boolean = false + //红绿灯定时器,超时未更新隐藏红绿灯 @Volatile private var lightCountDownTimer: CountDownTimer? = null @@ -90,7 +95,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight ) if (!hasObuLightStatus) { if (!hasAiLightStatus) { - trafficLights?.let { it -> + trafficLights?.let { var light: TrafficLight? = null if (it.hasStraight()) { light = it.straight @@ -106,9 +111,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight "onAutopilotPerceptionTrafficLight light = $light " ) if (light == null) { + hasAutopilotPerception = false //隐藏红绿灯显示 hide("感知light为null隐藏", DataSourceType.TELEMATIC) } else { + if(!hasAutopilotPerception){ + hasAutopilotPerception = true + } onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC) } } @@ -128,6 +137,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight } if (!hasObuLightStatus) { hasAiLightStatus = true + hasAutopilotPerception = false CallerLogger.d( "${SceneConstant.M_D_C}${TAG}", "onTrafficLightStatus trafficLightResult = $trafficLightResult " @@ -156,7 +166,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight //如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理 if (!hasObuLightStatus) { CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus) - hide("云端离开路口隐藏", DataSourceType.AICLOUD) +// hide("云端离开路口隐藏", DataSourceType.AICLOUD) } } } @@ -165,15 +175,15 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight * 红绿灯接口请求失败 */ override fun onTrafficRequestError() { - hasAiLightStatus = false CallerLogger.d( "${SceneConstant.M_D_C}${TAG}", "onTrafficRequestError hasObuLightStatus = $hasObuLightStatus ------> " ) - CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus) - if (!hasObuLightStatus) { - hide("云端红绿灯接口请求失败隐藏", DataSourceType.AICLOUD) - } + CallerTrafficLightListenerManager.resetTrafficLightStatus(hasAiLightStatus) + hasAiLightStatus = false +// if (!hasObuLightStatus) { +// hide("云端红绿灯接口请求失败隐藏", DataSourceType.AICLOUD) +// } } /** @@ -186,14 +196,14 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight } /** - * 是否重置红绿灯数据,需要确保,在obu的红绿灯显示的时候,不执行。否则会闪屏 + * 是否重置红绿灯数据,需要确保,在obu的红绿灯显示或自车感知红绿灯显示的时候,不执行。否则会闪屏 */ override fun resetTrafficLight(isReset: Boolean) { CallerLogger.d( "${SceneConstant.M_D_C}${TAG}", "resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus" ) - if (!hasObuLightStatus) { + if (!hasObuLightStatus && !hasAutopilotPerception) { if (isReset) { hide("云端重置红绿灯数据", DataSourceType.AICLOUD) } @@ -228,6 +238,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight super.onTrafficLightPlusSource(light, remain, lightSource) if (lightSource == DataSourceType.OBU) { hasObuLightStatus = true + hasAutopilotPerception = false } CallerLogger.d( "${SceneConstant.M_D_C}${TAG}",