Merge remote-tracking branch 'origin/dev_robotaxi-d_241112_6.8.1_dev' into dev_robotaxi-d_241112_6.8.1_dev

This commit is contained in:
xinfengkun
2024-12-02 11:29:59 +08:00
25 changed files with 558 additions and 35 deletions

View File

@@ -162,7 +162,7 @@ object DebugDataDispatch {
newBuilder.src = "2"
newBuilder.level = ""
var autopilotStatistics =
AutopilotStatistics(1, SystemClock.elapsedRealtime(), null, null ,newBuilder.build())
AutopilotStatistics(1, SystemClock.elapsedRealtime(), AutopilotStatistics.Source.LIB,null, null ,newBuilder.build())
CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics(autopilotStatistics)
}
stopSite -> {

View File

@@ -82,6 +82,7 @@ import com.zhjt.service.chain.ChainLog
import io.netty.channel.Channel
import mogo.telematics.pad.MessagePad
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
import system_master.SsmInfo
import java.util.*
import java.util.concurrent.TimeUnit
@@ -1480,4 +1481,36 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendSimulationWireFailure(isTrigger)>-1
}
/**
* SSM发送OTA升级提示请求响应
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* @param ifUpgrade {@link SsmInfo.IfUpgrade#IMMEDIATELY}:立即
* {@link SsmInfo.IfUpgrade#DELAY}:推迟
*/
override fun sendSsmFuncOtaDownloadResponse(
token: String,
ifUpgrade: SsmInfo.IfUpgrade
): Boolean {
return AdasManager.getInstance().sendSsmFuncOtaDownloadResponse(token, ifUpgrade)>-1
}
/**
* 查询OTA状态
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* 如果没有可以传null或""
*/
override fun sendSsmFuncOtaStatusQuery(token: String): Boolean {
return AdasManager.getInstance().sendSsmFuncOtaStatusQuery(token)>-1
}
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求
* 例如下发uuid = 1 域控正常会回调两次响应接口 两次的uuid都是1通过isFront区分是前方还是后方摄像头
* 域控响应接口{@link OnAdasListener#onCaptureImgOnTakeOver(MessagePad.Header, boolean, MessagePad.CaptureImgOnTakeOver)}
*/
override fun sendCaptureImgReqOnTakeOver(uuid: Int): Boolean {
return AdasManager.getInstance().sendCaptureImgReqOnTakeOver(uuid)>-1
}
}

View File

@@ -83,6 +83,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCloudTaskL
import com.mogo.eagle.core.function.call.autopilot.CallerTakeoverListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerCaptureImgManager
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
@@ -439,7 +441,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
timestamp: Long,
request: SsmInfo.OtaDownloadRequest?
) {
if(request != null){
CallerOTAManager.invokeOtaDownloadRequest(request)
}
}
/**
@@ -456,7 +460,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
timestamp: Long,
progress: SsmInfo.OtaLoadingProgess?
) {
if(progress != null){
CallerOTAManager.invokeOtaLoadingProgress(progress)
}
}
/**
@@ -477,7 +483,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
isQuery: Boolean,
status: SsmInfo.OtaStatus?
) {
if(status != null){
CallerOTAManager.invokeOtaStatus(status)
}
}
/**
@@ -1350,7 +1358,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
isFront: Boolean,
data: MessagePad.CaptureImgOnTakeOver
) {
CallerCaptureImgManager.invokeCaptureImgOnTakeOver(isFront, data)
}
/**

View File

@@ -73,6 +73,7 @@ import com.zhjt.mogo_core_function_devatools.mofang.MoGoMoFangProviderImpl
import com.zhjt.mogo_core_function_devatools.monitor.MonitorManager
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb.Companion.getDb
import com.zhjt.mogo_core_function_devatools.ota.OTAUpgradeManager
import com.zhjt.mogo_core_function_devatools.perf.MoGoCpuUsageProviderImpl
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.iPCReportManager
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
@@ -204,6 +205,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
// apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
BadCaseManager.init(mContext!!)
ColdStartManager.init(mContext!!)
OTAUpgradeManager.init(mContext!!)
if (DebugConfig.isDebug()) {
SdtManager.init(mContext!!, true, DetectResultImpl())
}

View File

@@ -1,7 +0,0 @@
package com.zhjt.mogo_core_function_devatools.ota
/**
* OTA升级管理类
*/
class OTAManager {
}

