[8.1.0][opt]调整B2预测和决策的UI

This commit is contained in:
chenfufeng
2025-06-17 11:53:23 +08:00
parent 1dd95623a5
commit 039ce42e46
6 changed files with 107 additions and 32 deletions

View File

@@ -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,10 +10,12 @@ 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 {
@@ -28,9 +31,21 @@ 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() {
@@ -51,6 +66,8 @@ 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 =
@@ -68,13 +85,20 @@ 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<*>) {
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) {
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
}
identify.renderAdasRegResults(objectList, mapInstanceList)
startTime = System.nanoTime()
}
}
@@ -88,6 +112,9 @@ 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>?)
@@ -107,12 +134,19 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
}
MSG_DATA_CLEAR -> {
identify.clearOldMarker()
val mapInstanceList = ArrayList<String>()
mapInstanceList.add(MogoMap.DEFAULT)
mapInstanceList.add(MogoMap.SMALL_PRED_MAP)
identify.clearOldMarkers(mapInstanceList)
}
MSG_DATA_AI_CLEAR -> {
aiCloudIdentify!!.clearAiMarker(msg.data.getString("mapInstance")!!)
}
MSG_DATA_PRE_CLEAR -> {
preIdentify.clearPredictionMarker(MogoMap.SMALL_PRED_MAP)
}
}
}
}
@@ -124,6 +158,13 @@ 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
@@ -155,6 +196,12 @@ 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

@@ -7,12 +7,16 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.business.routeoverlay.DecisionDataManager
import com.mogo.eagle.core.function.business.routeoverlay.PredictionDataManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_decision_container.view.tvPre1
import kotlinx.android.synthetic.main.layout_decision_container.view.tvPre2
import kotlinx.android.synthetic.main.layout_decision_container.view.tvPre3
import me.jessyan.autosize.utils.AutoSizeUtils
class DecisionLayout @JvmOverloads constructor(
context: Context,
@@ -40,6 +44,7 @@ class DecisionLayout @JvmOverloads constructor(
0 -> LayoutInflater.from(context).inflate(R.layout.layout_decision_container, this, true)
else -> LayoutInflater.from(context).inflate(R.layout.layout_b2_decision_container, this, true)
}
storeWidthAndHeight()
}
override fun onAttachedToWindow() {
@@ -93,4 +98,26 @@ class DecisionLayout @JvmOverloads constructor(
fun onDestroy() {
}
private fun storeWidthAndHeight() {
UiThreadHandler.post {
when (carType) {
// 默认值为对应0不需要赋值
1 -> {
val decWid = AutoSizeUtils.dp2px(context, 110f)
val decHet = AutoSizeUtils.dp2px(context, 211f)
val mapWid = AutoSizeUtils.dp2px(context, 996f)
val mapHet = AutoSizeUtils.dp2px(context, 650f)
PredictionDataManager.getInstance()?.decWidth = decWid
PredictionDataManager.getInstance()?.decHeight = decHet
PredictionDataManager.getInstance()?.mapWidth = mapWid
PredictionDataManager.getInstance()?.mapHeight = mapHet
DecisionDataManager.getInstance()?.decWidth = decWid
DecisionDataManager.getInstance()?.decHeight = decHet
DecisionDataManager.getInstance()?.mapWidth = mapWid
DecisionDataManager.getInstance()?.mapHeight = mapHet
}
}
}
}
}

View File

@@ -16,7 +16,6 @@ class PredictionLayout @JvmOverloads constructor(
private var carType = 0
init {
LayoutInflater.from(context).inflate(R.layout.layout_prediction_container, this, true)
initView(attrs)
}

View File

@@ -12,8 +12,8 @@
android:layout_height="211dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/dp_27"
android:layout_marginBottom="24dp"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginBottom="11dp"
app:map_index="0"
/>
@@ -24,7 +24,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="24dp"
android:layout_marginBottom="11dp"
app:map_index="1"
/>
@@ -34,22 +34,23 @@
android:layout_height="211dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="@dimen/dp_27"
android:layout_marginBottom="20dp"
android:layout_marginEnd="@dimen/dp_12"
android:layout_marginBottom="11dp"
app:map_index="2"
/>
<TextView
android:id="@+id/tvDecTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_36"
android:text="AIP 规划与决策"
android:textColor="#394047"
android:textSize="32dp"
android:textSize="24dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginTop="@dimen/dp_7"
/>
<TextView
@@ -58,11 +59,11 @@
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginStart="@dimen/dp_58"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginStart="@dimen/dp_49"
android:layout_marginTop="@dimen/dp_43"
android:text="11%"
android:textColor="#63707D"
android:textSize="33dp"
android:textSize="20dp"
/>
<TextView
@@ -72,10 +73,10 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_43"
android:text="86%"
android:textColor="#63707D"
android:textSize="33dp"
android:textSize="20dp"
/>
<TextView
@@ -84,10 +85,10 @@
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginEnd="@dimen/dp_58"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_51"
android:layout_marginTop="@dimen/dp_43"
android:text="3%"
android:textColor="#63707D"
android:textSize="33dp"
android:textSize="20dp"
/>
</merge>

View File

@@ -8,24 +8,25 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_36"
android:text="Prediction 预测"
android:textColor="#394047"
android:textSize="@dimen/dp_32"
android:textSize="@dimen/dp_24"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_41"
android:layout_marginTop="@dimen/dp_8"
/>
<com.mogo.eagle.core.function.view.PredictionMapView
android:id="@+id/preDetailView"
android:layout_width="373dp"
android:layout_height="294dp"
android:layout_width="348dp"
android:layout_height="230dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="26dp"
android:layout_marginBottom="12dp"
app:carPosition="6"
app:isAutoLocation="false"
app:isDisplayAnim="false"