From 021402316e65bc08d02685de702cab6c6579c51e Mon Sep 17 00:00:00 2001 From: aibingbing Date: Tue, 21 Nov 2023 13:59:33 +0800 Subject: [PATCH] =?UTF-8?q?[Taxi=E6=97=A0=E4=BA=BA=E5=8C=96]=20fix:=20V620?= =?UTF-8?q?=20=E9=80=89=E6=8B=A9=E7=9A=84=E6=BC=94=E7=BB=83=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8B=89=E5=8F=96=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94?= =?UTF-8?q?=20=E6=B2=A1=E4=BF=9D=E5=AD=98=E7=8A=B6=E6=80=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=EF=BC=9Brefactor:=20=E5=A2=9E=E5=8A=A0=E6=BC=94?= =?UTF-8?q?=E7=BB=83=E4=BB=BB=E5=8A=A1=E6=8B=89=E5=8F=96=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=97=B4=E9=9A=94=20=E5=A2=9E=E5=8A=A0=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E5=90=8E=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taxi/ui/task/TaxiCurrentTaskViewModel.kt | 4 +- .../mogo/och/taxi/ui/task/TaxiTaskModel.kt | 11 ++++++ .../function/hmi/ui/setting/SOPSettingView.kt | 38 +++++++++++-------- .../src/main/res/layout/view_sop_setting.xml | 1 - .../api/unmanned/IUnmannedListener.kt | 2 +- .../unmanned/CallerUnmannedListenerManager.kt | 18 ++++----- 6 files changed, 45 insertions(+), 29 deletions(-) diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiCurrentTaskViewModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiCurrentTaskViewModel.kt index 15ded8c048..5ac0b87dee 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiCurrentTaskViewModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiCurrentTaskViewModel.kt @@ -304,7 +304,7 @@ class TaxiCurrentTaskViewModel : BaseViewModel(), } }else{ //演练任务拉取 6.2.0使用配置的时间拉取, 默认45s TaxiTaskModel.startPrepareTaskDelay( - CallerUnmannedListenerManager.getPullTime().toLong(), result?.endSite!!.siteId) + CallerUnmannedListenerManager.getVirtualTaskPullTaskInterval() * 1000L, result?.endSite!!.siteId) } clearDemoModeAndACParameters() @@ -336,7 +336,7 @@ class TaxiCurrentTaskViewModel : BaseViewModel(), //获取新的任务 val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() currentTaskWithOrder?.endSite?.also {//使用配置的时间拉取, 默认是45s - TaxiTaskModel.startPrepareTaskDelay(CallerUnmannedListenerManager.getPullTime().toLong(), + TaxiTaskModel.startPrepareTaskDelay(CallerUnmannedListenerManager.getVirtualTaskPullTaskInterval() * 1000L, it.siteId) } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiTaskModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiTaskModel.kt index 5ffa7094c5..a20f734275 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiTaskModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/taxi/ui/task/TaxiTaskModel.kt @@ -20,12 +20,14 @@ import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener +import com.mogo.eagle.core.function.api.unmanned.IUnmannedListener 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.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02 import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager +import com.mogo.eagle.core.function.call.unmanned.CallerUnmannedListenerManager import com.mogo.eagle.core.network.utils.GsonUtil import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e @@ -211,6 +213,7 @@ object TaxiTaskModel { AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext) TrajectoryAndDistanceManager.addDistanceListener(TAG, localCalculateDistanceListener) TrajectoryAndDistanceManager.addTrajectoryListener(TAG, localCalculateTrajectoryListener) + CallerUnmannedListenerManager.addListener(TAG, mMogoUnmanedVirtualTaskPullTaskIntervalListener) } private fun releaseListeners() { @@ -227,6 +230,7 @@ object TaxiTaskModel { CallerPlanningRottingListenerManager.removeListener(mMogoAutopilotPlanningListener) OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null) AbnormalFactorsLoopManager.stopLoopAbnormalFactors() + CallerUnmannedListenerManager.removeListener(TAG) } /** @@ -241,6 +245,13 @@ object TaxiTaskModel { } } + private val mMogoUnmanedVirtualTaskPullTaskIntervalListener: IUnmannedListener = + object : IUnmannedListener { + override fun onVirtualTaskPullTaskIntervalUpdate(time: Int) { + DebugView.printInfoMsg("[演练任务拉取时间间隔变化] afterValue=${time}秒") + } + } + private val mMogoAutopilotStatusListener: IMoGoAutopilotStatusListener = object : IMoGoAutopilotStatusListener { override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index b713f0c36d..50bc7f9469 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -490,22 +490,6 @@ internal class SOPSettingView @JvmOverloads constructor( hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) } - rgPullTime.setOnCheckedChangeListener { _, checkedId -> - when (checkedId) { - R.id.rbFortyFive -> { - CallerUnmannedListenerManager.dispatchPullTime(45) - } - R.id.rbThirty -> { - CallerUnmannedListenerManager.dispatchPullTime(30) - } - R.id.rbFifteen -> { - CallerUnmannedListenerManager.dispatchPullTime(15) - } - R.id.rbFive -> { - CallerUnmannedListenerManager.dispatchPullTime(5) - } - } - } } private var overTakeEditText: String = "" @@ -652,6 +636,28 @@ internal class SOPSettingView @JvmOverloads constructor( btnSpeedOverTakeSet.visibility = View.GONE } + val virtualTaskPullTaskInterval = CallerUnmannedListenerManager.getVirtualTaskPullTaskInterval() + rbFive.isChecked = virtualTaskPullTaskInterval == 5 + rbFifteen.isChecked = virtualTaskPullTaskInterval == 15 + rbThirty.isChecked = virtualTaskPullTaskInterval == 30 + rbFortyFive.isChecked = virtualTaskPullTaskInterval == 45 + rgPullTime.setOnCheckedChangeListener { _, checkedId -> + when (checkedId) { + R.id.rbFortyFive -> { + CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(45) + } + R.id.rbThirty -> { + CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(30) + } + R.id.rbFifteen -> { + CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(15) + } + R.id.rbFive -> { + CallerUnmannedListenerManager.dispatchVirtualTaskPullTaskInterval(5) + } + } + } + /** * 魔方sop运营相关配置 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml index 1a05165d25..875a80344d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml @@ -576,7 +576,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" - android:checked="true" android:text="45s" android:textSize="32dp" /> diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/unmanned/IUnmannedListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/unmanned/IUnmannedListener.kt index bcb477607a..f44f2e5565 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/unmanned/IUnmannedListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/unmanned/IUnmannedListener.kt @@ -4,5 +4,5 @@ interface IUnmannedListener { /** * 单位: 秒(s) */ - fun onPullTimeUpdate(time: Int) + fun onVirtualTaskPullTaskIntervalUpdate(time: Int) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/unmanned/CallerUnmannedListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/unmanned/CallerUnmannedListenerManager.kt index 24fcea3412..bace10ba04 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/unmanned/CallerUnmannedListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/unmanned/CallerUnmannedListenerManager.kt @@ -7,22 +7,22 @@ import com.mogo.eagle.core.function.call.base.CallerBase /** * 无人化功能状态监听、回调管理者 */ -object CallerUnmannedListenerManager:CallerBase() { +object CallerUnmannedListenerManager : CallerBase() { private const val TAG = "CallerUnmannedListenerManager" - private var time: Int = 45 + private var virtualTaskPullTaskInterval: Int = 45 //单位:秒 override fun doSomeAfterAddListener(tag: String, listener: IUnmannedListener) { super.doSomeAfterAddListener(tag, listener) - listener.onPullTimeUpdate(time) + listener.onVirtualTaskPullTaskIntervalUpdate(virtualTaskPullTaskInterval) } - fun dispatchPullTime(time: Int) { - this.time = time + fun dispatchVirtualTaskPullTaskInterval(interval: Int) { + this.virtualTaskPullTaskInterval = interval M_LISTENERS.forEach { val listener = it.value try { - listener.onPullTimeUpdate(time) + listener.onVirtualTaskPullTaskIntervalUpdate(interval) } catch (e: Exception) { Log.e(TAG, "转发消息出现异常:${e.message}") } @@ -30,9 +30,9 @@ object CallerUnmannedListenerManager:CallerBase() { } /** - * 获取无人化演练拉取的时间间隔(单位ms) + * 获取无人化演练拉取的时间间隔(单位: 秒) */ - fun getPullTime(): Int { - return time * 1000 + fun getVirtualTaskPullTaskInterval(): Int { + return virtualTaskPullTaskInterval } } \ No newline at end of file