View File

@@ -0,0 +1,11 @@
package com.zhjt.mogo_core_function_devatools.ota
/**
* OTA升级配置
*/
object OTAUpgradeConfig {
@JvmField
var otaToken: String = ""
}

View File

@@ -0,0 +1,82 @@
package com.zhjt.mogo_core_function_devatools.ota
import android.content.Context
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.devatools.IOTAListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
import system_master.SsmInfo
/**
* OTA升级管理类
*/
object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener, IOTAListener {
const val TAG = "OTAUpgradeManager"
fun init(context: Context){
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG,this)
CallerOTAManager.addListener(TAG,this)
//查询OTA状态
CallerAutoPilotControlManager.sendSsmFuncOtaStatusQuery(OTAUpgradeConfig.otaToken)
}
/**
* 自动驾驶状态信息
* @param state 状态信息
* 0-不可自动驾驶adas与工控机没有链接或工控机异常
* 1-可自动驾驶,目前处于人工干预状态
* 2-自动驾驶中
* 7-平行驾驶中
*/
override fun onAutopilotStatusResponse(state: Int) {
super.onAutopilotStatusResponse(state)
}
/**
* 是否有订单
* @param inOrder true有订单 false没有订单
*/
override fun invokeOrderStatus(inOrder: Boolean) {
super.invokeOrderStatus(inOrder)
}
/**
* SSM发送OTA升级提示请求
* @param request SSM发送OTA升级提示内容
*/
override fun onOtaDownloadRequest(request: SsmInfo.OtaDownloadRequest) {
super.onOtaDownloadRequest(request)
}
/**
* SSM上报OTA下载进度, 开始升级后定频上报
* @param progress 下载进度
*/
override fun onOtaLoadingProgress(progress: SsmInfo.OtaLoadingProgess) {
super.onOtaLoadingProgress(progress)
}
/**
* SSM上报OTA状态和查询OTA状态
* 冷启动状态变更上报以及查询状态
* 如果是查询到的结果,{@link SsmInfo.OtaStatus#getOtaInfo()}
* 中的{@link SsmInfo.OtaDownloadRequest#getOtaToken()}==""表示不存在升级任务
* @param status 冷启动状态变更上报以及查询状态
*/
override fun onOtaStatus(status: SsmInfo.OtaStatus) {
super.onOtaStatus(status)
OTAUpgradeConfig.otaToken = status.otaInfo.otaToken
}
}

View File

@@ -58,6 +58,7 @@ import com.mogo.eagle.core.function.hmi.ui.setting.StatusView
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.OTAUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
@@ -659,4 +660,15 @@ class MoGoHmiProvider : IMoGoHmiProvider {
CallerHmiViewControlListenerManager.invokeColdStartProcessView()
}
/**
* 展示OTA升级弹窗
*/
override fun showOTAUpgradeDialog() {
ThreadUtils.runOnUiThread{
if (context != null){
OTAUpgradeDialog.show(context)
}
}
}
}

View File

