[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

@@ -202,17 +202,17 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
mView?.showHDMap_mind()
return@runInMainThread
}else{
if(havePredictionInfos&&haveTrajectoryInfos){
updateMapFlag(true)
// 展示高精地图+展示预测和决策
mView?.showHDMap_aip_prediction()
return@runInMainThread
}else{
// if(havePredictionInfos&&haveTrajectoryInfos){
// updateMapFlag(true)
// // 展示高精地图+展示预测和决策
// mView?.showHDMap_aip_prediction()
// return@runInMainThread
// }else{
updateMapFlag(false)
// 展示高精地图
mView?.showHDMap()
return@runInMainThread
}
// }
}
}
@@ -231,12 +231,12 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
}
private fun updateMapFlag(open: Boolean) {
if (open) {
FunctionBuildConfig.isDrawDecIdentifyData = true
FunctionBuildConfig.isDrawPreIdentifyData = true
} else {
FunctionBuildConfig.isDrawDecIdentifyData = false
FunctionBuildConfig.isDrawPreIdentifyData = false
}
// if (open) {
// FunctionBuildConfig.isDrawDecIdentifyData = true
// FunctionBuildConfig.isDrawPreIdentifyData = true
// } else {
// FunctionBuildConfig.isDrawDecIdentifyData = false
// FunctionBuildConfig.isDrawPreIdentifyData = false
// }
}
}

View File

@@ -20,8 +20,6 @@ import com.mogo.och.shuttle.weaknet.passenger.constant.M2Const.Companion.TYPE_MA
import com.mogo.och.shuttle.weaknet.passenger.presenter.PM2ADASPresenter
import com.mogo.och.common.module.utils.OCHThreadPoolManager
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.aciv_top_shader
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.cl_aip_contain
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.cl_prediction_contain
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.mHomeView
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.mindView
import kotlinx.android.synthetic.main.shuttle_p_m2_hpmap_fragment.overMapView
@@ -80,33 +78,39 @@ class PM2HPMapFragment :
it.clipToOutline = true
it.hideResetView()
}
// cl_prediction_contain.onCreate(savedInstanceState)
}
override fun onResume() {
super.onResume()
mHomeView.onResume()
overMapView?.onResume()
// cl_prediction_contain.onResume()
}
override fun onLowMemory() {
super.onLowMemory()
mHomeView.onLowMemory()
// cl_prediction_contain.onLowMemory()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mHomeView.onSaveInstanceState(outState)
// cl_prediction_contain.onSaveInstanceState(outState)
}
override fun onPause() {
super.onPause()
mHomeView.onPause()
overMapView?.onPause()
// cl_prediction_contain.onPause()
}
override fun onDestroyView() {
mHomeView.onDestroy()
overMapView?.onDestroy()
// cl_prediction_contain.onDestroy()
super.onDestroyView()
}
@@ -220,8 +224,8 @@ class PM2HPMapFragment :
aciv_top_shader.visibility = View.GONE
cl_aip_contain.visibility = View.GONE
cl_prediction_contain.visibility = View.GONE
// cl_aip_contain.visibility = View.GONE
// cl_prediction_contain.visibility = View.GONE
mindView.visibility = View.GONE
overMapView.visibility = View.GONE
@@ -231,8 +235,8 @@ class PM2HPMapFragment :
mHomeView.visibility = View.GONE
aciv_top_shader.visibility = View.GONE
cl_aip_contain.visibility = View.GONE
cl_prediction_contain.visibility = View.GONE
// cl_aip_contain.visibility = View.GONE
// cl_prediction_contain.visibility = View.GONE
mindView.visibility = View.GONE
overMapView.visibility = View.VISIBLE
@@ -250,8 +254,8 @@ class PM2HPMapFragment :
aciv_top_shader.visibility = View.VISIBLE
cl_aip_contain.visibility = View.GONE
cl_prediction_contain.visibility = View.GONE
// cl_aip_contain.visibility = View.GONE
// cl_prediction_contain.visibility = View.GONE
mindView.visibility = View.VISIBLE
overMapView.visibility = View.GONE
@@ -265,8 +269,8 @@ class PM2HPMapFragment :
aciv_top_shader.visibility = View.VISIBLE
cl_aip_contain.visibility = View.VISIBLE
cl_prediction_contain.visibility = View.VISIBLE
// cl_aip_contain.visibility = View.VISIBLE
// cl_prediction_contain.visibility = View.VISIBLE
mindView.visibility = View.GONE
overMapView.visibility = View.GONE
@@ -277,8 +281,8 @@ class PM2HPMapFragment :
aciv_top_shader.visibility = View.VISIBLE
cl_aip_contain.visibility = View.GONE
cl_prediction_contain.visibility = View.GONE
// cl_aip_contain.visibility = View.GONE
// cl_prediction_contain.visibility = View.GONE
mindView.visibility = View.VISIBLE

View File

@@ -51,30 +51,30 @@
android:layout_width="@dimen/dp_430"
android:layout_height="@dimen/dp_650"/>
<com.mogo.eagle.core.function.view.PredictionLayout
android:id="@+id/cl_prediction_contain"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
android:background="@drawable/b2_aip_bg"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginEnd="@dimen/dp_1"
android:layout_width="@dimen/dp_411"
android:layout_height="@dimen/dp_332"
app:car_type="B2" />
<!-- <com.mogo.eagle.core.function.view.PredictionLayout-->
<!-- android:id="@+id/cl_prediction_contain"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- android:visibility="gone"-->
<!-- android:background="@drawable/b2_aip_bg"-->
<!-- android:layout_marginTop="@dimen/dp_3"-->
<!-- android:layout_marginEnd="@dimen/dp_1"-->
<!-- android:layout_width="@dimen/dp_411"-->
<!-- android:layout_height="@dimen/dp_332"-->
<!-- app:car_type="B2" />-->
<com.mogo.eagle.core.function.view.DecisionLayout
android:id="@+id/cl_aip_contain"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
android:background="@drawable/b2_prediction_bg"
android:layout_marginEnd="@dimen/dp_1"
android:layout_marginBottom="@dimen/dp_m_1"
android:layout_width="@dimen/dp_411"
android:layout_height="@dimen/dp_332"
app:car_type="B2"
/>
<!-- <com.mogo.eagle.core.function.view.DecisionLayout-->
<!-- android:id="@+id/cl_aip_contain"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- android:visibility="gone"-->
<!-- android:background="@drawable/b2_prediction_bg"-->
<!-- android:layout_marginEnd="@dimen/dp_1"-->
<!-- android:layout_marginBottom="@dimen/dp_m_1"-->
<!-- android:layout_width="@dimen/dp_411"-->
<!-- android:layout_height="@dimen/dp_332"-->
<!-- app:car_type="B2"-->
<!-- />-->
<com.mogo.och.shuttle.weaknet.passenger.ui.mind.MindView
android:id="@+id/mindView"

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()
}
}