[8.1.2][fix]解决路口场景决策显示有误的问题
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
@@ -9,6 +10,7 @@ import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
import com.mogo.map.MogoMap
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
@@ -55,6 +57,8 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
|
||||
// 维护一个线程定时轮询数据进行地图绘制
|
||||
private val mDrawerHandler: Handler =
|
||||
object : Handler(WorkThreadHandler.newInstance("IdentifyFactoryDrawer").looper) {
|
||||
private var isPredicted = false
|
||||
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when (msg.what) {
|
||||
@@ -74,7 +78,14 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
|
||||
|
||||
MSG_DATA_TRACK -> {
|
||||
if (msg.obj is List<*>) {
|
||||
identify.renderAdasRecognizedResult(msg.obj as List<TrackedObject>?)
|
||||
val objectList = msg.obj as List<TrackedObject>?
|
||||
val mapInstanceList = ArrayList<String>()
|
||||
mapInstanceList.add(MogoMap.DEFAULT)
|
||||
if (FunctionBuildConfig.isDrawPreIdentifyData) {
|
||||
isPredicted = true
|
||||
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
|
||||
}
|
||||
identify.renderAdasRegResults(objectList, mapInstanceList)
|
||||
startTime = System.nanoTime()
|
||||
}
|
||||
}
|
||||
@@ -107,7 +118,14 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
|
||||
}
|
||||
|
||||
MSG_DATA_CLEAR -> {
|
||||
identify.clearOldMarker()
|
||||
if (isPredicted) {
|
||||
val mapInstanceList = ArrayList<String>()
|
||||
mapInstanceList.add(MogoMap.DEFAULT)
|
||||
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
|
||||
identify.clearOldMarkers(mapInstanceList)
|
||||
} else {
|
||||
identify.clearOldMarker()
|
||||
}
|
||||
}
|
||||
|
||||
MSG_DATA_AI_CLEAR -> {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis
|
||||
@@ -24,6 +25,7 @@ import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.zhidaoauto.map.data.road.RoadCross
|
||||
import com.zhidaoauto.map.data.road.StopLine
|
||||
import kotlinx.android.synthetic.main.layout_decision_container.view.tvPre1
|
||||
import kotlinx.android.synthetic.main.layout_decision_container.view.tvPre2
|
||||
@@ -120,9 +122,15 @@ class DecisionLayout @JvmOverloads constructor(
|
||||
fun onDestroy() {
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isCrossScene = false
|
||||
private var state = -1
|
||||
private var action = -1
|
||||
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
||||
if (isCrossScene) {
|
||||
Log.d(TAG, "路口场景不直接使用决策信息!")
|
||||
return
|
||||
}
|
||||
val actionMsg = planningActionMsg.actionMsg
|
||||
val s = actionMsg.drivingState.number
|
||||
val a = actionMsg.drivingAction.number
|
||||
@@ -181,9 +189,11 @@ class DecisionLayout @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var lastUpdateTime = 0L
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
if (info.distance < 15) {
|
||||
if (info.distance < 15 && !isInCrossRoad) {// 不在路口内且距离停止线小于15m
|
||||
isCrossScene = true
|
||||
val time = System.currentTimeMillis()
|
||||
if (time - lastUpdateTime > 500) {
|
||||
lastUpdateTime = time
|
||||
@@ -204,6 +214,23 @@ class DecisionLayout @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isInCrossRoad = false
|
||||
|
||||
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
|
||||
if (isInCrossRoad && !cross) {// 上次在路口内,当前不在路口内,则代表出路口了
|
||||
isCrossScene = false
|
||||
val time = System.currentTimeMillis()
|
||||
if (time - lastUpdateTime > 500) {
|
||||
lastUpdateTime = time
|
||||
ThreadUtils.runOnUiThread {
|
||||
updateAnim(2)// 出路口默认显示"车道保持"
|
||||
}
|
||||
}
|
||||
}
|
||||
isInCrossRoad = cross
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateAnim(type: Int) {
|
||||
val randomNum = 80 + Random(SystemClock.elapsedRealtime()).nextInt(16)
|
||||
|
||||
Reference in New Issue
Block a user