@@ -0,0 +1,76 @@
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.zhjt.mogo_core_function_devatools.ota.OTAUpgradeConfig
import system_master.SsmInfo
/**
* OTA升级对话框
*/
class OTAUpgradeDialog(context: Context) :
BaseFloatDialog(context,TAG), LifecycleObserver {
companion object {
private const val TAG = "OTAUpgradeDialog"
private var otaUpgradeDialog: OTAUpgradeDialog? = null
fun show(context: Context?) {
context?.let {
if (otaUpgradeDialog == null) {
otaUpgradeDialog = OTAUpgradeDialog(it)
}
otaUpgradeDialog?.let { dialog ->
if (dialog.isShowing) {
return
}
dialog.show()
}
}
}
}
private var clickListener: ClickListener? = null
private lateinit var tvUpgradeNow: TextView //立即升级
private lateinit var tvUpgradeLater: TextView //稍后升级
init{
setContentView(R.layout.dialog_ota_upgrade)
setCanceledOnTouchOutside(false)
initView()
}
private fun initView(){
tvUpgradeNow = findViewById(R.id.tv_upgrade_now)
tvUpgradeLater = findViewById(R.id.tv_upgrade_later)
//立即升级
tvUpgradeNow.setOnClickListener {
CallerAutoPilotControlManager.sendSsmFuncOtaDownloadResponse(OTAUpgradeConfig.otaToken,SsmInfo.IfUpgrade.IMMEDIATELY)
}
//稍后升级
tvUpgradeLater.setOnClickListener {
CallerAutoPilotControlManager.sendSsmFuncOtaDownloadResponse(OTAUpgradeConfig.otaToken,SsmInfo.IfUpgrade.DELAY)
}
}
override fun dismiss() {
super.dismiss()
otaUpgradeDialog = null
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener{
//立即升级
fun upgradeNow()
//稍后升级
fun upgradeLater()
}
}

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_620"
android:background="@drawable/bg_bone_dialog"
app:roundLayoutRadius="@dimen/dp_50"
>
<TextView
android:id="@+id/tv_upgrade_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/application_upgrade"
android:textSize="56dp"
android:textColor="#FFFFFFFF"
android:layout_marginTop="50dp"
/>
<TextView
android:id="@+id/tv_upgrade_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_upgrade_title"
android:text="@string/application_upgrade_confirm"
android:textColor="#FFFFFFFF"
android:textSize="43dp"
android:gravity="start"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginTop="50dp"
/>
<TextView
android:id="@+id/tv_upgrade_tip"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_upgrade_content"
app:layout_constraintBottom_toTopOf="@id/view_horizontal_line"
android:text="@string/application_upgrade_tips"
android:textColor="#FFFF4B1F"
android:textSize="36dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginTop="30dp"
/>
<TextView
android:id="@+id/tv_upgrade_now"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
android:gravity="center"
android:text="@string/ota_upgrade_now"
android:background="@drawable/bg_dialog_btn"
android:textColor="@color/color_2EACFF"
android:textSize="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_65"
android:layout_marginBottom="@dimen/dp_62"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/tv_upgrade_later"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
android:gravity="center"
android:text="@string/ota_upgrade_later"
android:textColor="@color/white"
android:textSize="@dimen/dp_40"
android:background="@drawable/bg_dialog_btn"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="@dimen/dp_65"
android:layout_marginBottom="@dimen/dp_62"
app:layout_constraintRight_toRightOf="parent"/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -248,4 +248,8 @@
<string name="cold_start_process">冷启动进度条</string>
<!--OTA升级-->
<string name="ota_upgrade_now">立即升级</string>
<string name="ota_upgrade_later">稍后升级</string>
</resources>

View File

@@ -17,6 +17,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume.Suspend
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskResp
import mogo.telematics.pad.MessagePad
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
import system_master.SsmInfo
/**
* @author xiaoyuzhou
@@ -706,4 +707,28 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
*/
fun sendSimulationWireFailure(isTrigger: Boolean): Boolean
/**
* SSM发送OTA升级提示请求响应
*
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* @param ifUpgrade {@link SsmInfo.IfUpgrade#IMMEDIATELY}:立即
* {@link SsmInfo.IfUpgrade#DELAY}:推迟
*/
fun sendSsmFuncOtaDownloadResponse(token: String,ifUpgrade: SsmInfo.IfUpgrade): Boolean
/**
* 查询OTA状态
*
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* 如果没有可以传null或""
*/
fun sendSsmFuncOtaStatusQuery(token: String): Boolean
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求
* 例如下发uuid = 1 域控正常会回调两次响应接口 两次的uuid都是1通过isFront区分是前方还是后方摄像头
* 域控响应接口{@link OnAdasListener#onCaptureImgOnTakeOver(MessagePad.Header, boolean, MessagePad.CaptureImgOnTakeOver)}
*/
fun sendCaptureImgReqOnTakeOver(uuid: Int): Boolean
}

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.core.function.api.devatools
import mogo.telematics.pad.MessagePad
/**
* 接管时前方和后方摄像头数据请求响应回调
*/
interface ICaptureImgListener {
/**
* 接管时前方和后方摄像头数据请求的响应
* @param isFront true前方摄像头 false后方摄像头
* @param data 数据
*/
fun onCaptureImgOnTakeOver(isFront: Boolean, data: MessagePad.CaptureImgOnTakeOver){}
}

View File

@@ -0,0 +1,31 @@
package com.mogo.eagle.core.function.api.devatools
import system_master.SsmInfo
/**
* OTA升级接口
*/
interface IOTAListener {
/**
* SSM发送OTA升级提示请求
* @param request SSM发送OTA升级提示内容
*/
fun onOtaDownloadRequest(request: SsmInfo.OtaDownloadRequest){}
/**
* SSM上报OTA下载进度, 开始升级后定频上报
* @param progress 下载进度
*/
fun onOtaLoadingProgress(progress: SsmInfo.OtaLoadingProgess){}
/**
* SSM上报OTA状态和查询OTA状态
* 冷启动状态变更上报以及查询状态
* 如果是查询到的结果,{@link SsmInfo.OtaStatus#getOtaInfo()}
* 中的{@link SsmInfo.OtaDownloadRequest#getOtaToken()}==""表示不存在升级任务
* @param status 冷启动状态变更上报以及查询状态
*/
fun onOtaStatus(status: SsmInfo.OtaStatus){}
}

View File

@@ -322,4 +322,9 @@ interface IMoGoHmiProvider :IProvider{
* 展示冷启动进度条
*/
fun showColdStartProcessView()
/**
* 展示OTA升级弹窗
*/
fun showOTAUpgradeDialog()
}

View File

@@ -38,6 +38,7 @@ import com.zhjt.service.chain.ChainLog
import com.zhjt.service_biz.BizConfig
import kotlinx.coroutines.launch
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
import system_master.SsmInfo
import java.lang.StringBuilder
import kotlin.random.Random
@@ -1063,4 +1064,33 @@ object CallerAutoPilotControlManager {
return providerApi?.sendSimulationWireFailure(isTrigger)?:false
}
/**
* SSM发送OTA升级提示请求响应
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* @param ifUpgrade {@link SsmInfo.IfUpgrade#IMMEDIATELY}:立即
* {@link SsmInfo.IfUpgrade#DELAY}:推迟
*/
fun sendSsmFuncOtaDownloadResponse(token: String,ifUpgrade: SsmInfo.IfUpgrade): Boolean{
return providerApi?.sendSsmFuncOtaDownloadResponse(token,ifUpgrade)?:false
}
/**
* 查询OTA状态
* @param token 域控发送OTA升级请求中的Token {@link SsmInfo.OtaDownloadRequest#getOtaToken()}
* 如果没有可以传null或""
*/
fun sendSsmFuncOtaStatusQuery(token: String): Boolean{
return providerApi?.sendSsmFuncOtaStatusQuery(token)?:false
}
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求
* 例如下发uuid = 1 域控正常会回调两次响应接口 两次的uuid都是1通过isFront区分是前方还是后方摄像头
* 域控响应接口{@link OnAdasListener#onCaptureImgOnTakeOver(MessagePad.Header, boolean, MessagePad.CaptureImgOnTakeOver)}
*/
fun sendCaptureImgReqOnTakeOver(uuid: Int): Boolean{
return providerApi?.sendCaptureImgReqOnTakeOver(uuid)?:false
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.devatools
import com.mogo.eagle.core.function.api.devatools.ICaptureImgListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
/**
* 接管时前方和后方摄像头数据请求响应回调管理
*/
object CallerCaptureImgManager: CallerBase<ICaptureImgListener>() {
/**
* 接管时前方和后方摄像头数据请求的响应
*/
fun invokeCaptureImgOnTakeOver(isFront: Boolean, data: MessagePad.CaptureImgOnTakeOver){
M_LISTENERS.forEach{
val listener = it.value
listener.onCaptureImgOnTakeOver(isFront, data)
}
}
}

View File

@@ -0,0 +1,48 @@
package com.mogo.eagle.core.function.call.devatools
import com.mogo.eagle.core.function.api.devatools.IOTAListener
import com.mogo.eagle.core.function.call.base.CallerBase
import system_master.SsmInfo
/**
* OTA升级接口回调管理
*/
object CallerOTAManager: CallerBase<IOTAListener>() {
/**
* SSM发送OTA升级提示请求
* @param request SSM发送OTA升级提示内容
*/
fun invokeOtaDownloadRequest(request: SsmInfo.OtaDownloadRequest){
M_LISTENERS.forEach {
val listener = it.value
listener.onOtaDownloadRequest(request)
}
}
/**
* SSM上报OTA下载进度, 开始升级后定频上报
* @param progress 下载进度
*/
fun invokeOtaLoadingProgress(progress: SsmInfo.OtaLoadingProgess){
M_LISTENERS.forEach {
val listener = it.value
listener.onOtaLoadingProgress(progress)
}
}
/**
* SSM上报OTA状态和查询OTA状态
* 冷启动状态变更上报以及查询状态
* 如果是查询到的结果,{@link SsmInfo.OtaStatus#getOtaInfo()}
* 中的{@link SsmInfo.OtaDownloadRequest#getOtaToken()}==""表示不存在升级任务
* @param status 冷启动状态变更上报以及查询状态
*/
fun invokeOtaStatus(status: SsmInfo.OtaStatus){
M_LISTENERS.forEach {
val listener = it.value
listener.onOtaStatus(status)
}
}
}

View File

@@ -469,4 +469,11 @@ object CallerHmiManager {
hmiProviderApi?.showColdStartProcessView()
}
/**
* 展示OTA升级弹窗
*/
fun showOTAUpgradeDialog(){
hmiProviderApi?.showOTAUpgradeDialog()
}
}

View File

@@ -1,6 +1,7 @@
package com.zhjt.mogo.adas.data.bean;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import fsm.Fsm2024;
@@ -18,7 +19,7 @@ public class AutopilotStatistics {
/**
* 成功
*/
int SUCCESSFUL = 0;
int SUCCEED = 0;
/**
* 失败
*/
@@ -29,6 +30,14 @@ public class AutopilotStatistics {
int CANCEL = 2;
}
public enum Source {
LIB,//ADAS库 [用在下取消]
REPORT,//系统监控 [用在失败]
FSM, //老版FSM [用在成功]
FSM2024, //新版FSM [用在成功和失败]
CHASSIS//底盘 [用在成功]
}
/**
* 启动自动驾驶后状态
* 0 成功
@@ -62,9 +71,16 @@ public class AutopilotStatistics {
@Nullable
public final MogoReportMsg.MogoReportMessage failedMessage;
public AutopilotStatistics(int status, long usedTime, @Nullable MessagePad.SetAutopilotModeReq req, @Nullable Fsm2024.FSMStateMsg fsmState, @Nullable MogoReportMsg.MogoReportMessage failedMessage) {
/**
* 数据来源
*/
@NonNull
public final Source source;
public AutopilotStatistics(int status, long usedTime, @NonNull Source source, @Nullable MessagePad.SetAutopilotModeReq req, @Nullable Fsm2024.FSMStateMsg fsmState, @Nullable MogoReportMsg.MogoReportMessage failedMessage) {
this.status = status;
this.usedTime = usedTime;
this.source = source;
this.req = req;
this.fsmState = fsmState;
this.failedMessage = failedMessage;

View File

@@ -41,10 +41,10 @@ public class AutopilotReview {
void onReview(AutopilotStatistics statistics);
}
private void onCallback(@Define.AutopilotStartStatus int status) {
private void onCallback(@Define.AutopilotStartStatus int status, @NonNull AutopilotStatistics.Source source) {
long usedTime = SystemClock.elapsedRealtime() - startTime;
if (listener != null) {
listener.onReview(new AutopilotStatistics(status, usedTime, startReq, fsmState, failedMessage));
listener.onReview(new AutopilotStatistics(status, usedTime, source, startReq, fsmState, failedMessage));
}
startTime = 0;
startReq = null;
@@ -68,7 +68,7 @@ public class AutopilotReview {
startReq = null;
failedMessage = null;
fsmState = null;
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL);
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL, AutopilotStatistics.Source.LIB);
}
}
@@ -82,26 +82,38 @@ public class AutopilotReview {
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
return;
}
if (startReq != null && message != null) {
failedMessage = message;
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
failedMessage = message;
if (message != null) {
if (startReq == null) {
this.failedMessage = null;
} else {
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED, AutopilotStatistics.Source.REPORT);
}
}
}
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState) {
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState, int autopilotState) {
this.fsmState = fsmState;
if (startReq != null && fsmState != null) {
if (fsmState.hasSession()) {
Fsm2024.Session session = fsmState.getSession();
if (session.hasSessionActiveMode() && session.hasSessionResult()) {
if (session.getSessionActiveMode() == Fsm2024.ActiveMode.PILOT_ACTIVE &&
session.getSessionResult() == Fsm2024.SessionResult.REQUEST_FAILED) {
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
if (fsmState != null) {
if (startReq == null) {
this.fsmState = null;
} else {
if (fsmState.hasSession()) {
Fsm2024.Session session = fsmState.getSession();
if (session.hasSessionActiveMode() && session.hasSessionResult()) {
if (session.getSessionActiveMode() == Fsm2024.ActiveMode.PILOT_ACTIVE) {
if (session.getSessionResult() == Fsm2024.SessionResult.REQUEST_SUCCEED) {
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED, AutopilotStatistics.Source.FSM2024);
} else if (session.getSessionResult() == Fsm2024.SessionResult.REQUEST_FAILED) {
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED, AutopilotStatistics.Source.FSM2024);
}
}
}
}
}
}
onAutopilotResult(autopilotState, AutopilotStatistics.Source.FSM2024);
}
/**
@@ -109,9 +121,13 @@ public class AutopilotReview {
*
* @param autopilotState
*/
public void onAutopilotResult(int autopilotState) {
public void onAutopilotResult(int autopilotState, @NonNull AutopilotStatistics.Source source) {
//FSM2024版本大于等于2.0时使用FSM的数据进行判断是否失败
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
return;
}
if (startReq != null && autopilotState == 2) {
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL);
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED, source);
}
}
}

