From 7258d2d50db9146503493a678d250ca2e295d989 Mon Sep 17 00:00:00 2001 From: renwj Date: Wed, 24 Apr 2024 18:19:33 +0800 Subject: [PATCH] =?UTF-8?q?[6.4.0][=E5=90=AF=E8=87=AA=E9=A9=BE=E6=8C=87?= =?UTF-8?q?=E5=BC=95]=20=E4=BC=98=E5=8C=96=E5=9F=8B=E7=82=B9=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=9B=E4=BC=98=E5=8C=96=E8=BD=A8=E8=BF=B9=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taxi/passenger/model/AutopilotManager.kt | 37 +------------------ .../taxi/passenger/model/AutopilotManager.kt | 34 +---------------- .../status/StatusManager.kt | 7 ++++ .../status/entity/Status.kt | 2 +- .../status/flow/IFlow.kt | 6 --- .../status/flow/autopilot/AcceleratorImpl.kt | 1 - .../status/flow/autopilot/BrakeImpl.kt | 1 - .../status/flow/autopilot/DoubleFlashImpl.kt | 1 - .../status/flow/autopilot/GearImpl.kt | 1 - .../flow/autopilot/RouteDownloadImpl.kt | 31 +++++++++++++--- 10 files changed, 35 insertions(+), 86 deletions(-) diff --git a/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt index ccadeb94a0..1852035b89 100644 --- a/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt +++ b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt @@ -55,42 +55,7 @@ object AutopilotManager : IOchAutopilotStatusListener { startServicePilotDone() } if (!CallerAutoPilotControlManager.isCanStartAutopilot(false)) { - 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("$", "、") - } - } - ToastUtils.showShort(voiceText) - AppStateManager.currentActivity()?.also { - AIAssist.getInstance(it).speakTTSVoice(voiceText) - } - return sb.toString() - } + return "启动自动驾驶不满足条件" } if(CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt index f3e2a502d3..067280e6b9 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt @@ -61,39 +61,7 @@ object AutopilotManager : IOchAutopilotStatusListener { // return // } if (!CallerAutoPilotControlManager.isCanStartAutopilot(false)) { - 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("$", "、") - } - } - ToastUtils.showShort(voiceText) - return sb.toString() - } + return "启动自动驾驶不满足条件" } if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) { ToastUtils.showLong( diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt index 53ad30dd23..b5a81a82ca 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt @@ -8,6 +8,7 @@ import androidx.lifecycle.* import androidx.lifecycle.Lifecycle.Event import androidx.lifecycle.Lifecycle.Event.ON_CREATE import androidx.lifecycle.Lifecycle.Event.ON_DESTROY +import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.mogo.logger.* @@ -183,6 +184,12 @@ object StatusManager { var ret = 0 model.status.value?.second?.filter { it is IAutopilotPreLaunchStatus + }?.takeIf { + it.isNotEmpty() + }?.also { l -> + runCatching { + MogoAnalyticUtils.track("vehicle_state_exp", HashMap().also { itx -> itx["data"] = l.joinToString(",") { it.toString() } }) + } }?.forEachIndexed { index, status -> val shl = 1 shl index if (status.isException()) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt index 25aec4fbfa..510f5f65a0 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt @@ -484,7 +484,7 @@ enum class RouteState { /** * 轨迹下载状态 */ -data class RouteDownloadStatus(val lineId: Long = -1, val state: RouteState = RouteNone): Status(), IAutopilotPreLaunchStatus { +data class RouteDownloadStatus(val lineId: Long = Long.MIN_VALUE, val state: RouteState = RouteNone): Status(), IAutopilotPreLaunchStatus { override fun isException(): Boolean { return (state == RouteStart || state == RouteFailed) && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/IFlow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/IFlow.kt index c4cc97ccbe..7f81c1f4b2 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/IFlow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/IFlow.kt @@ -3,7 +3,6 @@ package com.zhjt.mogo_core_function_devatools.status.flow import android.content.* import android.util.* import androidx.annotation.* -import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.eagle.core.utilcode.kotlin.* import com.zhjt.mogo_core_function_devatools.status.entity.Status import kotlinx.coroutines.* @@ -33,11 +32,6 @@ internal abstract class IFlow< T : Status>(val ctx: Context) : CoroutineScope { } fun send(t: T) { - if (t.isException()) { - runCatching { - MogoAnalyticUtils.track("vehicle_state_exp", HashMap().also { it["data"] = t.toString() }) - } - } chl.trySend(t) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt index 2a0aadc1a6..e16cec6b63 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt @@ -45,7 +45,6 @@ internal class AcceleratorImpl(ctx: Context): IFlow(ctx), IMo } override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { - Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { isError = true diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt index 5b64e04d79..9eeea808aa 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt @@ -47,7 +47,6 @@ internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisBra } override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { - Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_BRAKE }?.also { isError = true diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt index 89d4121b21..c5d8340924 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt @@ -52,7 +52,6 @@ internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), IMo } override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { - Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_HAZARD_LIGHTS }?.also { isError = true diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt index 083f1d9233..c83a5b7f42 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt @@ -46,7 +46,6 @@ internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearS } override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { - Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_GEAR }?.also { isError = true diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/RouteDownloadImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/RouteDownloadImpl.kt index ee070847f2..c7b00f28cb 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/RouteDownloadImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/RouteDownloadImpl.kt @@ -14,6 +14,7 @@ import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteStart import com.zhjt.mogo_core_function_devatools.status.flow.IFlow import mogo_msg.MogoReportMsg.MogoReportMessage import java.lang.Exception +import java.util.concurrent.ConcurrentHashMap internal class RouteDownloadImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotStatusListener { @@ -25,6 +26,8 @@ internal class RouteDownloadImpl(ctx: Context): IFlow(ctx), @Volatile private var toDownloadData: AutoPilotLine? = null + private val linked by lazy { ConcurrentHashMap() } + override fun onCreate() { CallerAutoPilotStatusListenerManager.addListener(TAG, this) } @@ -34,19 +37,32 @@ internal class RouteDownloadImpl(ctx: Context): IFlow(ctx), CallerAutoPilotStatusListenerManager.removeListener(TAG) } + override fun onAutopilotStatusResponse(state: Int) { + super.onAutopilotStatusResponse(state) + Logger.d(TAG, "--- onAutopilotStatusResponse -- 1 --: $state") + if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { + Logger.d(TAG, "--- onAutopilotStatusResponse -- 2 --") + linked.clear() + send(RouteDownloadStatus(toDownloadData?.lineId ?: Long.MIN_VALUE, RouteComplete)) + toDownloadData = null + } + } + override fun onAutopilotTrajectoryDownloadReq(autoPilotLine: AutoPilotLine, downloadType: Int) { super.onAutopilotTrajectoryDownloadReq(autoPilotLine, downloadType) Logger.d(TAG, "--- onAutopilotTrajectoryDownloadReq --: 1:$autoPilotLine, 2:$downloadType") if (downloadType == 0) { + linked.clear() + linked[0] = autoPilotLine.lineId toDownloadData = autoPilotLine val lineId = autoPilotLine.lineId - send(RouteDownloadStatus(lineId = lineId, state = RouteNone).also { it.rawData = toDownloadData }) + send(RouteDownloadStatus(lineId = lineId, state = RouteNone).also { it.rawData = toDownloadData }) } } override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) { super.onAutopilotGuardian(guardianInfo) - var lineId = -1L + var lineId = Long.MIN_VALUE Logger.d(TAG, "--- onAutopilotGuardian -- 1 --: ${ guardianInfo?.code }") if (MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START == guardianInfo?.code || MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS == guardianInfo?.code || @@ -63,7 +79,7 @@ internal class RouteDownloadImpl(ctx: Context): IFlow(ctx), lineId = matchResult.groupValues[1].toLong() } } catch (ignore: Exception) { } - if (lineId == -1L) { + if (lineId == Long.MIN_VALUE) { try { val regex = Regex("lineID=(\\d+)") val matchResult = regex.find(msg) @@ -82,14 +98,17 @@ internal class RouteDownloadImpl(ctx: Context): IFlow(ctx), Logger.d(TAG, "--- onAutopilotGuardian -- 4 --:line_id => $lineId, code: ${guardianInfo.code}") when (guardianInfo.code) { "ISYS_INIT_TRAJECTORY_START" -> { // 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发) - send(RouteDownloadStatus(lineId, RouteStart).also { it.rawData = toDownloadData to guardianInfo }) + linked[1] = lineId + send(RouteDownloadStatus(lineId, RouteStart).also { it.rawData = linked }) } "ISYS_INIT_TRAJECTORY_SUCCESS" -> { // 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发) - send(RouteDownloadStatus(lineId, RouteComplete).also { it.rawData = toDownloadData to guardianInfo }) + linked[2] = lineId + send(RouteDownloadStatus(lineId, RouteComplete).also { it.rawData = linked }) toDownloadData = null } "ISYS_INIT_TRAJECTORY_FAILURE" -> { // 3. 轨迹管理_轨迹下载失败,本地无对应轨迹 - send(RouteDownloadStatus(lineId, RouteFailed).also { it.rawData = toDownloadData to guardianInfo }) + linked[3] = lineId + send(RouteDownloadStatus(lineId, RouteFailed).also { it.rawData = linked }) toDownloadData = null } }