From 98edf0ca497d0502a87f7934e392614e9f2fbb1c Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Wed, 22 May 2024 20:01:14 +0800 Subject: [PATCH] =?UTF-8?q?[644][adas]=20=E8=83=BD=E5=90=A6=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E8=87=AA=E9=A9=BE=20=E6=B7=BB=E5=8A=A0=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E6=95=B0=E6=8D=AE=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/OCHAdasAbilityManager.java | 14 +- .../test/TestAutoPilotBeforeLaunch.kt | 68 +++++++- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 13 +- .../status/StatusManager.kt | 3 + .../status/flow/autopilot/AcceleratorImpl.kt | 4 +- .../status/flow/autopilot/BrakeImpl.kt | 4 +- .../status/flow/autopilot/DoubleFlashImpl.kt | 6 +- .../status/flow/autopilot/GearImpl.kt | 6 +- .../status/flow/autopilot/SteerImpl.kt | 6 +- .../IMoGoAutopilotActionsListener.kt | 4 +- .../CallerAutopilotActionsListenerManager.kt | 156 ++++++++++++++++- .../adas/data/bean/LaunchConditionData.java | 163 ++++++++++++++++++ .../mogo/adas/data/bean/UnableLaunchData.java | 104 ----------- .../adas/data/bean/UnableLaunchReason.java | 4 +- .../support/adas/high/OnAdasListener.java | 6 +- .../ability/AutopilotAbility230.java | 4 +- .../ability/AutopilotAbility250.java | 4 +- .../ability/AutopilotAbility330.java | 4 +- .../ability/AutopilotAbility350And360.java | 4 +- .../ability/AutopilotAbility360.java | 4 +- .../ability/AutopilotAbilityManager.java | 6 +- .../ability/BaseAutopilotAbilityChassis.java | 19 +- .../ability/OnAutopilotAbilityListener.java | 4 +- 23 files changed, 432 insertions(+), 178 deletions(-) create mode 100644 libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/LaunchConditionData.java delete mode 100644 libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchData.java diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/OCHAdasAbilityManager.java b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/OCHAdasAbilityManager.java index 1c96ec1414..cb43850345 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/OCHAdasAbilityManager.java +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/OCHAdasAbilityManager.java @@ -14,7 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.ParseVersionUtils; import com.mogo.och.common.module.callback.OchAdasStartFailureCallback; import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -29,7 +29,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo private static final String TAG = OCHAdasAbilityManager.class.getSimpleName(); private boolean isAutopilotAbility; - private UnableLaunchData unableLaunchData; + private LaunchConditionData launchConditionData; private ArrayList unableAutopilotReasons; private String startFailedCode = ""; private String startFailedMessage = ""; @@ -46,7 +46,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo public void init(Context context) { this.isAutopilotAbility = CallerAutopilotActionsListenerManager.INSTANCE.isAutopilotAbility(); - this.unableLaunchData = CallerAutopilotActionsListenerManager.INSTANCE.getUnableLaunchData(); + this.launchConditionData = CallerAutopilotActionsListenerManager.INSTANCE.getLaunchConditionData(); this.unableAutopilotReasons = CallerAutopilotActionsListenerManager.INSTANCE.getUnableAutopilotReasons(); initListeners(); } @@ -60,7 +60,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo } public String getOriginalData() { - return unableLaunchData == null ? "" : unableLaunchData.getJson(); + return launchConditionData == null ? "" : launchConditionData.getJson(); } public String getAutopilotUnAbilityReason(){ try { @@ -103,11 +103,11 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo } @Override - public void onAutopilotAbility(boolean isAutopilotAbility,@Nullable UnableLaunchData unableLaunchData, @Nullable ArrayList unableAutopilotReasons) { + public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable LaunchConditionData launchConditionData, @Nullable ArrayList unableAutopilotReasons) { this.isAutopilotAbility = isAutopilotAbility; - this.unableLaunchData = unableLaunchData; + this.launchConditionData = launchConditionData; this.unableAutopilotReasons = unableAutopilotReasons; - Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons == null ? null : unableAutopilotReasons.toString()) + " 原始数据=" + (unableLaunchData == null ? null : unableLaunchData.getJson())); + Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons == null ? null : unableAutopilotReasons.toString()) + " 原始数据=" + (launchConditionData == null ? null : launchConditionData.getJson())); if (unableAutopilotReasons != null && getMapVersion() < 30600) { //刹车变化回调 Logger.d(TAG,"onAutopilotAbility = " + isAutopilotAbility + diff --git a/app/src/androidTest/java/com/mogo/functions/test/TestAutoPilotBeforeLaunch.kt b/app/src/androidTest/java/com/mogo/functions/test/TestAutoPilotBeforeLaunch.kt index b57a08151e..22390e7a73 100644 --- a/app/src/androidTest/java/com/mogo/functions/test/TestAutoPilotBeforeLaunch.kt +++ b/app/src/androidTest/java/com/mogo/functions/test/TestAutoPilotBeforeLaunch.kt @@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateLis import com.mogo.eagle.core.function.main.MainLauncherActivity import com.mogo.eagle.core.utilcode.util.ToastUtils import com.zhjt.mogo.adas.data.bean.MogoReport -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.SourceType.CHASSIS import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE @@ -146,38 +146,92 @@ class TestAutoPilotBeforeLaunch { CallerAutopilotActionsListenerManager.setConnected(true) CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE if (flag == 1) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear") }) } if (flag == 2) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering") }) } if (flag == 3) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_BRAKE, "brake") }) } if (flag == 4) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights") }) } if (flag == 5) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_THROTTLE, "throttle") }) } if (flag == 6) { - CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList().also { + CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, + LaunchConditionData( + "", + SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder() + .setSysState(SYS_RUNNING).build(), + SsmStatusInf.getDefaultInstance().toBuilder() + .setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false) + .setRemotePilotReady(false).build(), + FSMStatusReasonRespond.getDefaultInstance() + ), ArrayList().also { it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear") it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering") it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights") diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index 75d46a51f9..c6bef4c3cd 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -59,11 +59,10 @@ import com.mogo.support.obu.ObuScene import com.zhidao.support.adas.high.OnAdasListener import com.zhjt.mogo.adas.data.bean.AdasParam import com.zhidao.support.adas.high.common.ProtocolStatus -import com.zhjt.mogo.adas.data.AdasConstants import com.zhjt.mogo.adas.data.AiCloudTask import com.zhjt.mogo.adas.data.bean.AutopilotStatistics import com.zhjt.mogo.adas.data.bean.ReceivedAck -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask @@ -168,6 +167,7 @@ class MoGoAdasListenerImpl : OnAdasListener { header: MessagePad.Header, vehicleState: VehicleStateOuterClass.VehicleState? ) { + CallerAutopilotActionsListenerManager.setVehicleState(vehicleState) if (vehicleState != null) { //转向灯数据 // CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) @@ -230,6 +230,7 @@ class MoGoAdasListenerImpl : OnAdasListener { header: MessagePad.Header, chassisStates: ChassisStatesOuterClass.ChassisStates? ) { + CallerAutopilotActionsListenerManager.setChassisStates(chassisStates) if (chassisStates != null) { chassisStates.bcmSystemStates?.let { bcmSystemStates -> // bcmSystemStates.turnLightState?.let { @@ -937,13 +938,13 @@ class MoGoAdasListenerImpl : OnAdasListener { */ override fun onAutopilotAbility( isAutopilotAbility: Boolean, - unableLaunchData: UnableLaunchData, + launchConditionData: LaunchConditionData, unableAutopilotReasons: ArrayList? ) { if (unableAutopilotReasons != null && unableAutopilotReasons.size > 0) { - autopilotAbilityCheck(isAutopilotAbility, unableAutopilotReasons.toString(), unableLaunchData) + autopilotAbilityCheck(isAutopilotAbility, unableAutopilotReasons.toString(), launchConditionData) } - invokeAutopilotAbility(isAutopilotAbility, unableLaunchData, unableAutopilotReasons) + invokeAutopilotAbility(isAutopilotAbility, launchConditionData, unableAutopilotReasons) } override fun onParallelDrivingAbility( @@ -968,7 +969,7 @@ class MoGoAdasListenerImpl : OnAdasListener { nodeAliasCode = CHAIN_CODE_ADAS_ABILITY, paramIndexes = [0, 1] ) - private fun autopilotAbilityCheck(isAutopilotAbility: Boolean, reason: String, unableLaunchData: UnableLaunchData) { + private fun autopilotAbilityCheck(isAutopilotAbility: Boolean, reason: String, launchConditionData: LaunchConditionData) { } 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 bf54b323d7..76baf933df 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 @@ -9,6 +9,7 @@ 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.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.mogo.logger.* import com.mogo.eagle.core.utilcode.util.* @@ -192,6 +193,7 @@ object StatusManager { if (source != -2) { l.filter { it.isException() }.also { ll -> val time = System.currentTimeMillis() + val launchCondition = CallerAutopilotActionsListenerManager.getLaunchCondition() ThreadUtils.getIoPool().execute { val result = runCatching { MogoAnalyticUtils.track( @@ -210,6 +212,7 @@ object StatusManager { else -> "其它" } } + itx["launch_condition"] = launchCondition itx["data"] = GsonUtils.toJson(ll) }) } 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 2fb005b6bb..2fa136ef90 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 @@ -5,7 +5,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus @@ -47,7 +47,7 @@ internal class AcceleratorImpl(ctx: Context): IFlow(ctx), IMo } } - override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) { if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { itx -> 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 3a25d274f4..33f90890c9 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 @@ -5,7 +5,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus @@ -46,7 +46,7 @@ internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisBra } } - override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) { if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_BRAKE }?.also { itx -> 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 0503dbbe27..b3ae5fca5d 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 @@ -8,11 +8,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS -import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE -import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow @@ -54,7 +52,7 @@ internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), IMo } - override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) { if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_HAZARD_LIGHTS }?.also { itx -> 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 3ab117963e..90d4d632ee 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 @@ -7,12 +7,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_GEAR import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus -import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearStateListener, IMoGoAutopilotActionsListener { @@ -48,7 +46,7 @@ internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearS } } - override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) { if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_GEAR }?.also { itx -> isError = true diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt index b27d8f5bb8..7db90a24ba 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt @@ -6,7 +6,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListe import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_STEERING import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus @@ -45,8 +45,8 @@ internal class SteerImpl(ctx: Context): IFlow(ctx), IMoGoChassisSte } } - override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { - Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $launchConditionData, ${unableAutopilotReasons?.joinToString(",")}") if (!isAutopilotAbility) { val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_STEERING }?.also { itx -> isError = true diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt index e5e02056e0..5cf8930342 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotActionsListener.kt @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.api.autopilot -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason @@ -9,5 +9,5 @@ import com.zhjt.mogo.adas.data.bean.UnableLaunchReason */ interface IMoGoAutopilotActionsListener { - fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) + fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList?) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt index 4efbc322c0..e501b199f5 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt @@ -1,9 +1,14 @@ package com.mogo.eagle.core.function.call.autopilot +import chassis.ChassisStatesOuterClass +import chassis.VehicleStateOuterClass +import com.google.protobuf.TextFormat import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import org.json.JSONException +import org.json.JSONObject /** @@ -17,16 +22,27 @@ object CallerAutopilotActionsListenerManager : CallerBase? = null + private var vehicleState: VehicleStateOuterClass.VehicleState? = null + private var chassisStates: ChassisStatesOuterClass.ChassisStates? = null + init { isAutopilotAbility = false unableAutopilotReasons = disconnectedReason() } + fun setVehicleState(vehicleState: VehicleStateOuterClass.VehicleState?) { + this.vehicleState = vehicleState; + } + + fun setChassisStates(chassisStates: ChassisStatesOuterClass.ChassisStates?) { + this.chassisStates = chassisStates; + } + private fun disconnectedReason(): ArrayList { val list = ArrayList() list.add( @@ -47,12 +63,134 @@ object CallerAutopilotActionsListenerManager : CallerBase? ) { + this.launchConditionData = launchCondition if (isConnected) { var isEquals = true if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) { @@ -92,7 +231,6 @@ object CallerAutopilotActionsListenerManager : CallerBase 0) { + jsonObject.put("data", array); + } + } catch (Exception e) { + e.printStackTrace(); + } + return jsonObject.toString(); + } + + private void arrayPut(JSONArray array, String name, boolean isReady, String reason) throws JSONException { + JSONObject objectParse = new JSONObject(); + objectParse.put("auto_pilot_ready", isReady); + if (reason != null) { + objectParse.put("auto_pilot_unready_reason", reason); + } + JSONObject object = new JSONObject(); + object.put("name", name); + object.put("parse", objectParse); + array.put(object); + } + + private void arrayPut(JSONArray array, GeneratedMessageV3 message) throws JSONException, InvalidProtocolBufferException { + JSONObject object = new JSONObject(); + object.put("name", message.getClass().getName()); +// object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false)); + object.put("parse", new JSONObject(JsonFormat.printer().print(message))); + array.put(object); + } +} diff --git a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchData.java b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchData.java deleted file mode 100644 index 8dcbf8d2be..0000000000 --- a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchData.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.zhjt.mogo.adas.data.bean; - -import com.google.protobuf.GeneratedMessageV3; -import com.google.protobuf.InvalidProtocolBufferException; -import com.google.protobuf.util.JsonFormat; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import function_state_management.FSMStatusReasonQueryOuterClass; -import system_master.SsmInfo; -import system_master.SystemStatusInfo; - -/** - * 检测到不能启动自动驾驶的数据 - * 此类目前主要用于启动自驾命令下发后的域控数据记录 - */ -public class UnableLaunchData { - /** - * 所使用的检测版本 - */ - public final String abilityVersion; - - /** - * 老底盘数据 - * null表示未用到此数据 - * TODO 不需要底盘数据,如果底盘数据存在不能启动自驾的原因会限制启动自驾命令的下发 - */ -// public final VehicleStateOuterClass.VehicleState vehicleState; - - /** - * 新底盘数据 - * null表示未用到此数据 - * TODO 不需要底盘数据,如果底盘数据存在不能启动自驾的原因会限制启动自驾命令的下发 - */ -// public final ChassisStatesOuterClass.ChassisStates chassisStates; - - /** - * 老SSM数据 - * null表示未用到此数据 - */ - public final SystemStatusInfo.StatusInfo statusInfo; - - /** - * 新SSM数据 - * null表示未用到此数据 - */ - public final SsmInfo.SsmStatusInf ssmInfo; - public final FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//FSM数据 - - public UnableLaunchData(String abilityVersion, - SystemStatusInfo.StatusInfo statusInfo, - SsmInfo.SsmStatusInf ssmInfo, - FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) { - this.abilityVersion = abilityVersion; - this.statusInfo = statusInfo; - this.ssmInfo = ssmInfo; - this.fsmStatusReasonRespond = fsmStatusReasonRespond; - } - - public String getJson() { - JSONObject jsonObject = new JSONObject(); - try { - jsonObject.put("ability_version", abilityVersion); - JSONArray array = new JSONArray(); - if (statusInfo != null) { - arrayPut(array, statusInfo.getClass().getName(), statusInfo.getAutoPilotReady(), statusInfo.getAutoPilotUnreadyReason()); - } - if (ssmInfo != null) { - arrayPut(array, ssmInfo.getClass().getName(), ssmInfo.getAutoPilotReady(), ssmInfo.getAutoPilotUnreadyReason()); - } - if (fsmStatusReasonRespond != null) { - arrayPut(array, fsmStatusReasonRespond); - } - if (array.length() > 0) { - jsonObject.put("data", array); - } - } catch (JSONException | InvalidProtocolBufferException e) { - e.printStackTrace(); - } - return jsonObject.toString(); - } - - private void arrayPut(JSONArray array, String name, boolean isReady, String reason) throws JSONException { - JSONObject objectParse = new JSONObject(); - objectParse.put("auto_pilot_ready", isReady); - if (reason != null) { - objectParse.put("auto_pilot_unready_reason", reason); - } - JSONObject object = new JSONObject(); - object.put("name", name); - object.put("parse", objectParse); - array.put(object); - } - - private void arrayPut(JSONArray array, GeneratedMessageV3 message) throws JSONException, InvalidProtocolBufferException { - JSONObject object = new JSONObject(); - object.put("name", message.getClass().getName()); -// object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false)); - object.put("parse", new JSONObject(JsonFormat.printer().print(message))); - array.put(object); - } -} diff --git a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchReason.java b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchReason.java index d6d7e032bc..e0b11d41ed 100644 --- a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchReason.java +++ b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/UnableLaunchReason.java @@ -58,12 +58,12 @@ public class UnableLaunchReason { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UnableLaunchReason that = (UnableLaunchReason) o; - return source == that.source && TextUtils.equals(unableLaunchReason, that.unableLaunchReason); + return source == that.source && unableType == that.unableType && TextUtils.equals(unableLaunchReason, that.unableLaunchReason); } @Override public int hashCode() { - return Objects.hash(source, unableLaunchReason); + return Objects.hash(source, unableType, unableLaunchReason); } @Override diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index d854e887cd..90afedde94 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -12,7 +12,7 @@ import com.zhjt.mogo.adas.data.AiCloudTask; import com.zhjt.mogo.adas.data.bean.AdasParam; import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import com.zhjt.mogo.adas.data.bean.ReceivedAck; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable; import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask; @@ -492,10 +492,10 @@ public interface OnAdasListener { * 是否有能力启动自动驾驶 * * @param isAutopilotAbility 是否能启动自动驾驶 - * @param unableLaunchData 原始数据 + * @param launchConditionData 原始数据 * @param unableAutopilotReasons 不能启动自动驾驶原因 */ - void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList unableAutopilotReasons); + void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList unableAutopilotReasons); /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java index 9a0aebe96f..a5358a2d45 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java @@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.common.autopilot.ability; import androidx.annotation.NonNull; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -30,7 +30,7 @@ public class AutopilotAbility230 extends BaseAutopilotAbilityChassis { unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons); if (listener != null) { boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶 - listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, null, null), unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), null, null, null), unableAutopilotReasons); } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java index 96abff9b14..e49ae5fec9 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java @@ -4,7 +4,7 @@ import androidx.annotation.NonNull; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.common.CupidLogUtils; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -107,7 +107,7 @@ public class AutopilotAbility250 extends BaseAutopilotAbilityChassis { unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons); if (listener != null) { boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶 - listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, null), unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), statusInfo, null, null), unableAutopilotReasons); } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java index 36ec9ee850..18b56e72d4 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.common.CupidLogUtils; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -138,7 +138,7 @@ public class AutopilotAbility330 { } } if (listener != null) { - listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, fsmStatusReasonRespond), unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), statusInfo, null, fsmStatusReasonRespond), unableAutopilotReasons); } fsmStatusReasonRespond = null; } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java index eb56d11779..53009896c1 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java @@ -4,7 +4,7 @@ import androidx.annotation.NonNull; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.common.CupidLogUtils; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -88,7 +88,7 @@ public class AutopilotAbility350And360 extends BaseAutopilotAbilityChassis { unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons); if (listener != null) { boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶 - listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, null), unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), null, statusInfo, null), unableAutopilotReasons); } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java index b5f17a69d8..14a5484c7d 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.common.CupidLogUtils; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -117,7 +117,7 @@ public class AutopilotAbility360 { } } if (listener != null) { - listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, fsmStatusReasonRespond), unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), null, statusInfo, fsmStatusReasonRespond), unableAutopilotReasons); } fsmStatusReasonRespond = null; } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java index 64ce59ffc1..cf32f031a1 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java @@ -7,7 +7,7 @@ import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhjt.mogo.adas.data.AdasConstants; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; @@ -131,9 +131,9 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener { } @Override - public void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList unableAutopilotReasons) { + public void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList unableAutopilotReasons) { if (listener != null) { - listener.onAutopilotAbility(isAutopilotAbility, unableLaunchData, unableAutopilotReasons); + listener.onAutopilotAbility(isAutopilotAbility, launchConditionData, unableAutopilotReasons); } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/BaseAutopilotAbilityChassis.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/BaseAutopilotAbilityChassis.java index 76b8a73ac7..7c4fc9a8f0 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/BaseAutopilotAbilityChassis.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/BaseAutopilotAbilityChassis.java @@ -24,7 +24,7 @@ public abstract class BaseAutopilotAbilityChassis { private static final String REASON_CHASSIS_STEERING = "方向盘"; @NonNull protected final AutopilotAbilityManager manager; - private ChassisStatesOuterClass.ChassisStates chassisStates; + protected ChassisStatesOuterClass.ChassisStates chassisStates; protected OnAutopilotAbilityListener listener; protected int mapVersion = -1;//工控机版本 protected boolean isJinlv = false;//是否是金旅小巴 @@ -39,7 +39,7 @@ public abstract class BaseAutopilotAbilityChassis { */ private Set launchAutopilotGear; - private float oldThrottle = Float.MAX_VALUE;//方向盘转角 + protected float oldSteering = Float.MAX_VALUE;//方向盘转角 public BaseAutopilotAbilityChassis(@NonNull AutopilotAbilityManager manager) { this.manager = manager; @@ -60,6 +60,9 @@ public abstract class BaseAutopilotAbilityChassis { currentLight.set(light); } + protected Chassis.LightSwitch getLightSwitch() { + return currentLight.get(); + } public void setLaunchAutopilotGear(Set launchAutopilotGear) { this.launchAutopilotGear = launchAutopilotGear; @@ -138,13 +141,13 @@ public abstract class BaseAutopilotAbilityChassis { if (chassisStates.hasSteerSystemStates()) { ChassisStatesOuterClass.SteerSystemStates steerSystemStates = chassisStates.getSteerSystemStates(); if (steerSystemStates.hasSteeringWheelAngle()) { - float throttle = steerSystemStates.getSteeringWheelAngle(); - if (oldThrottle == Float.MAX_VALUE) { - oldThrottle = throttle; + float steering = steerSystemStates.getSteeringWheelAngle(); + if (oldSteering == Float.MAX_VALUE) { + oldSteering = steering; } else { -// CupidLogUtils.log(TAG, "方向盘当前角度=" + oldThrottle + " 方向盘1秒前角度=" + throttle); - boolean isTurning = Math.abs(throttle - oldThrottle) > 8.0F; - oldThrottle = throttle; +// CupidLogUtils.log(TAG, "方向盘当前角度=" + oldSteering + " 方向盘1秒前角度=" + steering); + boolean isTurning = Math.abs(steering - oldSteering) > 8.0F; + oldSteering = steering; // CupidLogUtils.log(TAG, "方向盘是否转动=" + isTurning); if (isTurning) { unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_STEERING, REASON_CHASSIS_STEERING); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/OnAutopilotAbilityListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/OnAutopilotAbilityListener.java index c528e221d6..acccf16128 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/OnAutopilotAbilityListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/OnAutopilotAbilityListener.java @@ -3,11 +3,11 @@ package com.zhidao.support.adas.high.common.autopilot.ability; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.zhjt.mogo.adas.data.bean.UnableLaunchData; +import com.zhjt.mogo.adas.data.bean.LaunchConditionData; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import java.util.ArrayList; interface OnAutopilotAbilityListener { - void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList unableAutopilotReasons); + void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList unableAutopilotReasons); }