[code_opt_3.3.0] code opt

This commit is contained in:
zhongchao
2023-06-09 11:05:53 +08:00
parent 00a999c777
commit ad73ccf819
58 changed files with 293 additions and 712 deletions

View File

@@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_AD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_RECORD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_ROUTE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_VEHICLE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_CONFIG
@@ -21,21 +20,20 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_AD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_P_OBJECTS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_STATUS_QUERY_RESP
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_GNSS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_AUTOPILOT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_GNSS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_P_ACTIONS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_P_OBJECTS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_VEHICLE
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
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.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
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.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
@@ -53,10 +51,8 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.v2x.*
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhjt.mogo.adas.data.bean.AdasParam
import com.zhidao.support.adas.high.common.ProtocolStatus
@@ -83,10 +79,6 @@ import record_cache.RecordPanelOuterClass
import system_master.SystemStatusInfo
/**
* @author emArrow
* @since 2022/3/11
*
*
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
*/
class MoGoAdasListenerImpl : OnAdasListener {
@@ -139,7 +131,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
if (gnssInfo != null) {
if (1 == FunctionBuildConfig.gpsProvider) {
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
gnssInfo.satelliteTime,
gnssInfo.longitude,
gnssInfo.latitude
@@ -288,29 +280,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
if (autopilotState != null) {
//工控机模拟时间
CallerAutopilotVehicleStateListenerManager.invokeAutopilotTime(header.timestamp.toLong())
if (HdMapBuildConfig.isMapLoaded) {
// 初始化自动驾驶状态信息
val autopilotStatusInfo = getAutoPilotStatusInfo()
autopilotStatusInfo.state = autopilotState.state
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
autopilotStatusInfo.reason = autopilotState.reason
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
if (autopilotStatusInfo.connectIP == null) {
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
}
if (autopilotStatusInfo.connectPort == null) {
autopilotStatusInfo.connectPort = AdasManager.getInstance().ipcConnectedPort
}
AdasManager.getInstance().carConfig?.let {
autopilotStatusInfo.dockVersion = it.dockVersion
}
CallerLogger.d(
"Upgrade",
"origin = ${autopilotStatusInfo.connectStatus} -----now = ${AppConfigInfo.isConnectAutopilot} "
)
AppConfigInfo.isConnectAutopilot = autopilotStatusInfo.connectStatus
AppConfigInfo.connectStatusDescribe = autopilotStatusInfo.connectStatusDescribe
invokeAutoPilotStatus()
if (HdMapBuildConfig.isMapLoaded) { //todo check
updateAutoPilotStatus(autopilotState.state, autopilotState.autopilotMode)
}
}
}
@@ -332,12 +303,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
//感知红绿灯
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT,
paramIndexes = [0, 1]
)
override fun onPerceptionTrafficLight(
header: MessagePad.Header?,
trafficLights: TrafficLightOuterClass.TrafficLights?
@@ -398,6 +363,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
carConfigResp: MessagePad.CarConfigResp?
) {
if (carConfigResp != null) {
val autopilotStatusInfo = getAutoPilotStatusInfo()
autopilotStatusInfo.dockVersion = carConfigResp.dockVersion
AppConfigInfo.dockerVersion = carConfigResp.dockVersion
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
@@ -584,7 +551,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param header 头
* @param roboSweeperTaskIndex 数据
*/
override fun onSweeperTaskIndexData(header: MessagePad.Header?, roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex?) {
override fun onSweeperTaskIndexData(
header: MessagePad.Header?,
roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex?
) {
roboSweeperTaskIndex?.let {
//清扫车(福田)清扫控制系统状态
CallerSweeperFutianCleanSystemListenerManager.invokeSweeperFutianCleanTaskIndexData(it)
@@ -719,7 +689,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
linkChainLog = ChainConstant.CHAIN_TYPE_CLOUD_V2N,
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
paramIndexes = [0,1]
paramIndexes = [0, 1]
)
override fun onV2nCongestionEvent(header: MessagePad.Header, rsi: MogoV2X.RSI_PB) {
CallerAutopilotIdentifyListenerManager.invokeAutopilotV2nCongestionEvent(header, rsi)
@@ -741,8 +711,21 @@ class MoGoAdasListenerImpl : OnAdasListener {
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
paramIndexes = [0]
)
override fun onV2nGlobalPathEvents(header: MessagePad.Header, roadOverview: RoadOverviewEvents.RoadOverviewData, construct: MogoV2X.RSI_PB?, triangle: MogoV2X.RSI_PB?, congestion: MogoV2X.RSI_PB?, parkingViolation: MogoV2X.RSM_PB?) {
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(roadOverview.eventCount, construct, triangle, congestion, parkingViolation)
override fun onV2nGlobalPathEvents(
header: MessagePad.Header,
roadOverview: RoadOverviewEvents.RoadOverviewData,
construct: MogoV2X.RSI_PB?,
triangle: MogoV2X.RSI_PB?,
congestion: MogoV2X.RSI_PB?,
parkingViolation: MogoV2X.RSM_PB?
) {
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(
roadOverview.eventCount,
construct,
triangle,
congestion,
parkingViolation
)
}
/**

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig.*
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
@@ -24,11 +25,11 @@ import com.zhidao.support.adas.high.common.Constants.TERMINAL_ROLE.PASSENGER
* ADAS-SDK与工控机连接状态回调
*/
class MoGoAdasMsgConnectStatusListenerImpl :
OnAdasConnectStatusListener,
IMoGoAutopilotStatusListener,
IMoGoCloudListener {
OnAdasConnectStatusListener,
IMoGoAutopilotStatusListener,
IMoGoCloudListener {
companion object{
companion object {
private const val TAG = "ConnectStatus"
}
@@ -40,9 +41,10 @@ class MoGoAdasMsgConnectStatusListenerImpl :
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
CallerAutoPilotStatusListenerManager.invokeAutoPilotIPCStatusChanged(
ipcConnectionStatus,
reason
ipcConnectionStatus,
reason
)
AppConfigInfo.connectStatusDescribe = reason
when (ipcConnectionStatus) {
Constants.IPC_CONNECTION_STATUS.CONNECTED -> {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
@@ -52,7 +54,10 @@ class MoGoAdasMsgConnectStatusListenerImpl :
AdasManager.getInstance().ipcConnectedIp
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectPort =
AdasManager.getInstance().ipcConnectedPort
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().version =
AdasManager.getInstance().adasVersion
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
AppConfigInfo.isConnectAutopilot = true
// 同步SN给工控机
syncBasicInfoToAutopilot()
//每次工控机连接成功后,需同步当前设置的美化模式状态
@@ -77,6 +82,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectPort =
AdasManager.getInstance().ipcConnectedPort
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
AppConfigInfo.isConnectAutopilot = false
//与工控机断开连接,需要重置自动驾驶状态(包括上传至云平台缓存信息),等待连接成功后同步状态信息
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = 0
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().pilotmode = 0
@@ -91,8 +97,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
}
}
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus =
ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus = ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe = reason
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
}
@@ -116,19 +121,19 @@ class MoGoAdasMsgConnectStatusListenerImpl :
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// 设置PAD-SN给工控,网络环境
AdasManager.getInstance()
.sendBasicInfoResp(
MoGoAiCloudClientConfig.getInstance().sn,
getEnvironment(),
getTerminalRole()
)
.sendBasicInfoResp(
MoGoAiCloudClientConfig.getInstance().sn,
getEnvironment(),
getTerminalRole()
)
} else {
// 乘客屏先不传sn
AdasManager.getInstance()
.sendBasicInfoResp(
"",
getEnvironment(),
getTerminalRole()
)
.sendBasicInfoResp(
"",
getEnvironment(),
getTerminalRole()
)
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.datacenter.location
import android.util.Log
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
@@ -53,7 +52,6 @@ object MoGoLocationDispatcher :
override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) {
// 更新GNSS 信息
Log.d("emArrow","高精 heading:${gnssInfo.heading}")
lastGnssLocation.gnssInfo = gnssInfo
lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
@@ -81,7 +79,6 @@ object MoGoLocationDispatcher :
lastGnssLocation.errorCode = it.errorCode
lastGnssLocation.errorInfo = it.errorInfo
}
//FileUtils.writeToFile("/sdcard/Download/", "location_wgs84.txt", "${gnssInfo.longitude},${gnssInfo.latitude}\n")
if (1 == FunctionBuildConfig.gpsProvider) {
// WGS84坐标系高精度位置信息
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
@@ -104,7 +101,6 @@ object MoGoLocationDispatcher :
override fun onMoGoLocationChanged(mogoLocation: MogoLocation) {
// 更新GaoDe 信息
lastGaoDeLocation = mogoLocation
Log.d("emArrow","高德 heading:${mogoLocation.heading}")
// 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换
if (1 == FunctionBuildConfig.gpsProvider) {
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 10000) {

View File

@@ -1,7 +1,6 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
@@ -289,7 +288,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
// 同步给MAP地图
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
System.currentTimeMillis() / 1000.0,
gnssInfo.longitude,
gnssInfo.latitude

View File

@@ -5,6 +5,7 @@ import android.os.CountDownTimer
import android.os.Handler
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
@@ -17,6 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.zhjt.service.chain.ChainLog
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
@@ -64,7 +66,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
@Volatile
private var hasObuLightStatus: Boolean = false
private var lightCountDownTimer: CountDownTimer?= null
private var lightCountDownTimer: CountDownTimer? = null
private var lastLightTime: Long = System.currentTimeMillis()
fun initServer(context: Context) {
@@ -80,16 +82,17 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
* @param trafficLights 感知红绿灯
*/
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus ")
if (!hasObuLightStatus) {
if (!hasAiLightStatus) {
lastLightTime = System.currentTimeMillis()
if(lightCountDownTimer==null){
lightCountDownTimer = object: CountDownTimer(300000,1000){
if (lightCountDownTimer == null) {
lightCountDownTimer = object : CountDownTimer(300000, 1000) {
override fun onTick(millisUntilFinished: Long) {
if((System.currentTimeMillis() - lastLightTime)>1000){
if ((System.currentTimeMillis() - lastLightTime) > 1000) {
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
hide("感知倒计时结束隐藏", DataSourceType.TELEMATIC)
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
@@ -115,9 +118,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
} else if (it.hasUTurn()) {
light = it.uTurn
}
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"onAutopilotPerceptionTrafficLight light = $light "
)
if (light == null) {
//隐藏红绿灯显示
hide()
hide("感知light为null隐藏", DataSourceType.TELEMATIC)
} else {
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
}
@@ -131,10 +138,17 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.SHOW_TRAFFIC_LIGHT, GsonUtils.toJson(trafficLightResult).toByteArray())
CallerTelematicManager.sendMsgToAllClients(
TelematicConstant.SHOW_TRAFFIC_LIGHT,
GsonUtils.toJson(trafficLightResult).toByteArray()
)
}
if (!hasObuLightStatus) {
hasAiLightStatus = true
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"onTrafficLightStatus trafficLightResult = $trafficLightResult "
)
updateTrafficLight(trafficLightResult)
}
}
@@ -144,18 +158,22 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
* @param enter true:进入路口false:离开路口
*/
override fun onEnterCrossRoad(enter: Boolean) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onEnterCrossRoad enter = $enter ")
if (!enter) {
Handler().postDelayed({
hasAiLightStatus = false
hasObuLightStatus = false
}, 5000)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.HIDE_TRAFFIC_LIGHT, "0".toByteArray())
CallerTelematicManager.sendMsgToAllClients(
TelematicConstant.HIDE_TRAFFIC_LIGHT,
"0".toByteArray()
)
}
//如果没有OBU灯态则进行隐藏如果有OBU灯态则交由OBU管理
if(!hasObuLightStatus){
if (!hasObuLightStatus) {
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
hide()
hide("云端离开路口隐藏", DataSourceType.AICLOUD)
}
}
}
@@ -165,9 +183,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onTrafficRequestError() {
hasAiLightStatus = false
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"onTrafficRequestError hasObuLightStatus = $hasObuLightStatus ------> "
)
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
if(!hasObuLightStatus){
hide()
if (!hasObuLightStatus) {
hide("云端红绿灯接口请求失败隐藏", DataSourceType.AICLOUD)
}
}
@@ -175,30 +197,46 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
* obu数据消失
*/
override fun onObuTrafficLightDisapper() {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onObuTrafficLightDisapper ------> ")
hasObuLightStatus = false
hide()
hide("OBU红绿灯消息关闭隐藏", DataSourceType.OBU)
}
/**
* 是否重置红绿灯数据,需要确保在obu的红绿灯显示的时候不执行。否则会闪屏
*/
override fun resetTrafficLight(isReset: Boolean) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus")
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus"
)
if (!hasObuLightStatus) {
if(isReset){
hide()
if (isReset) {
hide("云端重置红绿灯数据", DataSourceType.AICLOUD)
}
}
}
private fun hide(){
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() ---------> ")
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT_HIDE,
paramIndexes = [0, 1]
)
private fun hide(msg: String, sourceType: DataSourceType) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() :$msg type :$sourceType")
CallerTrafficLightListenerManager.disableTrafficLight()
}
/**
* obu 红绿灯数据
* 红绿灯数据
*/
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT,
paramIndexes = [0, 1, 2]
)
override fun onTrafficLightPlusSource(
light: TrafficLightEnum,
remain: Int,
@@ -208,7 +246,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true
}
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource ---hasObuLightStatus = $hasObuLightStatus ---hasAiLightStatus = $hasAiLightStatus"
)
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)
if (remain == -1) {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
@@ -226,10 +267,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
}
TrafficLightEnum.BLACK -> {
CallerTrafficLightListenerManager.disableTrafficLight()
hide("感知数据BLACK隐藏", lightSource)
}
else -> {
hide()
hide("未知红绿灯类型隐藏", lightSource)
}
}
@@ -237,6 +278,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
private fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
CallerLogger.d(
"${SceneConstant.M_OBU}${TAG}",
"updateTrafficLight ----- currentTrafficLight = $currentTrafficLight"
)
currentTrafficLight?.let {
val remain = if (it.remain > 99) {
99
@@ -245,9 +290,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
onTrafficLightPlusSource(it.convert(), remain, DataSourceType.AICLOUD)
}
}
fun destroy() {
//取消注册监听AI云.OBU,路侧获取红绿灯状态
CallerTrafficLightListenerManager.removeListener(TAG)