[6.4.0][启自驾指引] 调用启自驾接口之前进行异常状态拦截,如果处于异常状态,进行toast和语音提示
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.os.SystemClock
|
||||
import chassis.SpecialVehicleTaskCmdOuterClass
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.deva.badcase.BagManagerEntity
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -13,7 +14,11 @@ import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT_MOFANG
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable.IsBootable
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.GetTaskReq
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.StartTaskResp
|
||||
@@ -25,6 +30,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
|
||||
import java.lang.StringBuilder
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
@@ -64,6 +70,47 @@ object CallerAutoPilotControlManager {
|
||||
* @param controlParameters 开启自动驾驶的控制参数
|
||||
*/
|
||||
fun startAutoPilot(controlParameters: AutopilotControlParameters?) {
|
||||
/**
|
||||
* 方向盘: 1<<0
|
||||
* 油门 : 1<<1
|
||||
* 刹车: 1<<2
|
||||
* 双闪: 1<<3
|
||||
* 档位: 1<<4
|
||||
*/
|
||||
val exceptionValue = CallerDevaToolsManager.getExceptionStatusBeforeLaunchAutopilot()
|
||||
if (exceptionValue != 0) {
|
||||
val sb = StringBuilder("请检查车辆")
|
||||
if ((exceptionValue and 1) != 0) {
|
||||
sb.append("方向盘$")
|
||||
}
|
||||
if (((exceptionValue and (1 shl 1)) != 0)) {
|
||||
sb.append("油门$")
|
||||
}
|
||||
if ((exceptionValue and (1 shl 2)) != 0) {
|
||||
sb.append("刹车$")
|
||||
}
|
||||
if ((exceptionValue and (1 shl 3)) != 0) {
|
||||
sb.append("双闪$")
|
||||
}
|
||||
if ((exceptionValue and (1 shl 4)) != 0) {
|
||||
sb.append("档位$")
|
||||
}
|
||||
val voiceText = sb.toString().let { str ->
|
||||
val count = str.count { it == '$' }
|
||||
if (count == 1) {
|
||||
str.replace("$", "")
|
||||
} else {
|
||||
str.removeSuffix("$").replace("$", "、")
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "voiceText: $voiceText")
|
||||
ToastUtils.showShort(voiceText)
|
||||
AppStateManager.currentActivity()?.also {
|
||||
AIAssist.getInstance(it).speakTTSVoice(voiceText)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (controlParameters == null) {
|
||||
//LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
|
||||
return
|
||||
|
||||
@@ -363,4 +363,8 @@ object CallerDevaToolsManager {
|
||||
fun unRegisterRouteDownloadListener(tag: String) {
|
||||
devaToolsProviderApi?.unRegisterRouteDownloadListener(tag)
|
||||
}
|
||||
|
||||
fun getExceptionStatusBeforeLaunchAutopilot(): Int {
|
||||
return devaToolsProviderApi?.getExceptionStatusBeforeLaunchAutopilot() ?: 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user