diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt index 9da319e419..c24a241088 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt @@ -14,19 +14,22 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager +import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime import com.mogo.och.common.module.manager.autopilot.line.LineManager import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager +import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager import com.zhjt.mogo.adas.common.MessageType import com.zhjt.mogo.adas.data.bean.ReceivedAck import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status import fsm.Fsm2024 import java.util.concurrent.atomic.AtomicLong +import java.util.concurrent.atomic.AtomicReference object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listener { const val TAG = "OchAutoPilotManager" - private val globalSessionId = AtomicLong(-1) + private val globalSessionId = AtomicReference() private val fsmBackSessionId = AtomicLong(-1L) init { @@ -51,18 +54,27 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen * 启动自驾中禁止再次启动自驾 */ @JvmStatic - fun canStartAutopilotBySessionId():Boolean{ - return (globalSessionId.get()==-1L).apply { - if(!this) { + fun canStartAutopilotBySessionId(): Boolean { + val sessionInfo = globalSessionId.get() + val currentTimeMillis = System.currentTimeMillis() + if(sessionInfo==null){ + return true + }else{ + if(currentTimeMillis-sessionInfo.setTime>=OchAutopilotAnalytics.LOOP_PERIOD_16S){ + clearGlobalSessionId("检测session 自带的时间 ${currentTimeMillis}_${sessionInfo.setTime}_${sessionInfo.sessionId}") + return true + }else{ ToastUtils.showLong("自驾启动中,请勿重复点击") OchAutopilotAnalytics.triggerCanStartAutopilotBySessionId(globalSessionId.get()) + return false } } } @JvmStatic fun canStartAutopilotBySessionIdInner():Boolean{ - return (globalSessionId.get()==-1L) + OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId") + return (globalSessionId.get()==null) } @JvmStatic @@ -88,14 +100,15 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen return true } - fun clearGlobalSessionId(){ - globalSessionId.set(-1) + fun clearGlobalSessionId(log:String){ + OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId${globalSessionId}_${fsmBackSessionId}_${log}") + globalSessionId.set(null) } @JvmStatic fun startAutoPilot(controlParameters: AutopilotControlParameters?): Long { val sessionId = CallerAutoPilotControlManager.startAutoPilot(controlParameters) - globalSessionId.set(sessionId) + globalSessionId.set(SessionWithTime(sessionId,System.currentTimeMillis())) fsmBackSessionId.set(-1L) OchAutopilotAnalytics.triggerStartAutopilotParameters(controlParameters, sessionId) return sessionId @@ -120,9 +133,14 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen * 启动自驾失败切 FSM返回的Session和启动SessionId 不同 */ fun checkStartSessionAndFailSessionId(){ - if(globalSessionId.get() != fsmBackSessionId.get()){ - OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff(globalSessionId.get(), - fsmBackSessionId.get()) + val sessionInfo = globalSessionId.get() + if(sessionInfo!=null) { + if (sessionInfo.sessionId != fsmBackSessionId.get()) { + OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff( + sessionInfo, + fsmBackSessionId.get() + ) + } } } } \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt index 53f7f1ab18..8f1faba2b3 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt @@ -11,9 +11,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.util.DateTimeUtils import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager -import com.mogo.och.common.module.manager.autopilot.line.LineManager +import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager import com.mogo.och.common.module.manager.loop.BizLoopManager +import com.mogo.och.common.module.utils.RxUtils +import io.reactivex.disposables.Disposable object OchAutopilotAnalytics { @@ -50,6 +52,7 @@ object OchAutopilotAnalytics { private const val EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN = "cmd_session_id_fsm_return" private val LOOP_PERIOD_15S = 15 * 1000L + val LOOP_PERIOD_16S = 16 * 1000L private var mStartAutopilotKey: String? = null @@ -95,35 +98,36 @@ object OchAutopilotAnalytics { /** * 等待底盘返回的间隙 重复启动自驾 */ - fun triggerCanStartAutopilotBySessionId(globalSessionId : Long){ + fun triggerCanStartAutopilotBySessionId(globalSessionId : SessionWithTime){ val map = hashMapOf() map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP - OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map) + OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId.sessionId}_创建时间:${globalSessionId.setTime}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map) } /** * 启动失败后 对比两个session是否相同 */ - fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: Long, fsmBackSessionId: Long){ + fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: SessionWithTime, fsmBackSessionId: Long){ val map = hashMapOf() map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP - map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = globalSessionId + map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = "${globalSessionId.sessionId}_${globalSessionId.setTime}" map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN] = fsmBackSessionId OchChainLogManager.writeChainLog("启动自驾失败且SessionId不同","globalSessionId:${globalSessionId}——————fsmBackSessionId:${fsmBackSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DIFF, patch = map) } - - private val timeOutRunnable = Runnable { - // 15s内未开启,上报失败埋点 - triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis()) - LineManager.invokeStartAutopilotTimeOut() - } + private var timeOutDisposable: Disposable?=null /** * 底盘明确告知启动自驾失败 */ fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String, startFailDate: Long) { - BizLoopManager.removeCallback(timeOutRunnable) + OchChainLogManager.writeChainLogAutopilot("自驾流程","启动自驾失败回调${failCode}_${failMsg}") + if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ + CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false") + OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾失败回调${failCode}_${failMsg}_sessiong为空") + return + } + RxUtils.disposeSubscribe(timeOutDisposable) // 判断Session 是否相同 OchAutoPilotManager.checkStartSessionAndFailSessionId() triggerStartAutopilotFailureEvent(failCode, failMsg, startFailDate) @@ -134,12 +138,10 @@ object OchAutopilotAnalytics { } private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String, startFailDate: Long) { - if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ - CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false") + OchAutoPilotManager.clearGlobalSessionId("$failMsg _ ${failCode}") + if (mStartAutopilotParams.isEmpty()) { return } - OchAutoPilotManager.clearGlobalSessionId() - if (mStartAutopilotParams.isEmpty()) return CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent", failMsg) if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = failCode @@ -172,15 +174,19 @@ object OchAutopilotAnalytics { triggerDate: Long, source:Int = 0 ) { + OchChainLogManager.writeChainLogAutopilot("自驾流程","send:${send}_${restart}_${startName}_${endName}_${lineId}_${orderId}_${source}_${triggerDate}") mStartAutopilotKey = if (restart) getEventKeyRestartService() else getEventKeyStartService() if (send) { if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotEvent canStartAutopilotBySessionIdInner == false") + OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾成功_sessiong为空") + return + } + OchAutoPilotManager.clearGlobalSessionId("启动自驾成功") + RxUtils.disposeSubscribe(timeOutDisposable) + if (mStartAutopilotParams.isEmpty()) { return } - OchAutoPilotManager.clearGlobalSessionId() - BizLoopManager.removeCallback(timeOutRunnable) - if (mStartAutopilotParams.isEmpty()) return // 开启成功,上报埋点 mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = "" mStartAutopilotParams[EVENT_PARAM_START_FAILURE_MSG] = "" @@ -200,8 +206,10 @@ object OchAutopilotAnalytics { mStartAutopilotParams[EVENT_PARAM_END_NAME] = endName mStartAutopilotParams[EVENT_PARAM_LINE_ID] = lineId mStartAutopilotParams[EVENT_PARAM_ORDER_NUMBER] = orderId?:"" - BizLoopManager.removeCallback(timeOutRunnable) - BizLoopManager.postDelayed(timeOutRunnable,LOOP_PERIOD_15S) + RxUtils.disposeSubscribe(timeOutDisposable) + timeOutDisposable = RxUtils.createSubscribe(LOOP_PERIOD_15S) { + triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis()) + } } } diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt new file mode 100644 index 0000000000..7a3e97167f --- /dev/null +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt @@ -0,0 +1,3 @@ +package com.mogo.och.common.module.manager.autopilot.autopilot.bean + +data class SessionWithTime(val sessionId:Long,val setTime:Long) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt index ccb92729d1..992862e93d 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -23,6 +23,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel import com.zhidaoauto.map.data.road.RoadCross +import java.lang.Exception class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener, IMoGoMapRoadListener { @@ -70,15 +71,17 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener, } // CallerLogger.i("$M_BIZ$TAG", "红绿灯路口请求 : $stopLineDis") mLocation?.let { it -> - trafficLightNetWorkModel.requestRoadID( - it.latitude, it.longitude, it.heading, - { - mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD) - roadIDResult = it - }, - { - //CallerLogger.w(M_V2X + TAG, "request road id error : $it") - }) + try { + trafficLightNetWorkModel.requestRoadID( + it.latitude, it.longitude, it.heading, + { + mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD) + roadIDResult = it + }, + { + //CallerLogger.w(M_V2X + TAG, "request road id error : $it") + }) + }catch (_: Exception){} } }, { //stop loop search road id diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt index 887ea182e8..46b76449c1 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt @@ -47,7 +47,7 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter 0) { this.globalPathResp = globalPath + val pointCloneList = ArrayList() + globalPath.wayPointsList.forEach { loc -> + pointCloneList.add(Point(loc.longitude, loc.latitude)) + } + reqData = pointCloneList drawRotting() } } else { + this.globalPathResp = globalPath val pointList = ArrayList() val pointCloneList = ArrayList() globalPath.wayPointsList.forEach { loc -> diff --git a/gradle.properties b/gradle.properties index e8ac5052b7..1e2578e789 100644 --- a/gradle.properties +++ b/gradle.properties @@ -92,8 +92,8 @@ WEBSOCKET_VERSION=1.1.7 applicationId=com.mogo.launcer applicationName=IntelligentPilot # RoboBus司机端:2.5.1;RoboTaxi司机端:2.5.1;RoboTaxi乘客端:1.0.0 -versionCode=6006000 -versionName=6.6.0 +versionCode=6007000 +versionName=6.7.0 ################# 新架构模块Maven版本管理 ################# MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.10