[8.1.0][opt]下掉预测和决策功能

This commit is contained in:
chenfufeng
2025-06-17 20:19:43 +08:00
parent 27a4c4b125
commit fa5ce31adc
6 changed files with 70 additions and 118 deletions

View File

@@ -2,7 +2,6 @@ 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
@@ -10,12 +9,10 @@ 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
import mogo.yycp.api.proto.SocketDownData
import prediction2025.Prediction2025
import java.util.concurrent.TimeUnit
object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConfigListener {
@@ -31,21 +28,9 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
internal val aiCloudDataDrawer = IdentifyAiCloudDataDrawer()
}
// 预测
object PreDriverIdentify {
internal val preDataDrawer = IdentifyOriginDataDrawer()
}
private var identify: Identify = DriverIdentify.originDataDrawer
private var aiCloudIdentify: Identify? = null
// 预测
private var preIdentify: Identify = PreDriverIdentify.preDataDrawer
private var startTime: Long = 0L
// private var preStartTime: Long = 0L
// private var desStartTime: Long = 0L
private var dockerVersion: String? = null
fun initType() {
@@ -66,8 +51,6 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
private const val MSG_DATA_OBU_WARNING_REMOVE = 4
private const val MSG_DATA_CLEAR = 5
private const val MSG_DATA_AI_CLEAR = 6
private const val MSG_DATA_PRE_TRACK = 7
private const val MSG_DATA_PRE_CLEAR = 8
// 维护一个线程定时轮询数据进行地图绘制
private val mDrawerHandler: Handler =
@@ -85,20 +68,13 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
if (internal >= 1000) {
lostFrame(internal.toString())
identify.clearOldMarker()
preIdentify.clearOldMarker()
}
sendEmptyMessageDelayed(MSG_CHECK, 1000L)
}
MSG_DATA_TRACK -> {
if (msg.obj is List<*>) {
val objectList = msg.obj as List<TrackedObject>?
val mapInstanceList = ArrayList<String>()
mapInstanceList.add(MogoMap.DEFAULT)
if (FunctionBuildConfig.isDrawPreIdentifyData) {
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
}
identify.renderAdasRegResults(objectList, mapInstanceList)
identify.renderAdasRecognizedResult(msg.obj as List<TrackedObject>?)
startTime = System.nanoTime()
}
}
@@ -112,9 +88,6 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
}
}
MSG_DATA_PRE_TRACK -> {
}
MSG_DATA_WARNING -> {
if (msg.obj is List<*>) {
identify.renderPlanningWarningObj(msg.obj as List<MessagePad.PlanningObject>?)
@@ -134,19 +107,12 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
}
MSG_DATA_CLEAR -> {
val mapInstanceList = ArrayList<String>()
mapInstanceList.add(MogoMap.DEFAULT)
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
identify.clearOldMarkers(mapInstanceList)
identify.clearOldMarker()
}
MSG_DATA_AI_CLEAR -> {
aiCloudIdentify!!.clearAiMarker(msg.data.getString("mapInstance")!!)
}
MSG_DATA_PRE_CLEAR -> {
preIdentify.clearPredictionMarker(MogoMap.SMALL_PRED_MAP)
}
}
}
}
@@ -158,13 +124,6 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
mDrawerHandler.sendMessage(message)
}
override fun renderPredictionResult(predictionObjectList: List<Prediction2025.mPredictionObjectApp>?) {
val message = Message.obtain()
message.what = MSG_DATA_PRE_TRACK
message.obj = predictionObjectList
mDrawerHandler.sendMessage(message)
}
override fun renderAiCloudResult(
resultList: List<SocketDownData.CloudRoadDataProto>,
mapInstance: String
@@ -196,12 +155,6 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
mDrawerHandler.sendMessage(message)
}
override fun clearPredictionMarker(mapInstance: String) {
val message = Message.obtain()
message.what = MSG_DATA_PRE_CLEAR
mDrawerHandler.sendMessage(message)
}
override fun updateTrackerWarningInfo(trafficData: TrafficData) {
super.updateTrackerWarningInfo(trafficData)
val message = Message.obtain()

View File

@@ -113,13 +113,6 @@ class CoordinateAnimationView @JvmOverloads constructor(
AutoSizeUtils.dp2px(context, 128f),
AutoSizeUtils.dp2px(context, 280f)
)
if (index == 1) {
storeWidthsAndHeights()
}
// circlePaint = Paint()
// circlePaint!!.color = Color.RED
// circlePaint!!.style = Paint.Style.STROKE
// circlePaint!!.isAntiAlias = true
curvePaint!!.setARGB(102, 48, 163, 255)
// curvePaint!!.shader = LinearGradient(
@@ -162,10 +155,6 @@ class CoordinateAnimationView @JvmOverloads constructor(
setLayerType(LAYER_TYPE_HARDWARE, null)
}
private fun storeWidthsAndHeights() {
// TODO:("此时获得的宽高为0")
}
private fun getOriginBitmap(resId: Int, desWidth: Int, desHeight: Int): Bitmap {
val bitmap = BitmapFactory.decodeResource(resources, resId)
val scaleWidth = (bitmap.width * 2)

View File

@@ -6,7 +6,6 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
import kotlinx.android.synthetic.main.layout_prediction_container.view.preDetailView
class PredictionLayout @JvmOverloads constructor(
context: Context,
@@ -14,6 +13,7 @@ class PredictionLayout @JvmOverloads constructor(
) : ConstraintLayout(context, attrs) {
private var carType = 0
private var preDetailView: PredictionMapView? = null
init {
initView(attrs)
@@ -24,32 +24,38 @@ class PredictionLayout @JvmOverloads constructor(
carType = typedArray.getInt(R.styleable.CarMapLayout_car_type, 0)
typedArray.recycle()
when (carType) {
0 -> LayoutInflater.from(context).inflate(R.layout.layout_prediction_container, this, true)
else -> LayoutInflater.from(context).inflate(R.layout.layout_b2_prediction_container, this, true)
0 -> {
LayoutInflater.from(context).inflate(R.layout.layout_prediction_container, this, true)
preDetailView = findViewById(R.id.preDetailView)
}
else -> {
LayoutInflater.from(context).inflate(R.layout.layout_b2_prediction_container, this, true)
preDetailView = findViewById(R.id.preDetailView)
}
}
}
fun onCreate(savedInstanceState: Bundle?) {
preDetailView.onCreate(savedInstanceState)
preDetailView?.onCreate(savedInstanceState)
}
fun onSaveInstanceState(outState: Bundle) {
preDetailView.onSaveInstanceState(outState)
preDetailView?.onSaveInstanceState(outState)
}
fun onResume() {
preDetailView.onResume()
preDetailView?.onResume()
}
fun onLowMemory() {
preDetailView.onLowMemory()
preDetailView?.onLowMemory()
}
fun onPause() {
preDetailView.onPause()
preDetailView?.onPause()
}
fun onDestroy() {
preDetailView.onDestroy()
preDetailView?.onDestroy()
}
}