Merge branch 'dev_robotaxi-d_240401_6.4.0' into dev_robotaxi-d_240401_6.4.0_work_order

This commit is contained in:
xuxinchao
2024-04-18 19:58:27 +08:00
513 changed files with 7630 additions and 5896 deletions

View File

@@ -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,52 @@ object CallerAutoPilotControlManager {
* @param controlParameters 开启自动驾驶的控制参数
*/
fun startAutoPilot(controlParameters: AutopilotControlParameters?) {
/**
* 方向盘: 1<<0
* 油门 : 1<<1
* 刹车: 1<<2
* 双闪: 1<<3
* 档位: 1<<4
* 轨迹下载: (下载中) 1<<5 下载失败1<<6
*/
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("档位$")
}
if ((exceptionValue and (1 shl 5)) != 0 || ((exceptionValue and (1 shl 6)) != 0)) {
sb.setLength(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
@@ -105,6 +157,7 @@ object CallerAutoPilotControlManager {
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.sendTrajectoryDownloadReq(autoPilotLine)
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autoPilotLine, 0)
}
}
@@ -115,6 +168,7 @@ object CallerAutoPilotControlManager {
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine, downloadType: Int) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.sendTrajectoryDownloadReq(autoPilotLine, downloadType)
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autoPilotLine, downloadType)
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -268,4 +269,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
lineId = autopilotControlParameters?.autoPilotLine?.lineId ?: 0
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
fun invokeTrajectoryDownloadReq(autoPilotLine: AutoPilotLine, downloadType: Int) {
M_LISTENERS.forEach { itx ->
itx.value.onAutopilotTrajectoryDownloadReq(autoPilotLine, downloadType)
}
}
}

View File

@@ -366,4 +366,20 @@ object CallerDevaToolsManager {
fun setNetworkMode(isDebug: Boolean) {
devaToolsProviderApi?.setNetworkMode(isDebug)
}
fun attachAutopilotBeforeLaunchView(ctx: Context, group: ViewGroup) {
devaToolsProviderApi?.attachAutopilotStatusView(ctx, group)
}
fun registerRouteDownloadListener(tag: String, block:(state: Int) -> Unit) {
devaToolsProviderApi?.registerRouteDownloadListener(tag, block)
}
fun unRegisterRouteDownloadListener(tag: String) {
devaToolsProviderApi?.unRegisterRouteDownloadListener(tag)
}
fun getExceptionStatusBeforeLaunchAutopilot(): Int {
return devaToolsProviderApi?.getExceptionStatusBeforeLaunchAutopilot() ?: 0
}
}

View File

@@ -4,10 +4,7 @@ import android.content.Context
import android.view.View
import android.widget.FrameLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_FLOAT_VIEW_MANAGER
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_STATUS_VIEW_MANAGER
import com.mogo.eagle.core.function.api.hmi.view.IStatusViewLayout
import com.mogo.eagle.core.function.api.hmi.view.IViewLayoutSet
/**
@@ -18,9 +15,6 @@ object CallerHmiFloatViewManager {
private val floatViewProviderApi
get() = ARouter.getInstance().build(PATH_FLOAT_VIEW_MANAGER)
.navigation() as? IViewLayoutSet
private val statusViewProviderApi
get() = ARouter.getInstance().build(PATH_STATUS_VIEW_MANAGER)
.navigation() as? IStatusViewLayout
fun addView(view: View, params: FrameLayout.LayoutParams, movable: Boolean) {
floatViewProviderApi?.addView(view, params, movable)
@@ -30,11 +24,4 @@ object CallerHmiFloatViewManager {
floatViewProviderApi?.removeView(view)
}
fun getView(context:Context):View?{
return if (DebugConfig.isReplaceStatusview()){
statusViewProviderApi?.getStatusView(context)
}else{
null
}
}
}