View File

@@ -39,7 +39,7 @@ public final class Define {
public @interface SubscribeType {
}
@IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL,
@IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED,
AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED,
AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL})
@Retention(RetentionPolicy.SOURCE)

View File

@@ -11,6 +11,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.protocol.RawData;
import com.zhjt.mogo.adas.data.AdasConstants;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import mogo.telematics.pad.MessagePad;
@@ -39,7 +40,7 @@ public class AutopilotStateMessage extends MyAbstractMessageHandler {
if (AdasManager.getInstance().getNodeStateInfo(AdasConstants.NodeName.FSM2024).getExistState() != AdasConstants.NodeExistState.NODE_EXIST_NORMAL) {
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
if (autopilotReview != null) {
autopilotReview.onAutopilotResult(autopilotState.getState());
autopilotReview.onAutopilotResult(autopilotState.getState(), AutopilotStatistics.Source.CHASSIS);
}
}
AdasChannel.calculateTimeConsumingBusiness("自动驾驶状态", nowTime);

View File

@@ -35,8 +35,7 @@ public class FSM2024StateMessage extends MyAbstractMessageHandler {
nowTime = SystemClock.elapsedRealtime();
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState);
if (autopilotReview != null) {
autopilotReview.setFSM2024State(fsmState);
autopilotReview.onAutopilotResult(autopilotState);
autopilotReview.setFSM2024State(fsmState, autopilotState);
}
if (adasListener != null) {
if (fsmState.getRepeatedPilotNotStandbyReasonCount() == 0) {

View File

@@ -11,6 +11,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import java.util.HashMap;
import java.util.Map;
@@ -107,7 +108,7 @@ public class FunctionStatesMessage extends MyAbstractMessageHandler {
adasListener.onAutopilotState(header.toBuilder().setMsgType(MessagePad.MessageType.MsgTypeAutopilotState).build(), autopilotState);
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
if (autopilotReview != null) {
autopilotReview.onAutopilotResult(autopilotState.getState());
autopilotReview.onAutopilotResult(autopilotState.getState(), AutopilotStatistics.Source.FSM);
}
}